linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 1/7] rtc: Convert struct i2c_msg initialization to C99 format
  2012-09-24  9:47 [PATCHv2 0/7] rtc: convert to c99 format Shubhrajyoti D
@ 2012-09-24  9:47 ` Shubhrajyoti D
  0 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti D @ 2012-09-24  9:47 UTC (permalink / raw)
  To: rtc-linux; +Cc: linux-kernel, julia.lawall, a.zummo, 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/rtc/rtc-ds1672.c |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c
index 7fa67d0..577dbae 100644
--- a/drivers/rtc/rtc-ds1672.c
+++ b/drivers/rtc/rtc-ds1672.c
@@ -37,8 +37,17 @@ static int ds1672_get_datetime(struct i2c_client *client, struct rtc_time *tm)
 	unsigned char buf[4];
 
 	struct i2c_msg msgs[] = {
-		{client->addr, 0, 1, &addr},	/* setup read ptr */
-		{client->addr, I2C_M_RD, 4, buf},	/* read date */
+		{/* setup read ptr */
+			.addr = client->addr,
+			.len = 1,
+			.buf = &addr
+		},
+		{/* setup read ptr */
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = 4,
+			.buf = buf
+		},
 	};
 
 	/* read date registers */
@@ -99,8 +108,17 @@ static int ds1672_get_control(struct i2c_client *client, u8 *status)
 	unsigned char addr = DS1672_REG_CONTROL;
 
 	struct i2c_msg msgs[] = {
-		{client->addr, 0, 1, &addr},	/* setup read ptr */
-		{client->addr, I2C_M_RD, 1, status},	/* read control */
+		{/* setup read ptr */
+			.addr = client->addr,
+			.len = 1,
+			.buf = &addr
+		},
+		{/* read control */
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = 1,
+			.buf = status
+		},
 	};
 
 	/* read control register */
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCHv2 0/7] rtc: convert to c99 format
@ 2012-09-25 10:33 Shubhrajyoti D
  2012-09-25 10:33 ` [PATCHv2 1/7] rtc: Convert struct i2c_msg initialization to C99 format Shubhrajyoti D
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Shubhrajyoti D @ 2012-09-25 10:33 UTC (permalink / raw)
  To: rtc-linux; +Cc: linux-kernel, akpm, a.zummo, Shubhrajyoti D

The series tries to convert the i2c_msg to c99 struct.
This may avoid issues like below if someone tries to add a
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
 
Resending with Andrew Morton in cc for review as it was suggested to me.


Shubhrajyoti D (7):
  rtc: Convert struct i2c_msg initialization to C99 format
  rtc: Convert struct i2c_msg initialization to C99 format
  rtc: Convert struct i2c_msg initialization to C99 format
  rtc: Convert struct i2c_msg initialization to C99 format
  rtc: Convert struct i2c_msg initialization to C99 format
  rtc: Convert struct i2c_msg initialization to C99 format
  rtc: Convert struct i2c_msg initialization to C99 format

 drivers/rtc/rtc-ds1672.c  |   26 +++++++++++--
 drivers/rtc/rtc-em3027.c  |   17 +++++++-
 drivers/rtc/rtc-isl1208.c |   20 ++++++++--
 drivers/rtc/rtc-pcf8563.c |   13 +++++-
 drivers/rtc/rtc-rs5c372.c |    7 +++-
 drivers/rtc/rtc-s35390a.c |   13 +++++-
 drivers/rtc/rtc-x1205.c   |   92 ++++++++++++++++++++++++++++++++++++++-------
 7 files changed, 158 insertions(+), 30 deletions(-)

-- 
1.7.5.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCHv2 1/7] rtc: Convert struct i2c_msg initialization to C99 format
  2012-09-25 10:33 [PATCHv2 0/7] rtc: convert to c99 format Shubhrajyoti D
