Commit e3398811 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: operation: add unidirectional-operation flag

Add flag to identify unidirectional operations.

Use convenience helper rather than open coding the identification when
suppressing response messages.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Reviewed-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 710067e2
...@@ -500,6 +500,9 @@ gb_operation_create_incoming(struct gb_connection *connection, u16 id, ...@@ -500,6 +500,9 @@ gb_operation_create_incoming(struct gb_connection *connection, u16 id,
/* Caller has made sure we at least have a message header. */ /* Caller has made sure we at least have a message header. */
request_size = size - sizeof(struct gb_operation_msg_hdr); request_size = size - sizeof(struct gb_operation_msg_hdr);
if (!id)
flags |= GB_OPERATION_FLAG_UNIDIRECTIONAL;
operation = gb_operation_create_common(connection, type, operation = gb_operation_create_common(connection, type,
request_size, 0, flags, GFP_ATOMIC); request_size, 0, flags, GFP_ATOMIC);
if (operation) { if (operation) {
...@@ -666,7 +669,7 @@ static int gb_operation_response_send(struct gb_operation *operation, ...@@ -666,7 +669,7 @@ static int gb_operation_response_send(struct gb_operation *operation,
} }
/* Sender of request does not care about response. */ /* Sender of request does not care about response. */
if (!operation->id) if (gb_operation_is_unidirectional(operation))
return 0; return 0;
if (!operation->response) { if (!operation->response) {
......
...@@ -90,6 +90,7 @@ struct gb_message { ...@@ -90,6 +90,7 @@ struct gb_message {
}; };
#define GB_OPERATION_FLAG_INCOMING BIT(0) #define GB_OPERATION_FLAG_INCOMING BIT(0)
#define GB_OPERATION_FLAG_UNIDIRECTIONAL BIT(1)
/* /*
* A Greybus operation is a remote procedure call performed over a * A Greybus operation is a remote procedure call performed over a
...@@ -135,6 +136,12 @@ gb_operation_is_incoming(struct gb_operation *operation) ...@@ -135,6 +136,12 @@ gb_operation_is_incoming(struct gb_operation *operation)
return operation->flags & GB_OPERATION_FLAG_INCOMING; return operation->flags & GB_OPERATION_FLAG_INCOMING;
} }
static inline bool
gb_operation_is_unidirectional(struct gb_operation *operation)
{
return operation->flags & GB_OPERATION_FLAG_UNIDIRECTIONAL;
}
void gb_connection_recv(struct gb_connection *connection, void gb_connection_recv(struct gb_connection *connection,
void *data, size_t size); void *data, size_t size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment