From: Shubhrajyoti D <shubhrajyoti@ti.com>
To: <linux-media@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <julia.lawall@lip6.fr>,
Shubhrajyoti D <shubhrajyoti@ti.com>
Subject: [PATCHv2 4/6] media: Convert struct i2c_msg initialization to C99 format
Date: Tue, 18 Sep 2012 15:20:41 +0530 [thread overview]
Message-ID: <1347961843-9376-5-git-send-email-shubhrajyoti@ti.com> (raw)
In-Reply-To: <1347961843-9376-1-git-send-email-shubhrajyoti@ti.com>
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/media/radio/si470x/radio-si470x-i2c.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c
index f867f04..be2efb9 100644
--- a/drivers/media/radio/si470x/radio-si470x-i2c.c
+++ b/drivers/media/radio/si470x/radio-si470x-i2c.c
@@ -98,8 +98,12 @@ int si470x_get_register(struct si470x_device *radio, int regnr)
{
u16 buf[READ_REG_NUM];
struct i2c_msg msgs[1] = {
- { radio->client->addr, I2C_M_RD, sizeof(u16) * READ_REG_NUM,
- (void *)buf },
+ {
+ .addr = radio->client->addr,
+ .flags = I2C_M_RD,
+ .len = sizeof(u16) * READ_REG_NUM,
+ .buf = (void *)buf
+ },
};
if (i2c_transfer(radio->client->adapter, msgs, 1) != 1)
@@ -119,8 +123,12 @@ int si470x_set_register(struct si470x_device *radio, int regnr)
int i;
u16 buf[WRITE_REG_NUM];
struct i2c_msg msgs[1] = {
- { radio->client->addr, 0, sizeof(u16) * WRITE_REG_NUM,
- (void *)buf },
+ {
+ .addr = radio->client->addr,
+ .flags = 0,
+ .len = sizeof(u16) * WRITE_REG_NUM,
+ .buf = (void *)buf
+ },
};
for (i = 0; i < WRITE_REG_NUM; i++)
@@ -146,8 +154,12 @@ static int si470x_get_all_registers(struct si470x_device *radio)
int i;
u16 buf[READ_REG_NUM];
struct i2c_msg msgs[1] = {
- { radio->client->addr, I2C_M_RD, sizeof(u16) * READ_REG_NUM,
- (void *)buf },
+ {
+ .addr = radio->client->addr,
+ .flags = I2C_M_RD,
+ .len = sizeof(u16) * READ_REG_NUM,
+ .buf = (void *)buf
+ },
};
if (i2c_transfer(radio->client->adapter, msgs, 1) != 1)
--
1.7.5.4
next prev parent reply other threads:[~2012-09-18 9:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-18 9:50 [PATCHv2 0/6] media: convert to c99 format Shubhrajyoti D
2012-09-18 9:50 ` [PATCHv2 1/6] media: Convert struct i2c_msg initialization to C99 format Shubhrajyoti D
2012-09-18 9:50 ` [PATCHv2 2/6] " Shubhrajyoti D
2012-09-18 9:50 ` [PATCHv2 3/6] " Shubhrajyoti D
2012-09-18 9:50 ` Shubhrajyoti D [this message]
2012-09-18 9:50 ` [PATCHv2 5/6] " Shubhrajyoti D
2012-09-18 9:50 ` [PATCHv2 6/6] " Shubhrajyoti D
2012-09-18 9:56 ` Venu Byravarasu
2012-09-18 10:00 ` Shubhrajyoti Datta
2012-09-18 10:02 ` Venu Byravarasu
2012-09-18 20:09 ` Cody P Schafer
2012-09-18 10:00 ` [PATCHv2 0/6] media: convert to c99 format Hans Verkuil
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=1347961843-9376-5-git-send-email-shubhrajyoti@ti.com \
--to=shubhrajyoti@ti.com \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
/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).