]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
greybus: operation: fix definition of the invalid type
authorJohan Hovold <johan@hovoldconsulting.com>
Fri, 29 Apr 2016 15:08:37 +0000 (17:08 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Fri, 29 Apr 2016 21:27:05 +0000 (14:27 -0700)
The invalid request type has been redefined as 0x7f.

Also remove the redundant redefinition of the invalid type from the
operation header.

Note that operation type 0x00 has been repurposed for the new generic
ping operation, which will be used to implement proper connection tear
down.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_protocols.h
drivers/staging/greybus/operation.c
drivers/staging/greybus/operation.h

index 07988fb10e0d9104abdf6199344accb4c0ea1274..f1e8b345a7618f4ef99610737d6636e23b3d05a8 100644 (file)
@@ -95,9 +95,9 @@ struct gb_operation_msg_hdr {
 } __packed;
 
 
-/* Generic request numbers supported by all modules */
-#define GB_REQUEST_TYPE_INVALID                        0x00
+/* Generic request types */
 #define GB_REQUEST_TYPE_PROTOCOL_VERSION       0x01
+#define GB_REQUEST_TYPE_INVALID                        0x7f
 
 struct gb_protocol_version_request {
        __u8    major;
index fcae7479374066c2c6a7e7374ea64617b7c7b157..e7e9b0e72269a1bc4dad7ea24c7bcb7e18e4feac 100644 (file)
@@ -282,10 +282,10 @@ static void gb_operation_message_init(struct gb_host_device *hd,
 
        /*
         * The type supplied for incoming message buffers will be
-        * 0x00.  Such buffers will be overwritten by arriving data
-        * so there's no need to initialize the message header.
+        * GB_REQUEST_TYPE_INVALID. Such buffers will be overwritten by
+        * arriving data so there's no need to initialize the message header.
         */
-       if (type != GB_OPERATION_TYPE_INVALID) {
+       if (type != GB_REQUEST_TYPE_INVALID) {
                u16 message_size = (u16)(sizeof(*header) + payload_size);
 
                /*
@@ -536,7 +536,7 @@ gb_operation_create_flags(struct gb_connection *connection,
                                size_t response_size, unsigned long flags,
                                gfp_t gfp)
 {
-       if (WARN_ON_ONCE(type == GB_OPERATION_TYPE_INVALID))
+       if (WARN_ON_ONCE(type == GB_REQUEST_TYPE_INVALID))
                return NULL;
        if (WARN_ON_ONCE(type & GB_MESSAGE_TYPE_RESPONSE))
                type &= ~GB_MESSAGE_TYPE_RESPONSE;
@@ -573,7 +573,9 @@ gb_operation_create_incoming(struct gb_connection *connection, u16 id,
                flags |= GB_OPERATION_FLAG_UNIDIRECTIONAL;
 
        operation = gb_operation_create_common(connection, type,
-                                       request_size, 0, flags, GFP_ATOMIC);
+                                               request_size,
+                                               GB_REQUEST_TYPE_INVALID,
+                                               flags, GFP_ATOMIC);
        if (!operation)
                return NULL;
 
index 8ef8f514dafa1d1591c21f16fe51c160aa945fdf..117d7df2e0bd788407f3ca0583906e663dfe0f0d 100644 (file)
@@ -17,12 +17,6 @@ struct gb_operation;
 /* The default amount of time a request is given to complete */
 #define GB_OPERATION_TIMEOUT_DEFAULT   1000    /* milliseconds */
 
-/*
- * No protocol may define an operation that has numeric value 0x00.
- * It is reserved as an explicitly invalid value.
- */
-#define GB_OPERATION_TYPE_INVALID      ((u8)0x00)
-
 /*
  * The top bit of the type in an operation message header indicates
  * whether the message is a request (bit clear) or response (bit set)