linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Shubhrajyoti D <shubhrajyoti@ti.com>
Cc: linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, ben-linux@fluff.org,
	tony@atomide.com, w.sang@pengutronix.de
Subject: Re: [RFC PATCH 3/3] i2c: inititalise the actual transferred to zero
Date: Fri, 29 Jun 2012 14:40:02 +0200	[thread overview]
Message-ID: <20120629144002.3b4a31ee@endymion.delvare> (raw)
In-Reply-To: <1340967927-27354-4-git-send-email-shubhrajyoti@ti.com>

On Fri, 29 Jun 2012 16:35:27 +0530, Shubhrajyoti D wrote:
> In i2c_smbus_xfer_emulated initialise the actual bytes
> to zero.
> 
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
> ---
>  drivers/i2c/i2c-core.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index a6ad32b..fa7f799 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -1949,8 +1949,8 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr,
>  	unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3];
>  	unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2];
>  	int num = read_write == I2C_SMBUS_READ ? 2 : 1;
> -	struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 },
> -	                          { addr, flags | I2C_M_RD, 0, msgbuf1 }
> +	struct i2c_msg msg[2] = { { addr, flags, 1, 0, msgbuf0 },
> +				  { addr, flags | I2C_M_RD, 0, 0, msgbuf1 }
>  	                        };
>  	int i;
>  	u8 partial_pec = 0;

Please convert to C99-style initialization while you're there. And this
should be done first. Initializing i2c_msg.actual maybe rather belong
to i2c_transfer though, so that all callers don't have to care.

Are you sure there are no other places that need the same fix in the
kernel tree?

-- 
Jean Delvare

  reply	other threads:[~2012-06-29 12:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-29 11:05 [RFC PATCH 0/3] I2C: Report the actual transferred bytes Shubhrajyoti D
     [not found] ` <1340967927-27354-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2012-06-29 11:05   ` [RFC PATCH 1/3] i2c: add 'actual' field to struct i2c_msg Shubhrajyoti D
     [not found]     ` <1340967927-27354-2-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>
2012-06-29 12:33       ` Jean Delvare
2012-07-02 13:27       ` Jean Delvare
2012-06-29 11:05 ` [RFC PATCH 2/3] i2c: omap: implement handling for 'actual' bytes transferred Shubhrajyoti D
2012-06-29 11:05 ` [RFC PATCH 3/3] i2c: inititalise the actual transferred to zero Shubhrajyoti D
2012-06-29 12:40   ` Jean Delvare [this message]
     [not found]     ` <20120629144002.3b4a31ee-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-06-29 12:57       ` Jean Delvare
2012-06-29 13:12         ` Shubhrajyoti
     [not found]           ` <4FEDA9A8.1050504-l0cyMroinI0@public.gmane.org>
2012-06-29 13:18             ` Jean Delvare
2012-07-02 11:54               ` Felipe Balbi
     [not found]                 ` <20120702115422.GC2730-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2012-07-02 13:20                   ` Jean Delvare
2012-07-16  8:17                     ` Felipe Balbi

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=20120629144002.3b4a31ee@endymion.delvare \
    --to=khali@linux-fr.org \
    --cc=ben-linux@fluff.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=shubhrajyoti@ti.com \
    --cc=tony@atomide.com \
    --cc=w.sang@pengutronix.de \
    /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).