[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <D958900912E20642BCBC71664EFECE3E6DDEFB947B@BGMAIL02.nvidia.com>
Date: Tue, 18 Sep 2012 15:26:27 +0530
From: Venu Byravarasu <vbyravarasu@...dia.com>
To: Shubhrajyoti D <shubhrajyoti@...com>,
"linux-media@...r.kernel.org" <linux-media@...r.kernel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"julia.lawall@...6.fr" <julia.lawall@...6.fr>
Subject: RE: [PATCHv2 6/6] media: Convert struct i2c_msg initialization to
C99 format
> -----Original Message-----
> From: linux-kernel-owner@...r.kernel.org [mailto:linux-kernel-
> owner@...r.kernel.org] On Behalf Of Shubhrajyoti D
> Sent: Tuesday, September 18, 2012 3:21 PM
> To: linux-media@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org; julia.lawall@...6.fr; Shubhrajyoti D
> Subject: [PATCHv2 6/6] media: 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.
>
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@...com>
> ---
> drivers/media/i2c/msp3400-driver.c | 42
> ++++++++++++++++++++++++++++++-----
> 1 files changed, 36 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/i2c/msp3400-driver.c
> b/drivers/media/i2c/msp3400-driver.c
> index aeb22be..b8cef8d 100644
> --- a/drivers/media/i2c/msp3400-driver.c
> +++ b/drivers/media/i2c/msp3400-driver.c
> @@ -119,12 +119,32 @@ int msp_reset(struct i2c_client *client)
> static u8 write[3] = { I2C_MSP_DSP + 1, 0x00, 0x1e };
> u8 read[2];
> struct i2c_msg reset[2] = {
> - { client->addr, I2C_M_IGNORE_NAK, 3, reset_off },
> - { client->addr, I2C_M_IGNORE_NAK, 3, reset_on },
> + {
> + .addr = client->addr,
> + .flags = I2C_M_IGNORE_NAK,
> + .len = 3,
> + .buf = reset_off
> + },
> + {
> + .addr = client->addr,
> + .flags = I2C_M_IGNORE_NAK,
> + .len = 3,
> + .buf = reset_on
> + },
> };
> struct i2c_msg test[2] = {
> - { client->addr, 0, 3, write },
> - { client->addr, I2C_M_RD, 2, read },
> + {
> + .addr = client->addr,
> + .flags = 0,
Does flags not contain 0 by default?
> + .len = 3,
> + .buf = write
> + },
> + {
> + .addr = client->addr,
> + .flags = I2C_M_RD,
> + .len = 2,
> + .buf = read
> + },
> };
>
> v4l_dbg(3, msp_debug, client, "msp_reset\n");
> @@ -143,8 +163,18 @@ static int msp_read(struct i2c_client *client, int dev,
> int addr)
> u8 write[3];
> u8 read[2];
> struct i2c_msg msgs[2] = {
> - { client->addr, 0, 3, write },
> - { client->addr, I2C_M_RD, 2, read }
> + {
> + .addr = client->addr,
> + .flags = 0,
> + .len = 3,
> + .buf = write
> + },
> + {
> + .addr = client->addr,
> + .flags = I2C_M_RD,
> + .len = 2,
> + .buf = read
> + }
> };
>
> write[0] = dev + 1;
> --
> 1.7.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists