Re: [PATCH] i2c: (i2c-diolan-u2c) Fix master_xfer return code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 10, 2012 at 11:28:26AM +0530, Shubhrajyoti Datta wrote:
> Hi Gunter,
> A minor suggestion below.
> 
> On Thu, Aug 9, 2012 at 9:17 PM, Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
> > The master_xfer function returns 0 on success. It should return the number of
> > successful transactions.
> >
> > Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> > ---
> >  drivers/i2c/busses/i2c-diolan-u2c.c |    1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/i2c/busses/i2c-diolan-u2c.c b/drivers/i2c/busses/i2c-diolan-u2c.c
> > index aedb94f..dae3ddf 100644
> > --- a/drivers/i2c/busses/i2c-diolan-u2c.c
> > +++ b/drivers/i2c/busses/i2c-diolan-u2c.c
> > @@ -405,6 +405,7 @@ static int diolan_usb_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,
> >                         }
> >                 }
> >         }
> > +       ret = num;
> So if all the messages get transferred this is right.
> 
> However if only a few go through should we return the number of
> successful transactions
> instead of error?
> 
Most other I2C bus drivers do the same, so I decided to not make the code
more complicated than necessary and do it the same way. Also, I prefer to have
the actual error code returned to the caller, not "I transferred x of your y
messages, but I won't tell you what went wrong with the rest".

If that prevents it from getting integrated, I'll be happy to change it. 

Thanks,
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux