diff options
author | Shubhrajyoti D <shubhrajyoti@ti.com> | 2012-10-10 12:35:38 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-10-11 03:48:54 -0400 |
commit | 24e491c21b4e214a980a5daf2a5bc80e8c410ce6 (patch) | |
tree | 347c3122134b187361ef8805796d9b9caa4d20a9 | |
parent | 9493d974b0f1f34903adfb529a510d4d768493dc (diff) |
Input: as5011 - use C99-style structure initializators
Convert the struct i2c_msg initialization to C99 format. This makes
maintaining and editing the code simpler. Also helps once other fields
like transferred are added in future.
Thanks to Julia Lawall <julia.lawall@lip6.fr> for automating the
conversion.
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/joystick/as5011.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c index c96653b58867..9d869e202b81 100644 --- a/drivers/input/joystick/as5011.c +++ b/drivers/input/joystick/as5011.c | |||
@@ -85,7 +85,10 @@ static int as5011_i2c_write(struct i2c_client *client, | |||
85 | { | 85 | { |
86 | uint8_t data[2] = { aregaddr, avalue }; | 86 | uint8_t data[2] = { aregaddr, avalue }; |
87 | struct i2c_msg msg = { | 87 | struct i2c_msg msg = { |
88 | client->addr, I2C_M_IGNORE_NAK, 2, (uint8_t *)data | 88 | .addr = client->addr, |
89 | .flags = I2C_M_IGNORE_NAK, | ||
90 | .len = 2, | ||
91 | .buf = (uint8_t *)data | ||
89 | }; | 92 | }; |
90 | int error; | 93 | int error; |
91 | 94 | ||
@@ -98,8 +101,18 @@ static int as5011_i2c_read(struct i2c_client *client, | |||
98 | { | 101 | { |
99 | uint8_t data[2] = { aregaddr }; | 102 | uint8_t data[2] = { aregaddr }; |
100 | struct i2c_msg msg_set[2] = { | 103 | struct i2c_msg msg_set[2] = { |
101 | { client->addr, I2C_M_REV_DIR_ADDR, 1, (uint8_t *)data }, | 104 | { |
102 | { client->addr, I2C_M_RD | I2C_M_NOSTART, 1, (uint8_t *)data } | 105 | .addr = client->addr, |
106 | .flags = I2C_M_REV_DIR_ADDR, | ||
107 | .len = 1, | ||
108 | .buf = (uint8_t *)data | ||
109 | }, | ||
110 | { | ||
111 | .addr = client->addr, | ||
112 | .flags = I2C_M_RD | I2C_M_NOSTART, | ||
113 | .len = 1, | ||
114 | .buf = (uint8_t *)data | ||
115 | } | ||
103 | }; | 116 | }; |
104 | int error; | 117 | int error; |
105 | 118 | ||