Commit 0ba02c4d authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

greybus: don't use 0 as an operation id

Stop allowing 0x0000 to be used as an operation id.  That id will be
reserved for use by operations that will return no response message.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent c939c2f8
...@@ -151,10 +151,11 @@ static void gb_pending_operation_insert(struct gb_operation *operation) ...@@ -151,10 +151,11 @@ static void gb_pending_operation_insert(struct gb_operation *operation)
/* /*
* Assign the operation's id and move it into its * Assign the operation's id and move it into its
* connection's pending list. * connection's pending list. Zero is a reserved operation
* id.
*/ */
spin_lock_irq(&gb_operations_lock); spin_lock_irq(&gb_operations_lock);
operation->id = ++connection->op_cycle; operation->id = ++connection->op_cycle % U16_MAX + 1;
list_move_tail(&operation->links, &connection->pending); list_move_tail(&operation->links, &connection->pending);
spin_unlock_irq(&gb_operations_lock); spin_unlock_irq(&gb_operations_lock);
......
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