From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org>
Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
mail-ZlhrYzitvtWsTnJN9+BGXg@public.gmane.org,
tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.org,
tpmdd-iBygD9l97zzQT0dZR+AlfA@public.gmane.org,
key-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] char/tpm: Convert struct i2c_msg initialization to C99 format
Date: Wed, 10 Oct 2012 11:06:38 +0200 [thread overview]
Message-ID: <20121010110638.498f0a50@endymion.delvare> (raw)
In-Reply-To: <1349782951-9175-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
On Tue, 9 Oct 2012 17:12:31 +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/char/tpm/tpm_i2c_infineon.c | 21 ++++++++++++++++++---
> 1 files changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c
> index 5a831ae..01b07c7 100644
> --- a/drivers/char/tpm/tpm_i2c_infineon.c
> +++ b/drivers/char/tpm/tpm_i2c_infineon.c
> @@ -90,8 +90,18 @@ static struct i2c_driver tpm_tis_i2c_driver;
> static int iic_tpm_read(u8 addr, u8 *buffer, size_t len)
> {
>
> - struct i2c_msg msg1 = { tpm_dev.client->addr, 0, 1, &addr };
> - struct i2c_msg msg2 = { tpm_dev.client->addr, I2C_M_RD, len, buffer };
> + struct i2c_msg msg1 = {
> + .addr = tpm_dev.client->addr,
> + .flags = 0,
As said before, you can omit zero fields.
> + .len = 1,
> + .buf = &addr
> + };
> + struct i2c_msg msg2 = {
> + .addr = tpm_dev.client->addr,
> + .flags = I2C_M_RD,
> + .len = len,
> + .buf = buffer
> + };
>
> int rc;
> int count;
> @@ -138,7 +148,12 @@ static int iic_tpm_write_generic(u8 addr, u8 *buffer, size_t len,
> int rc = -EIO;
> int count;
>
> - struct i2c_msg msg1 = { tpm_dev.client->addr, 0, len + 1, tpm_dev.buf };
> + struct i2c_msg msg1 = {
> + .addr = tpm_dev.client->addr,
> + .flags = 0,
> + .len = len + 1,
> + .buf = tpm_dev.buf
> + };
>
> if (len > TPM_BUFSIZE)
> return -EINVAL;
Acked-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
--
Jean Delvare
next prev parent reply other threads:[~2012-10-10 9:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-09 11:42 [PATCH] char/tpm: Convert struct i2c_msg initialization to C99 format Shubhrajyoti D
[not found] ` <1349782951-9175-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2012-10-09 16:07 ` [tpmdd-devel] " Peter.Huewe-d0qZbvYSIPpWk0Htik3J/w
[not found] ` <74A44E99E3274B4CB570415926B37D440EC6CD-KSUqXBOclpKBCnxIfz/NYa7q7RIIQec8@public.gmane.org>
2012-10-09 16:32 ` Jean Delvare
[not found] ` <20121009183208.56716682-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-10-09 16:59 ` Peter.Huewe-d0qZbvYSIPpWk0Htik3J/w
2012-10-10 9:06 ` Jean Delvare [this message]
[not found] ` <20121010110638.498f0a50-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-10-10 11:31 ` Shubhrajyoti Datta
[not found] ` <CAM=Q2cv2-85S7NoVEpcuCohQs=CFxKcyVdm62g4d5q7pJzcpXg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-10-10 14:15 ` [tpmdd-devel] " Peter.Huewe-d0qZbvYSIPpWk0Htik3J/w
2012-12-10 16:54 ` Peter.Huewe-d0qZbvYSIPpWk0Htik3J/w
[not found] ` <74A44E99E3274B4CB570415926B37D44101A60-KSUqXBOclpKBCnxIfz/NYa7q7RIIQec8@public.gmane.org>
2012-12-10 22:09 ` Jean Delvare
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=20121010110638.498f0a50@endymion.delvare \
--to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
--cc=key-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mail-ZlhrYzitvtWsTnJN9+BGXg@public.gmane.org \
--cc=shubhrajyoti-l0cyMroinI0@public.gmane.org \
--cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=tpmdd-iBygD9l97zzQT0dZR+AlfA@public.gmane.org \
--cc=tpmdd-yWjUBOtONefk1uMJSBkQmQ@public.gmane.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