public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ismael Luceno Cortes <ismael.luceno@silicon-gears.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/6] i2c: rcar_i2c: Set the slave address from rcar_i2c_xfer
Date: Tue, 5 Mar 2019 10:46:53 +0000	[thread overview]
Message-ID: <20190305104653.GG9933@kiki> (raw)
In-Reply-To: <9f9080bc-7e0a-4384-4de8-bbc23a81d649@gmail.com>

On 04/Mar/2019 20:46, Marek Vasut wrote:
> On 3/4/19 3:19 PM, Ismael Luceno Cortes wrote:
> > Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>
> > ---
> >  drivers/i2c/rcar_i2c.c | 14 +++++---------
> >  1 file changed, 5 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/i2c/rcar_i2c.c b/drivers/i2c/rcar_i2c.c
> > index b4cc0c55b1..5e04b68d95 100644
> > --- a/drivers/i2c/rcar_i2c.c
> > +++ b/drivers/i2c/rcar_i2c.c
> > @@ -144,10 +144,6 @@ static int rcar_i2c_read_common(struct udevice *dev, struct i2c_msg *msg)
> >  	u32 icmcr = RCAR_I2C_ICMCR_MDBS | RCAR_I2C_ICMCR_MIE;
> >  	int i, ret = -EREMOTEIO;
> >  
> > -	ret = rcar_i2c_set_addr(dev, msg->addr, 1);
> > -	if (ret)
> > -		return ret;
> > -
> >  	for (i = 0; i < msg->len; i++) {
> >  		if (msg->len - 1 == i)
> >  			icmcr |= RCAR_I2C_ICMCR_FSB;
> > @@ -174,10 +170,6 @@ static int rcar_i2c_write_common(struct udevice *dev, struct i2c_msg *msg)
> >  	u32 icmcr = RCAR_I2C_ICMCR_MDBS | RCAR_I2C_ICMCR_MIE;
> >  	int i, ret = -EREMOTEIO;
> >  
> > -	ret = rcar_i2c_set_addr(dev, msg->addr, 0);
> > -	if (ret)
> > -		return ret;
> > -
> >  	for (i = 0; i < msg->len; i++) {
> >  		writel(msg->buf[i], priv->base + RCAR_I2C_ICRXD_ICTXD);
> >  		writel(icmcr, priv->base + RCAR_I2C_ICMCR);
> > @@ -201,6 +193,10 @@ static int rcar_i2c_xfer(struct udevice *dev, struct i2c_msg *msg, int nmsgs)
> >  	int ret;
> >  
> >  	for (; nmsgs > 0; nmsgs--, msg++) {
> > +		ret = rcar_i2c_set_addr(dev, msg->addr, 1);
> > +		if (ret)
> > +			return -EREMOTEIO;
> 
> Shouldn't you return ret here ? It seems like you fixed similar issue in
> 4/6.

Correct. Thanks.

> >  		if (msg->flags & I2C_M_RD)
> >  			ret = rcar_i2c_read_common(dev, msg);
> >  		else
> > @@ -210,7 +206,7 @@ static int rcar_i2c_xfer(struct udevice *dev, struct i2c_msg *msg, int nmsgs)
> >  			return ret;
> >  	}
> >  
> > -	return ret;
> > +	return 0;
> 
> Is this change valid ?

Yes, ret is always checked, so it can only be 0.

  reply	other threads:[~2019-03-05 10:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04 14:19 [U-Boot] [PATCH 1/6] i2c: rcar_i2c: Fix u32 cast warnings Ismael Luceno Cortes
2019-03-04 14:19 ` [U-Boot] [PATCH 2/6] i2c: rcar_i2c: Add comments about registers & values Ismael Luceno Cortes
2019-03-04 14:19 ` [U-Boot] [PATCH 3/6] i2c: rcar_i2c: Fix sending of slave addresses Ismael Luceno Cortes
2019-03-04 14:19 ` [U-Boot] [PATCH 4/6] i2c: rcar_i2c: Don't mask errors with EREMOTEIO at rcar_i2c_xfer Ismael Luceno Cortes
2019-03-04 14:19 ` [U-Boot] [PATCH 5/6] i2c: rcar_i2c: Set the slave address from rcar_i2c_xfer Ismael Luceno Cortes
2019-03-04 19:46   ` Marek Vasut
2019-03-05 10:46     ` Ismael Luceno Cortes [this message]
2019-03-05 10:55       ` Marek Vasut
2019-03-04 14:19 ` [U-Boot] [PATCH 6/6] i2c: rcar_i2c: Move FSDA check to rcar_i2c_recover Ismael Luceno Cortes
2019-03-04 19:47   ` Marek Vasut
2019-03-05 10:03     ` Ismael Luceno Cortes
2019-03-05 10:56       ` Marek Vasut
2019-03-04 19:45 ` [U-Boot] [PATCH 1/6] i2c: rcar_i2c: Fix u32 cast warnings Marek Vasut
2019-03-05 10:23   ` Ismael Luceno Cortes
2019-03-05 10:57     ` Marek Vasut

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=20190305104653.GG9933@kiki \
    --to=ismael.luceno@silicon-gears.com \
    --cc=u-boot@lists.denx.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