All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] input: Convert struct i2c_msg initialization to C99 format
@ 2012-10-09 11:31 Shubhrajyoti D
  2012-10-09 11:31 ` [PATCH 2/4] " Shubhrajyoti D
  2012-10-10  8:59 ` [PATCH 1/4] " Jean Delvare
  0 siblings, 2 replies; 6+ messages in thread
From: Shubhrajyoti D @ 2012-10-09 11:31 UTC (permalink / raw)
  To: linux-input-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w, 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.

Thanks to Julia Lawall <julia.lawall-L2FTfq7BK8M@public.gmane.org>  for automating the conversion

Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
---
 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 c96653b..9d869e2 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,
 {
 	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;
 
-- 
1.7.5.4

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

* [PATCH 2/4] input: Convert struct i2c_msg initialization to C99 format
  2012-10-09 11:31 [PATCH 1/4] input: Convert struct i2c_msg initialization to C99 format Shubhrajyoti D
@ 2012-10-09 11:31 ` Shubhrajyoti D
       [not found]   ` <1349782278-9023-2-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
  2012-10-10  8:59 ` [PATCH 1/4] " Jean Delvare
  1 sibling, 1 reply; 6+ messages in thread
From: Shubhrajyoti D @ 2012-10-09 11:31 UTC (permalink / raw)
  To: linux-input; +Cc: linux-i2c, dmitry.torokhov, 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.

Thanks to Julia Lawall <julia.lawall@lip6.fr>  for automating the conversion

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 drivers/input/touchscreen/cy8ctmg110_ts.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c
index 464f1bf..f4cfedf 100644
--- a/drivers/input/touchscreen/cy8ctmg110_ts.c
+++ b/drivers/input/touchscreen/cy8ctmg110_ts.c
@@ -99,9 +99,19 @@ 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] 6+ messages in thread

* Re: [PATCH 1/4] input: Convert struct i2c_msg initialization to C99 format
  2012-10-09 11:31 [PATCH 1/4] input: Convert struct i2c_msg initialization to C99 format Shubhrajyoti D
  2012-10-09 11:31 ` [PATCH 2/4] " Shubhrajyoti D
@ 2012-10-10  8:59 ` Jean Delvare
  1 sibling, 0 replies; 6+ messages in thread
From: Jean Delvare @ 2012-10-10  8:59 UTC (permalink / raw)
  To: Shubhrajyoti D; +Cc: linux-input, linux-i2c, dmitry.torokhov

On Tue, 9 Oct 2012 17:01:17 +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.
> 
> Thanks to Julia Lawall <julia.lawall@lip6.fr>  for automating the conversion
> 
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
> ---
>  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 c96653b..9d869e2 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,
>  {
>  	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;
>  

Acked-by: Jean Delvare <khali@linux-fr.org>

-- 
Jean Delvare

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

* Re: [PATCH 2/4] input: Convert struct i2c_msg initialization to C99 format
       [not found]   ` <1349782278-9023-2-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
@ 2012-10-10  9:02     ` Jean Delvare
  2012-10-10 11:35       ` Shubhrajyoti Datta
  0 siblings, 1 reply; 6+ messages in thread
From: Jean Delvare @ 2012-10-10  9:02 UTC (permalink / raw)
  To: Shubhrajyoti D
  Cc: linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w

On Tue, 9 Oct 2012 17:01:18 +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.
> 
> Thanks to Julia Lawall <julia.lawall-L2FTfq7BK8M@public.gmane.org>  for automating the conversion
> 
> Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
> ---
>  drivers/input/touchscreen/cy8ctmg110_ts.c |   14 ++++++++++++--
>  1 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c
> index 464f1bf..f4cfedf 100644
> --- a/drivers/input/touchscreen/cy8ctmg110_ts.c
> +++ b/drivers/input/touchscreen/cy8ctmg110_ts.c
> @@ -99,9 +99,19 @@ 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,

You can actually omit fields with value 0, that's one of the benefits
of C99-style struct initialization.

> +			.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);

Acked-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>

-- 
Jean Delvare

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

