summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/operation.h
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-07-01 12:37:26 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2015-07-01 16:50:59 -0700
commit710067e2ef42473c823fc8176ca9536b1a42c491 (patch)
tree3090a3a80556b1498e450b93a5afe815d44e63e1 /drivers/staging/greybus/operation.h
parent73f9d73f124ccba16403971b5101d4a947161481 (diff)
greybus: operation: add incoming-operation flag
Add flag field to struct gb_operation, and a first flag GB_OPERATION_FLAG_INCOMING to identify incoming operations. Pass an initial set of flags when allocating new operations, and use these to identify incoming operations rather than overloading the meaning of GB_OPERATION_TYPE_INVALID. This also allows us to set the type for all operations during allocation. Also add convenience helper to identify incoming operations. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/operation.h')
-rw-r--r--drivers/staging/greybus/operation.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/staging/greybus/operation.h b/drivers/staging/greybus/operation.h
index 3bf757195fa3..b6bbc8419a3a 100644
--- a/drivers/staging/greybus/operation.h
+++ b/drivers/staging/greybus/operation.h
@@ -89,6 +89,8 @@ struct gb_message {
void *hcpriv;
};
+#define GB_OPERATION_FLAG_INCOMING BIT(0)
+
/*
* A Greybus operation is a remote procedure call performed over a
* connection between two UniPro interfaces.
@@ -113,8 +115,9 @@ struct gb_operation {
struct gb_connection *connection;
struct gb_message *request;
struct gb_message *response;
- u8 type;
+ unsigned long flags;
+ u8 type;
u16 id;
int errno; /* Operation result */
@@ -126,6 +129,12 @@ struct gb_operation {
struct list_head links; /* connection->operations */
};
+static inline bool
+gb_operation_is_incoming(struct gb_operation *operation)
+{
+ return operation->flags & GB_OPERATION_FLAG_INCOMING;
+}
+
void gb_connection_recv(struct gb_connection *connection,
void *data, size_t size);