Input: as5011 - use C99-style structure initializators
authorShubhrajyoti D <shubhrajyoti@ti.com>
Wed, 10 Oct 2012 16:35:38 +0000 (09:35 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 11 Oct 2012 07:48:54 +0000 (00:48 -0700)
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>
drivers/input/joystick/as5011.c

index c96653b58867deb406a13913774a7e35c074dec7..9d869e202b81862b05b4448b1cf15ad21da71415 100644 (file)
@@ -85,7 +85,10 @@ static int as5011_i2c_write(struct i2c_client *client,
 {
        uint8_t data[2] = { aregaddr, avalue };
        struct i2c_msg msg = {
-               client->addr, I2C_M_IGNORE_NAK, 2, (uint8_t *)data
+               .addr = client->addr,
+               .flags = I2C_M_IGNORE_NAK,
+               .len = 2,
+               .buf = (uint8_t *)data
        };
        int error;
 
@@ -98,8 +101,18 @@ static int as5011_i2c_read(struct i2c_client *client,
 {
        uint8_t data[2] = { aregaddr };
        struct i2c_msg msg_set[2] = {
-               { client->addr, I2C_M_REV_DIR_ADDR, 1, (uint8_t *)data },
-               { client->addr, I2C_M_RD | I2C_M_NOSTART, 1, (uint8_t *)data }
+               {
+                       .addr = client->addr,
+                       .flags = I2C_M_REV_DIR_ADDR,
+                       .len = 1,
+                       .buf = (uint8_t *)data
+               },
+               {
+                       .addr = client->addr,
+                       .flags = I2C_M_RD | I2C_M_NOSTART,
+                       .len = 1,
+                       .buf = (uint8_t *)data
+               }
        };
        int error;