From: Jean Delvare <khali@linux-fr.org>
To: Shubhrajyoti D <shubhrajyoti@ti.com>
Cc: linux-input@vger.kernel.org, linux-i2c@vger.kernel.org,
dmitry.torokhov@gmail.com
Subject: Re: [PATCH 1/4] input: Convert struct i2c_msg initialization to C99 format
Date: Wed, 10 Oct 2012 10:59:16 +0200 [thread overview]
Message-ID: <20121010105916.41c78164@endymion.delvare> (raw)
In-Reply-To: <1349782278-9023-1-git-send-email-shubhrajyoti@ti.com>
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
prev parent reply other threads:[~2012-10-10 8:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Jean Delvare [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121010105916.41c78164@endymion.delvare \
--to=khali@linux-fr.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=shubhrajyoti@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).