From: Johan Hovold Date: Wed, 1 Jul 2015 10:37:27 +0000 (+0200) Subject: greybus: operation: add unidirectional-operation flag X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1420 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e3398811c3c3b90501ca67c5de683953efe6cdde;p=karo-tx-linux.git 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: Johan Hovold Reviewed-by: Bryan O'Donoghue Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index ad0959985aa3..b32010ba7bc1 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -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. */ request_size = size - sizeof(struct gb_operation_msg_hdr); + if (!id) + flags |= GB_OPERATION_FLAG_UNIDIRECTIONAL; + operation = gb_operation_create_common(connection, type, request_size, 0, flags, GFP_ATOMIC); if (operation) { @@ -666,7 +669,7 @@ static int gb_operation_response_send(struct gb_operation *operation, } /* Sender of request does not care about response. */ - if (!operation->id) + if (gb_operation_is_unidirectional(operation)) return 0; if (!operation->response) { diff --git a/drivers/staging/greybus/operation.h b/drivers/staging/greybus/operation.h index b6bbc8419a3a..07e43a771f8b 100644 --- a/drivers/staging/greybus/operation.h +++ b/drivers/staging/greybus/operation.h @@ -90,6 +90,7 @@ struct gb_message { }; #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 @@ -135,6 +136,12 @@ gb_operation_is_incoming(struct gb_operation *operation) 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 *data, size_t size);