OSDN Git Service

greybus: operation: Move operation header to greybus_protocols.h
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 29 Jul 2015 06:12:54 +0000 (11:42 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 4 Aug 2015 02:57:40 +0000 (19:57 -0700)
This should be exposed to external users (like gbsim). Move it to
greybus_protocols.h.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_protocols.h
drivers/staging/greybus/operation.h

index 61fe9dc..9192ee7 100644 (file)
 #define GB_CONTROL_CPORT_ID                    2
 
 
-/* Control Protocol */
+/*
+ * All operation messages (both requests and responses) begin with
+ * a header that encodes the size of the message (header included).
+ * This header also contains a unique identifier, that associates a
+ * response message with its operation.  The header contains an
+ * operation type field, whose interpretation is dependent on what
+ * type of protocol is used over the connection.  The high bit
+ * (0x80) of the operation type field is used to indicate whether
+ * the message is a request (clear) or a response (set).
+ *
+ * Response messages include an additional result byte, which
+ * communicates the result of the corresponding request.  A zero
+ * result value means the operation completed successfully.  Any
+ * other value indicates an error; in this case, the payload of the
+ * response message (if any) is ignored.  The result byte must be
+ * zero in the header for a request message.
+ *
+ * The wire format for all numeric fields in the header is little
+ * endian.  Any operation-specific data begins immediately after the
+ * header.
+ */
+struct gb_operation_msg_hdr {
+       __le16  size;           /* Size in bytes of header + payload */
+       __le16  operation_id;   /* Operation unique id */
+       __u8    type;           /* E.g GB_I2C_TYPE_* or GB_GPIO_TYPE_* */
+       __u8    result;         /* Result of request (in responses only) */
+       __u8    pad[2];         /* must be zero (ignore when read) */
+};
 
 
+/* Control Protocol */
+
 /* version request has no payload */
 struct gb_protocol_version_response {
        __u8    major;
index 1b7cc6a..16488d0 100644 (file)
@@ -43,35 +43,6 @@ enum gb_operation_result {
        GB_OP_MALFUNCTION       = 0xff,
 };
 
-/*
- * All operation messages (both requests and responses) begin with
- * a header that encodes the size of the message (header included).
- * This header also contains a unique identifier, that associates a
- * response message with its operation.  The header contains an
- * operation type field, whose interpretation is dependent on what
- * type of protocol is used over the connection.  The high bit
- * (0x80) of the operation type field is used to indicate whether
- * the message is a request (clear) or a response (set).
- *
- * Response messages include an additional result byte, which
- * communicates the result of the corresponding request.  A zero
- * result value means the operation completed successfully.  Any
- * other value indicates an error; in this case, the payload of the
- * response message (if any) is ignored.  The result byte must be
- * zero in the header for a request message.
- *
- * The wire format for all numeric fields in the header is little
- * endian.  Any operation-specific data begins immediately after the
- * header.
- */
-struct gb_operation_msg_hdr {
-       __le16  size;           /* Size in bytes of header + payload */
-       __le16  operation_id;   /* Operation unique id */
-       __u8    type;           /* E.g GB_I2C_TYPE_* or GB_GPIO_TYPE_* */
-       __u8    result;         /* Result of request (in responses only) */
-       __u8    pad[2];         /* must be zero (ignore when read) */
-};
-
 #define GB_OPERATION_MESSAGE_SIZE_MIN  sizeof(struct gb_operation_msg_hdr)
 #define GB_OPERATION_MESSAGE_SIZE_MAX  U16_MAX