]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: don't use 0 as an operation id
authorAlex Elder <elder@linaro.org>
Wed, 3 Dec 2014 14:35:06 +0000 (08:35 -0600)
committerGreg Kroah-Hartman <greg@kroah.com>
Wed, 3 Dec 2014 23:05:58 +0000 (15:05 -0800)
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: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/operation.c

index b2ebbe42a45be95c70774e41fbd717f2300fe1fe..c0e206db9ed738e884adf6bb5dd70a1fc9362cff 100644 (file)
@@ -151,10 +151,11 @@ static void gb_pending_operation_insert(struct gb_operation *operation)
 
        /*
         * 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);
-       operation->id = ++connection->op_cycle;
+       operation->id = ++connection->op_cycle % U16_MAX + 1;
        list_move_tail(&operation->links, &connection->pending);
        spin_unlock_irq(&gb_operations_lock);