* Re: [PATCH 2/4] input: Convert struct i2c_msg initialization to C99 format
  2012-10-10  9:02     ` Jean Delvare
@ 2012-10-10 11:35       ` Shubhrajyoti Datta
       [not found]         ` <CAM=Q2ctFe29-Dyi+jn6s=-ybQBzXoNERSXeXCQwSCsKUAv8=XA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Shubhrajyoti Datta @ 2012-10-10 11:35 UTC (permalink / raw)
  To: Jean Delvare; +Cc: Shubhrajyoti D, linux-input, linux-i2c, dmitry.torokhov

On Wed, Oct 10, 2012 at 2:32 PM, Jean Delvare <khali@linux-fr.org> wrote:
> On Tue, 9 Oct 2012 17:01:18 +0530, Shubhrajyoti D wrote:
[...]
>
> Acked-by: Jean Delvare <khali@linux-fr.org>


thanks updated patch below
>From 6638ecfa7982f95815382922c50573712c9626d7 Mon Sep 17 00:00:00 2001
From: Shubhrajyoti D <shubhrajyoti@ti.com>
Date: Mon, 17 Sep 2012 19:37:17 +0530
Subject: [PATCHv2 1/2] input: Convert struct i2c_msg initialization to C99
 format

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

Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
 drivers/input/touchscreen/cy8ctmg110_ts.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c
b/drivers/input/touchscreen/cy8ctmg110_ts.c
index 464f1bf..ad6a664 100644
--- a/drivers/input/touchscreen/cy8ctmg110_ts.c
+++ b/drivers/input/touchscreen/cy8ctmg110_ts.c
@@ -99,9 +99,18 @@ 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,
+			.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] 6+ messages in thread

* Re: [PATCH 2/4] input: Convert struct i2c_msg initialization to C99 format
       [not found]         ` <CAM=Q2ctFe29-Dyi+jn6s=-ybQBzXoNERSXeXCQwSCsKUAv8=XA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-10-13  6:19           ` Dmitry Torokhov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2012-10-13  6:19 UTC (permalink / raw)
  To: Shubhrajyoti Datta
  Cc: Jean Delvare, Shubhrajyoti D, linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Wed, Oct 10, 2012 at 05:05:39PM +0530, Shubhrajyoti Datta wrote:
> On Wed, Oct 10, 2012 at 2:32 PM, Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org> wrote:
> > On Tue, 9 Oct 2012 17:01:18 +0530, Shubhrajyoti D wrote:
> [...]
> >
> > Acked-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> 
> 
> thanks updated patch below
> From 6638ecfa7982f95815382922c50573712c9626d7 Mon Sep 17 00:00:00 2001
> From: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
> Date: Mon, 17 Sep 2012 19:37:17 +0530
> Subject: [PATCHv2 1/2] input: Convert struct i2c_msg initialization to C99
>  format
> 
> 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-L2FTfq7BK8M@public.gmane.org>  for automating the conversion
> 
> Acked-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>

Applied both, thanks Shubhrajyoti.

> ---
>  drivers/input/touchscreen/cy8ctmg110_ts.c |   13 +++++++++++--
>  1 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c
> b/drivers/input/touchscreen/cy8ctmg110_ts.c
> index 464f1bf..ad6a664 100644
> --- a/drivers/input/touchscreen/cy8ctmg110_ts.c
> +++ b/drivers/input/touchscreen/cy8ctmg110_ts.c
> @@ -99,9 +99,18 @@ 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,
> +			.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

-- 
Dmitry

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

end of thread, other threads:[~2012-10-13  6:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-09 11:31 [PATCH 1/4] input: Convert struct i2c_msg initialization to C99 format Shubhrajyoti D
2012-10-09 11:31 ` [PATCH 2/4] " Shubhrajyoti D
     [not found]   ` <1349782278-9023-2-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2012-10-10  9:02     ` Jean Delvare
2012-10-10 11:35       ` Shubhrajyoti Datta
     [not found]         ` <CAM=Q2ctFe29-Dyi+jn6s=-ybQBzXoNERSXeXCQwSCsKUAv8=XA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-10-13  6:19           ` Dmitry Torokhov
2012-10-10  8:59 ` [PATCH 1/4] " Jean Delvare

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.