* [PATCH 0/2] input: convert to c99 format
@ 2012-09-17 14:17 Shubhrajyoti D
2012-09-17 14:18 ` [PATCH 1/2] input: Convert struct i2c_msg initialization to C99 format Shubhrajyoti D
2012-09-17 14:18 ` [PATCH 2/2] " Shubhrajyoti D
0 siblings, 2 replies; 3+ messages in thread
From: Shubhrajyoti D @ 2012-09-17 14:17 UTC (permalink / raw)
To: linux-input; +Cc: linux-kernel, julia.lawall, Shubhrajyoti D
The series tries to convert the i2c_msg to c99 struct.
This may avoid issues like below if someone tries to add an
element to the structure.
http://www.mail-archive.com/linux-i2c@vger.kernel.org/msg08972.html
Special thanks to Julia Lawall for helping it automate.
By the below script.
http://www.mail-archive.com/cocci@diku.dk/msg02753.html
Checkpatch warn of more than 80 chars have been ignored.
Shubhrajyoti D (2):
input: Convert struct i2c_msg initialization to C99 format
input: Convert struct i2c_msg initialization to C99 format
drivers/input/joystick/as5011.c | 6 +++---
drivers/input/touchscreen/cy8ctmg110_ts.c | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
--
1.7.5.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] input: Convert struct i2c_msg initialization to C99 format
2012-09-17 14:17 [PATCH 0/2] input: convert to c99 format Shubhrajyoti D
@ 2012-09-17 14:18 ` Shubhrajyoti D
2012-09-17 14:18 ` [PATCH 2/2] " Shubhrajyoti D
1 sibling, 0 replies; 3+ messages in thread
From: Shubhrajyoti D @ 2012-09-17 14:18 UTC (permalink / raw)
To: linux-input; +Cc: linux-kernel, julia.lawall, Shubhrajyoti D
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.
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/input/joystick/as5011.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c
index c96653b..35302fb 100644
--- a/drivers/input/joystick/as5011.c
+++ b/drivers/input/joystick/as5011.c
@@ -85,7 +85,7 @@ 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 +98,8 @@ 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;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] input: Convert struct i2c_msg initialization to C99 format
2012-09-17 14:17 [PATCH 0/2] input: convert to c99 format Shubhrajyoti D
2012-09-17 14:18 ` [PATCH 1/2] input: Convert struct i2c_msg initialization to C99 format Shubhrajyoti D
@ 2012-09-17 14:18 ` Shubhrajyoti D
1 sibling, 0 replies; 3+ messages in thread
From: Shubhrajyoti D @ 2012-09-17 14:18 UTC (permalink / raw)
To: linux-input; +Cc: linux-kernel, julia.lawall, Shubhrajyoti D
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.
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/input/touchscreen/cy8ctmg110_ts.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c
index 464f1bf..2ed0427 100644
--- a/drivers/input/touchscreen/cy8ctmg110_ts.c
+++ b/drivers/input/touchscreen/cy8ctmg110_ts.c
@@ -99,9 +99,9 @@ static int cy8ctmg110_read_regs(struct cy8ctmg110 *tsc,
int ret;
struct i2c_msg msg[2] = {
/* first write slave position to i2c devices */
- { client->addr, 0, 1, &cmd },
+ { .addr = client->addr, .flags = 0, .len = 1, .buf = &cmd },
/* Second read data from position */
- { client->addr, I2C_M_RD, len, data }
+ { .addr = client->addr, .flags = I2C_M_RD, .len = len, .buf = data }
};
ret = i2c_transfer(client->adapter, msg, 2);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-17 14:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-17 14:17 [PATCH 0/2] input: convert to c99 format Shubhrajyoti D
2012-09-17 14:18 ` [PATCH 1/2] input: Convert struct i2c_msg initialization to C99 format Shubhrajyoti D
2012-09-17 14:18 ` [PATCH 2/2] " Shubhrajyoti D
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).