summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2015-05-07 13:03:52 -0500
committerGreg Kroah-Hartman <gregkh@google.com>2015-05-07 22:57:31 +0200
commit6d653370c0a67ff9b9b0d8249182d537859b528c (patch)
treea7522c75f35a67ff55202eddb1b3f61809e551ab /drivers/staging
parent5c58640d8d66504c43c062e6e7d4ed0ade6bde9e (diff)
downloadop-kernel-dev-6d653370c0a67ff9b9b0d8249182d537859b528c.zip
op-kernel-dev-6d653370c0a67ff9b9b0d8249182d537859b528c.tar.gz
greybus: eliminate extra response flag definitions
All protocols use the same value to distinguish between request and response message types. This is a requirement. Use GB_MESSAGE_TYPE_RESPONSE rather than GB_OPERATION_TYPE_RESPONSE for the name of the flag used to distiguish between request and response messages. Get rid of the redundant response flag definitions that are associated with specific protocols. Describe the symbolic values as "operation types" rather than "message types" where they are defined. The message type for a request is the same as the operation type; the message type for a response is the operation type OR'd with GB_MESSAGE_TYPE_RESPONSE. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/greybus/gpbridge.h5
-rw-r--r--drivers/staging/greybus/hid.c3
-rw-r--r--drivers/staging/greybus/operation.c8
-rw-r--r--drivers/staging/greybus/operation.h2
-rw-r--r--drivers/staging/greybus/spi.c3
-rw-r--r--drivers/staging/greybus/uart.c3
-rw-r--r--drivers/staging/greybus/vibrator.c3
7 files changed, 10 insertions, 17 deletions
diff --git a/drivers/staging/greybus/gpbridge.h b/drivers/staging/greybus/gpbridge.h
index e230188..85d8019 100644
--- a/drivers/staging/greybus/gpbridge.h
+++ b/drivers/staging/greybus/gpbridge.h
@@ -65,7 +65,6 @@
#define GB_I2C_TYPE_TIMEOUT 0x03
#define GB_I2C_TYPE_RETRIES 0x04
#define GB_I2C_TYPE_TRANSFER 0x05
-#define GB_I2C_TYPE_RESPONSE 0x80 /* OR'd with rest */
#define GB_I2C_RETRIES_DEFAULT 3
#define GB_I2C_TIMEOUT_DEFAULT 1000 /* milliseconds */
@@ -133,7 +132,6 @@ struct gb_i2c_transfer_response {
#define GB_GPIO_TYPE_IRQ_MASK 0x0d
#define GB_GPIO_TYPE_IRQ_UNMASK 0x0e
#define GB_GPIO_TYPE_IRQ_EVENT 0x0f
-#define GB_GPIO_TYPE_RESPONSE 0x80 /* OR'd with rest */
#define GB_GPIO_DEBOUNCE_USEC_DEFAULT 0 /* microseconds */
@@ -223,7 +221,7 @@ struct gb_gpio_irq_event_request {
#define GB_PWM_VERSION_MAJOR 0x00
#define GB_PWM_VERSION_MINOR 0x01
-/* Greybus PWM request types */
+/* Greybus PWM operation types */
#define GB_PWM_TYPE_INVALID 0x00
#define GB_PWM_TYPE_PROTOCOL_VERSION 0x01
#define GB_PWM_TYPE_PWM_COUNT 0x02
@@ -233,7 +231,6 @@ struct gb_gpio_irq_event_request {
#define GB_PWM_TYPE_POLARITY 0x06
#define GB_PWM_TYPE_ENABLE 0x07
#define GB_PWM_TYPE_DISABLE 0x08
-#define GB_PWM_TYPE_RESPONSE 0x80 /* OR'd with rest */
/* pwm count request has no payload */
struct gb_pwm_count_response {
diff --git a/drivers/staging/greybus/hid.c b/drivers/staging/greybus/hid.c
index 556cf9b..00dc7e5 100644
--- a/drivers/staging/greybus/hid.c
+++ b/drivers/staging/greybus/hid.c
@@ -20,7 +20,7 @@
#define GB_HID_VERSION_MAJOR 0x00
#define GB_HID_VERSION_MINOR 0x01
-/* Greybus HID request types */
+/* Greybus HID operation types */
#define GB_HID_TYPE_INVALID 0x00
#define GB_HID_TYPE_PROTOCOL_VERSION 0x01
#define GB_HID_TYPE_GET_DESC 0x02
@@ -30,7 +30,6 @@
#define GB_HID_TYPE_GET_REPORT 0x06
#define GB_HID_TYPE_SET_REPORT 0x07
#define GB_HID_TYPE_IRQ_EVENT 0x08
-#define GB_HID_TYPE_RESPONSE 0x80 /* OR'd with rest */
/* Report type */
#define GB_HID_INPUT_REPORT 0
diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c
index 3639e27..1ec930c 100644
--- a/drivers/staging/greybus/operation.c
+++ b/drivers/staging/greybus/operation.c
@@ -396,7 +396,7 @@ bool gb_operation_response_alloc(struct gb_operation *operation,
struct gb_message *response;
u8 type;
- type = operation->type | GB_OPERATION_TYPE_RESPONSE;
+ type = operation->type | GB_MESSAGE_TYPE_RESPONSE;
response = gb_operation_message_alloc(hd, type, response_size,
GFP_KERNEL);
if (!response)
@@ -508,8 +508,8 @@ struct gb_operation *gb_operation_create(struct gb_connection *connection,
{
if (WARN_ON_ONCE(type == GB_OPERATION_TYPE_INVALID))
return NULL;
- if (WARN_ON_ONCE(type & GB_OPERATION_TYPE_RESPONSE))
- type &= ~GB_OPERATION_TYPE_RESPONSE;
+ if (WARN_ON_ONCE(type & GB_MESSAGE_TYPE_RESPONSE))
+ type &= ~GB_MESSAGE_TYPE_RESPONSE;
return gb_operation_create_common(connection, type,
request_size, response_size);
@@ -855,7 +855,7 @@ void gb_connection_recv(struct gb_connection *connection,
}
operation_id = le16_to_cpu(header.operation_id);
- if (header.type & GB_OPERATION_TYPE_RESPONSE)
+ if (header.type & GB_MESSAGE_TYPE_RESPONSE)
gb_connection_recv_response(connection, operation_id,
header.result, data, msg_size);
else
diff --git a/drivers/staging/greybus/operation.h b/drivers/staging/greybus/operation.h
index 38684f2..82b8fe5 100644
--- a/drivers/staging/greybus/operation.h
+++ b/drivers/staging/greybus/operation.h
@@ -24,7 +24,7 @@ struct gb_operation;
* The top bit of the type in an operation message header indicates
* whether the message is a request (bit clear) or response (bit set)
*/
-#define GB_OPERATION_TYPE_RESPONSE ((u8)0x80)
+#define GB_MESSAGE_TYPE_RESPONSE ((u8)0x80)
enum gb_operation_result {
GB_OP_SUCCESS = 0x00,
diff --git a/drivers/staging/greybus/spi.c b/drivers/staging/greybus/spi.c
index 639c9cd..731639a 100644
--- a/drivers/staging/greybus/spi.c
+++ b/drivers/staging/greybus/spi.c
@@ -66,7 +66,7 @@ struct gb_spi {
#define GB_SPI_FLAG_NO_RX BIT(1) /* can't do buffer read */
#define GB_SPI_FLAG_NO_TX BIT(2) /* can't do buffer write */
-/* Greybus spi request types */
+/* Greybus spi operation types */
#define GB_SPI_TYPE_INVALID 0x00
#define GB_SPI_TYPE_PROTOCOL_VERSION 0x01
#define GB_SPI_TYPE_MODE 0x02
@@ -74,7 +74,6 @@ struct gb_spi {
#define GB_SPI_TYPE_BITS_PER_WORD_MASK 0x04
#define GB_SPI_TYPE_NUM_CHIPSELECT 0x05
#define GB_SPI_TYPE_TRANSFER 0x06
-#define GB_SPI_TYPE_RESPONSE 0x80 /* OR'd with rest */
/* mode request has no payload */
struct gb_spi_mode_response {
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
index 51e4f7b..35ab3ca 100644
--- a/drivers/staging/greybus/uart.c
+++ b/drivers/staging/greybus/uart.c
@@ -37,7 +37,7 @@
#define GB_UART_VERSION_MAJOR 0x00
#define GB_UART_VERSION_MINOR 0x01
-/* Greybus UART request types */
+/* Greybus UART operation types */
#define GB_UART_TYPE_INVALID 0x00
#define GB_UART_TYPE_PROTOCOL_VERSION 0x01
#define GB_UART_TYPE_SEND_DATA 0x02
@@ -46,7 +46,6 @@
#define GB_UART_TYPE_SET_CONTROL_LINE_STATE 0x05
#define GB_UART_TYPE_SET_BREAK 0x06
#define GB_UART_TYPE_SERIAL_STATE 0x07 /* Unsolicited data */
-#define GB_UART_TYPE_RESPONSE 0x80 /* OR'd with rest */
struct gb_uart_send_data_request {
__le16 size;
diff --git a/drivers/staging/greybus/vibrator.c b/drivers/staging/greybus/vibrator.c
index 2943a9b..aefd2cd 100644
--- a/drivers/staging/greybus/vibrator.c
+++ b/drivers/staging/greybus/vibrator.c
@@ -27,12 +27,11 @@ struct gb_vibrator_device {
#define GB_VIBRATOR_VERSION_MAJOR 0x00
#define GB_VIBRATOR_VERSION_MINOR 0x01
-/* Greybus Vibrator request types */
+/* Greybus Vibrator operation types */
#define GB_VIBRATOR_TYPE_INVALID 0x00
#define GB_VIBRATOR_TYPE_PROTOCOL_VERSION 0x01
#define GB_VIBRATOR_TYPE_ON 0x02
#define GB_VIBRATOR_TYPE_OFF 0x03
-#define GB_VIBRATOR_TYPE_RESPONSE 0x80 /* OR'd with rest */
struct gb_vibrator_on_request {
__le16 timeout_ms;
OpenPOWER on IntegriCloud