Commit 200543c1 authored by Bryan O'Donoghue's avatar Bryan O'Donoghue Committed by Greg Kroah-Hartman

staging: greybus: operation: add private data with get/set accessors

Asynchronous operation completion handler's lives are made easier if there
is a generic pointer that can store private data associated with the
operation. This patch adds a pointer field to struct gb_operation and
get/set methods to access that pointer.
Signed-off-by: default avatarBryan O'Donoghue <pure.logic@nexus-software.ie>
Cc: Johan Hovold <johan@kernel.org>
Cc: Alex Elder <elder@kernel.org>
Cc: Mitch Tasman <tasman@leaflabs.com>
Cc: greybus-dev@lists.linaro.org
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 44b02da3
...@@ -105,6 +105,8 @@ struct gb_operation { ...@@ -105,6 +105,8 @@ struct gb_operation {
int active; int active;
struct list_head links; /* connection->operations */ struct list_head links; /* connection->operations */
void *private;
}; };
static inline bool static inline bool
...@@ -206,6 +208,17 @@ static inline int gb_operation_unidirectional(struct gb_connection *connection, ...@@ -206,6 +208,17 @@ static inline int gb_operation_unidirectional(struct gb_connection *connection,
request, request_size, GB_OPERATION_TIMEOUT_DEFAULT); request, request_size, GB_OPERATION_TIMEOUT_DEFAULT);
} }
static inline void *gb_operation_get_data(struct gb_operation *operation)
{
return operation->private;
}
static inline void gb_operation_set_data(struct gb_operation *operation,
void *data)
{
operation->private = data;
}
int gb_operation_init(void); int gb_operation_init(void);
void gb_operation_exit(void); void gb_operation_exit(void);
......
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