@ 2012-09-25 10:33 ` Shubhrajyoti D
  2012-09-25 10:55   ` Felipe Balbi
  2012-09-25 10:33 ` [PATCHv2 2/7] " Shubhrajyoti D
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Shubhrajyoti D @ 2012-09-25 10:33 UTC (permalink / raw)
  To: rtc-linux; +Cc: linux-kernel, akpm, a.zummo, 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/rtc/rtc-ds1672.c |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c
index 7fa67d0..577dbae 100644
--- a/drivers/rtc/rtc-ds1672.c
+++ b/drivers/rtc/rtc-ds1672.c
@@ -37,8 +37,17 @@ static int ds1672_get_datetime(struct i2c_client *client, struct rtc_time *tm)
 	unsigned char buf[4];
 
 	struct i2c_msg msgs[] = {
-		{client->addr, 0, 1, &addr},	/* setup read ptr */
-		{client->addr, I2C_M_RD, 4, buf},	/* read date */
+		{/* setup read ptr */
+			.addr = client->addr,
+			.len = 1,
+			.buf = &addr
+		},
+		{/* setup read ptr */
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = 4,
+			.buf = buf
+		},
 	};
 
 	/* read date registers */
@@ -99,8 +108,17 @@ static int ds1672_get_control(struct i2c_client *client, u8 *status)
 	unsigned char addr = DS1672_REG_CONTROL;
 
 	struct i2c_msg msgs[] = {
-		{client->addr, 0, 1, &addr},	/* setup read ptr */
-		{client->addr, I2C_M_RD, 1, status},	/* read control */
+		{/* setup read ptr */
+			.addr = client->addr,
+			.len = 1,
+			.buf = &addr
+		},
+		{/* read control */
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = 1,
+			.buf = status
+		},
 	};
 
 	/* read control register */
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCHv2 2/7] rtc: Convert struct i2c_msg initialization to C99 format
  2012-09-25 10:33 [PATCHv2 0/7] rtc: convert to c99 format Shubhrajyoti D
  2012-09-25 10:33 ` [PATCHv2 1/7] rtc: Convert struct i2c_msg initialization to C99 format Shubhrajyoti D
@ 2012-09-25 10:33 ` Shubhrajyoti D
  2012-09-25 10:33 ` [PATCHv2 3/7] " Shubhrajyoti D
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti D @ 2012-09-25 10:33 UTC (permalink / raw)
  To: rtc-linux; +Cc: linux-kernel, akpm, a.zummo, 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/rtc/rtc-x1205.c |   92 +++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 78 insertions(+), 14 deletions(-)

diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
index 403b3d4..9b46875 100644
--- a/drivers/rtc/rtc-x1205.c
+++ b/drivers/rtc/rtc-x1205.c
@@ -97,8 +97,17 @@ static int x1205_get_datetime(struct i2c_client *client, struct rtc_time *tm,
 	int i;
 
 	struct i2c_msg msgs[] = {
-		{ client->addr, 0, 2, dt_addr },	/* setup read ptr */
-		{ client->addr, I2C_M_RD, 8, buf },	/* read date */
+		{/* setup read ptr */
+			.addr = client->addr,
+			.len = 2,
+			.buf = dt_addr
+		},
+		{/* read date */
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = 8,
+			.buf = buf
+		},
 	};
 
 	/* read date registers */
@@ -142,8 +151,17 @@ static int x1205_get_status(struct i2c_client *client, unsigned char *sr)
 	static unsigned char sr_addr[2] = { 0, X1205_REG_SR };
 
 	struct i2c_msg msgs[] = {
-		{ client->addr, 0, 2, sr_addr },	/* setup read ptr */
-		{ client->addr, I2C_M_RD, 1, sr },	/* read status */
+		{     /* setup read ptr */
+			.addr = client->addr,
+			.len = 2,
+			.buf = sr_addr
+		},
+		{    /* read status */
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = 1,
+			.buf = sr
+		},
 	};
 
 	/* read status register */
@@ -279,8 +297,17 @@ static int x1205_get_dtrim(struct i2c_client *client, int *trim)
 	static unsigned char dtr_addr[2] = { 0, X1205_REG_DTR };
 
 	struct i2c_msg msgs[] = {
-		{ client->addr, 0, 2, dtr_addr },	/* setup read ptr */
-		{ client->addr, I2C_M_RD, 1, &dtr }, 	/* read dtr */
+		{	/* setup read ptr */
+			.addr = client->addr,
+			.len = 2,
+			.buf = dtr_addr
+		},
+		{      /* read dtr */
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = 1,
+			.buf = &dtr
+		},
 	};
 
 	/* read dtr register */
@@ -311,8 +338,17 @@ static int x1205_get_atrim(struct i2c_client *client, int *trim)
 	static unsigned char atr_addr[2] = { 0, X1205_REG_ATR };
 
 	struct i2c_msg msgs[] = {
-		{ client->addr, 0, 2, atr_addr },	/* setup read ptr */
-		{ client->addr, I2C_M_RD, 1, &atr }, 	/* read atr */
+		{/* setup read ptr */
+			.addr = client->addr,
+			.len = 2,
+			.buf = atr_addr
+		},
+		{/* read atr */
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = 1,
+			.buf = &atr
+		},
 	};
 
 	/* read atr register */
@@ -381,8 +417,17 @@ static int x1205_validate_client(struct i2c_client *client)
 		unsigned char addr[2] = { 0, probe_zero_pattern[i] };
 
 		struct i2c_msg msgs[2] = {
-			{ client->addr, 0, 2, addr },
-			{ client->addr, I2C_M_RD, 1, &buf },
+			{
+				.addr = client->addr,
+				.len = 2,
+				.buf = addr
+			},
+			{
+				.addr = client->addr,
+				.flags = I2C_M_RD,
+				.len = 1,
+				.buf = &buf
+			},
 		};
 
 		if ((xfer = i2c_transfer(client->adapter, msgs, 2)) != 2) {
@@ -409,8 +454,17 @@ static int x1205_validate_client(struct i2c_client *client)
 		unsigned char addr[2] = { 0, probe_limits_pattern[i].reg };
 
 		struct i2c_msg msgs[2] = {
-			{ client->addr, 0, 2, addr },
-			{ client->addr, I2C_M_RD, 1, &reg },
+			{
+				.addr = client->addr,
+				.len = 2,
+				.buf = addr
+			},
+			{
+				.addr = client->addr,
+				.flags = I2C_M_RD,
+				.len = 1,
+				.buf = &reg
+			},
 		};
 
 		if ((xfer = i2c_transfer(client->adapter, msgs, 2)) != 2) {
@@ -444,8 +498,18 @@ static int x1205_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 	static unsigned char int_addr[2] = { 0, X1205_REG_INT };
 	struct i2c_client *client = to_i2c_client(dev);
 	struct i2c_msg msgs[] = {
-		{ client->addr, 0, 2, int_addr },        /* setup read ptr */
-		{ client->addr, I2C_M_RD, 1, &intreg },  /* read INT register */
+		{ /* setup read ptr */
+			.addr = client->addr,
+			.len = 2,
+			.buf = int_addr
+		},
+		{/* read INT register */
+
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = 1,
+			.buf = &intreg
+		},
 	};
 
 	/* read interrupt register and status register */
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCHv2 3/7] rtc: Convert struct i2c_msg initialization to C99 format
  2012-09-25 10:33 [PATCHv2 0/7] rtc: convert to c99 format Shubhrajyoti D
  2012-09-25 10:33 ` [PATCHv2 1/7] rtc: Convert struct i2c_msg initialization to C99 format Shubhrajyoti D
  2012-09-25 10:33 ` [PATCHv2 2/7] " Shubhrajyoti D
@ 2012-09-25 10:33 ` Shubhrajyoti D
  2012-09-25 10:33 ` [PATCHv2 4/7] " Shubhrajyoti D
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti D @ 2012-09-25 10:33 UTC (permalink / raw)
  To: rtc-linux; +Cc: linux-kernel, akpm, a.zummo, 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/rtc/rtc-s35390a.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index c9562ce..cc5c516 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -50,7 +50,11 @@ static int s35390a_set_reg(struct s35390a *s35390a, int reg, char *buf, int len)
 {
 	struct i2c_client *client = s35390a->client[reg];
 	struct i2c_msg msg[] = {
-		{ client->addr, 0, len, buf },
+		{
+			.addr = client->addr,
+			.len = len,
+			.buf = buf
+		},
 	};
 
 	if ((i2c_transfer(client->adapter, msg, 1)) != 1)
@@ -63,7 +67,12 @@ static int s35390a_get_reg(struct s35390a *s35390a, int reg, char *buf, int len)
 {
 	struct i2c_client *client = s35390a->client[reg];
 	struct i2c_msg msg[] = {
-		{ client->addr, I2C_M_RD, len, buf },
+		{
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = len,
+			.buf = buf
+		},
 	};
 
 	if ((i2c_transfer(client->adapter, msg, 1)) != 1)
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCHv2 4/7] rtc: Convert struct i2c_msg initialization to C99 format
  2012-09-25 10:33 [PATCHv2 0/7] rtc: convert to c99 format Shubhrajyoti D
                   ` (2 preceding siblings ...)
  2012-09-25 10:33 ` [PATCHv2 3/7] " Shubhrajyoti D
@ 2012-09-25 10:33 ` Shubhrajyoti D
  2012-09-25 10:33 ` [PATCHv2 5/7] " Shubhrajyoti D
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti D @ 2012-09-25 10:33 UTC (permalink / raw)
  To: rtc-linux; +Cc: linux-kernel, akpm, a.zummo, 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.
while at it also fix a checkpatch warn
WARNING: sizeof rs5c->buf should be sizeof(rs5c->buf)

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 drivers/rtc/rtc-rs5c372.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index fb4842c..76f565a 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -104,7 +104,12 @@ static int rs5c_get_regs(struct rs5c372 *rs5c)
 {
 	struct i2c_client	*client = rs5c->client;
 	struct i2c_msg		msgs[] = {
-		{ client->addr, I2C_M_RD, sizeof rs5c->buf, rs5c->buf },
+		{
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = sizeof(rs5c->buf),
+			.buf = rs5c->buf
+		},
 	};
 
 	/* This implements the third reading method from the datasheet, using
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCHv2 5/7] rtc: Convert struct i2c_msg initialization to C99 format
  2012-09-25 10:33 [PATCHv2 0/7] rtc: convert to c99 format Shubhrajyoti D
                   ` (3 preceding siblings ...)
  2012-09-25 10:33 ` [PATCHv2 4/7] " Shubhrajyoti D
@ 2012-09-25 10:33 ` Shubhrajyoti D
  2012-09-25 10:33 ` [PATCHv2 6/7] " Shubhrajyoti D
  2012-09-25 10:33 ` [PATCHv2 7/7] " Shubhrajyoti D
  6 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti D @ 2012-09-25 10:33 UTC (permalink / raw)
  To: rtc-linux; +Cc: linux-kernel, akpm, a.zummo, 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/rtc/rtc-pcf8563.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index c2fe426..98e3a2b 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -78,8 +78,17 @@ static int pcf8563_get_datetime(struct i2c_client *client, struct rtc_time *tm)
 	unsigned char buf[13] = { PCF8563_REG_ST1 };
 
 	struct i2c_msg msgs[] = {
-		{ client->addr, 0, 1, buf },	/* setup read ptr */
-		{ client->addr, I2C_M_RD, 13, buf },	/* read status + date */
+		{/* setup read ptr */
+			.addr = client->addr,
+			.len = 1,
+			.buf = buf
+		},
+		{/* read status + date */
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = 13,
+			.buf = buf
+		},
 	};
 
 	/* read registers */
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCHv2 6/7] rtc: Convert struct i2c_msg initialization to C99 format
  2012-09-25 10:33 [PATCHv2 0/7] rtc: convert to c99 format Shubhrajyoti D
                   ` (4 preceding siblings ...)
  2012-09-25 10:33 ` [PATCHv2 5/7] " Shubhrajyoti D
@ 2012-09-25 10:33 ` Shubhrajyoti D
  2012-09-25 10:33 ` [PATCHv2 7/7] " Shubhrajyoti D
  6 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti D @ 2012-09-25 10:33 UTC (permalink / raw)
  To: rtc-linux; +Cc: linux-kernel, akpm, a.zummo, 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/rtc/rtc-isl1208.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index 0ea86ac..26c81f2 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -68,9 +68,17 @@ isl1208_i2c_read_regs(struct i2c_client *client, u8 reg, u8 buf[],
 {
 	u8 reg_addr[1] = { reg };
 	struct i2c_msg msgs[2] = {
-		{client->addr, 0, sizeof(reg_addr), reg_addr}
-		,
-		{client->addr, I2C_M_RD, len, buf}
+		{
+			.addr = client->addr,
+			.len = sizeof(reg_addr),
+			.buf = reg_addr
+		},
+		{
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = len,
+			.buf = buf
+		}
 	};
 	int ret;
 
@@ -90,7 +98,11 @@ isl1208_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[],
 {
 	u8 i2c_buf[ISL1208_REG_USR2 + 2];
 	struct i2c_msg msgs[1] = {
-		{client->addr, 0, len + 1, i2c_buf}
+		{
+			.addr = client->addr,
+			.len = len + 1,
+			.buf = i2c_buf
+		}
 	};
 	int ret;
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCHv2 7/7] rtc: Convert struct i2c_msg initialization to C99 format
  2012-09-25 10:33 [PATCHv2 0/7] rtc: convert to c99 format Shubhrajyoti D
                   ` (5 preceding siblings ...)
  2012-09-25 10:33 ` [PATCHv2 6/7] " Shubhrajyoti D
@ 2012-09-25 10:33 ` Shubhrajyoti D
  6 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti D @ 2012-09-25 10:33 UTC (permalink / raw)
  To: rtc-linux; +Cc: linux-kernel, akpm, a.zummo, 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/rtc/rtc-em3027.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-em3027.c b/drivers/rtc/rtc-em3027.c
index 0104ea7..f6c24ce 100644
--- a/drivers/rtc/rtc-em3027.c
+++ b/drivers/rtc/rtc-em3027.c
@@ -49,8 +49,17 @@ static int em3027_get_time(struct device *dev, struct rtc_time *tm)
 	unsigned char buf[7];
 
 	struct i2c_msg msgs[] = {
-		{client->addr, 0, 1, &addr},		/* setup read addr */
-		{client->addr, I2C_M_RD, 7, buf},	/* read time/date */
+		{/* setup read addr */
+			.addr = client->addr,
+			.len = 1,
+			.buf = &addr
+		},
+		{/* read time/date */
+			.addr = client->addr,
+			.flags = I2C_M_RD,
+			.len = 7,
+			.buf = buf
+		},
 	};
 
 	/* read time/date registers */
@@ -76,7 +85,9 @@ static int em3027_set_time(struct device *dev, struct rtc_time *tm)
 	unsigned char buf[8];
 
 	struct i2c_msg msg = {
-		client->addr, 0, 8, buf,	/* write time/date */
+		.addr = client->addr,
+		.len = 8,
+		.buf = buf,	/* write time/date */
 	};
 
 	buf[0] = EM3027_REG_WATCH_SEC;
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCHv2 1/7] rtc: Convert struct i2c_msg initialization to C99 format
  2012-09-25 10:33 ` [PATCHv2 1/7] rtc: Convert struct i2c_msg initialization to C99 format Shubhrajyoti D
@ 2012-09-25 10:55   ` Felipe Balbi
  2012-09-25 11:19     ` Shubhrajyoti
  0 siblings, 1 reply; 11+ messages in thread
From: Felipe Balbi @ 2012-09-25 10:55 UTC (permalink / raw)
  To: Shubhrajyoti D; +Cc: rtc-linux, linux-kernel, akpm, a.zummo

[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]

On Tue, Sep 25, 2012 at 04:03:38PM +0530, Shubhrajyoti D wrote:
> 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/rtc/rtc-ds1672.c |   26 ++++++++++++++++++++++----
>  1 files changed, 22 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c
> index 7fa67d0..577dbae 100644
> --- a/drivers/rtc/rtc-ds1672.c
> +++ b/drivers/rtc/rtc-ds1672.c
> @@ -37,8 +37,17 @@ static int ds1672_get_datetime(struct i2c_client *client, struct rtc_time *tm)
>  	unsigned char buf[4];
>  
>  	struct i2c_msg msgs[] = {
> -		{client->addr, 0, 1, &addr},	/* setup read ptr */
> -		{client->addr, I2C_M_RD, 4, buf},	/* read date */
> +		{/* setup read ptr */
> +			.addr = client->addr,
> +			.len = 1,
> +			.buf = &addr
> +		},
> +		{/* setup read ptr */

should this comment be /* read date */ ??

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCHv2 1/7] rtc: Convert struct i2c_msg initialization to C99 format
  2012-09-25 10:55   ` Felipe Balbi
@ 2012-09-25 11:19     ` Shubhrajyoti
  0 siblings, 0 replies; 11+ messages in thread
From: Shubhrajyoti @ 2012-09-25 11:19 UTC (permalink / raw)
  To: balbi; +Cc: rtc-linux, linux-kernel, akpm, a.zummo

On Tuesday 25 September 2012 04:25 PM, Felipe Balbi wrote:
>> +			.buf = &addr
>> > +		},
>> > +		{/* setup read ptr */
> should this comment be /* read date */ ??
yes missed that . will update

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-09-25 11:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-25 10:33 [PATCHv2 0/7] rtc: convert to c99 format Shubhrajyoti D
2012-09-25 10:33 ` [PATCHv2 1/7] rtc: Convert struct i2c_msg initialization to C99 format Shubhrajyoti D
2012-09-25 10:55   ` Felipe Balbi
2012-09-25 11:19     ` Shubhrajyoti
2012-09-25 10:33 ` [PATCHv2 2/7] " Shubhrajyoti D
2012-09-25 10:33 ` [PATCHv2 3/7] " Shubhrajyoti D
2012-09-25 10:33 ` [PATCHv2 4/7] " Shubhrajyoti D
2012-09-25 10:33 ` [PATCHv2 5/7] " Shubhrajyoti D
2012-09-25 10:33 ` [PATCHv2 6/7] " Shubhrajyoti D
2012-09-25 10:33 ` [PATCHv2 7/7] " Shubhrajyoti D
  -- strict thread matches above, loose matches on Subject: below --
2012-09-24  9:47 [PATCHv2 0/7] rtc: convert to c99 format Shubhrajyoti D
2012-09-24  9:47 ` [PATCHv2 1/7] rtc: Convert struct i2c_msg initialization to C99 format 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).