[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120509072517.GH10514@core.coreip.homeip.net>
Date: Wed, 9 May 2012 00:25:18 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Jean Delvare <khali@...ux-fr.org>
Cc: Daniel Kurtz <djkurtz@...omium.org>,
Henrik Rydberg <rydberg@...omail.se>,
Joonyoung Shim <jy0922.shim@...sung.com>,
Nick Dyer <nick.dyer@...ev.co.uk>, linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org, Benson Leung <bleung@...omium.org>,
Yufeng Shen <miletus@...omium.org>
Subject: Re: [PATCH 03/14 v3] Input: atmel_mxt_ts - refactor
mxt_read/write_reg to take a length
On Wed, May 09, 2012 at 09:05:00AM +0200, Jean Delvare wrote:
> Hi Dmirty,
>
> On Tue, 8 May 2012 22:54:11 -0700, Dmitry Torokhov wrote:
> > Hi Daniel,
> >
> > On Wed, Apr 18, 2012 at 09:21:48PM +0800, Daniel Kurtz wrote:
> > > + ret = i2c_transfer(client->adapter, xfer, 2);
> > > + if (ret != 2) {
> > > + dev_err(&client->dev, "i2c read reg failed (%d)\n", ret);
> > > + if (ret >= 0)
> > > + ret = -EIO;
> > > }
> > >
> > > - return 0;
> > > + return (ret == 2) ? 0 : ret;
> > > }
> >
> > Would prefer:
> >
> > ret = i2c_transfer(client->adapter, xfer, ARRAY_SIZE(xfer));
> > if (ret != ARRAY_SIZE(xfer)) {
> > if (ret >= 0)
> > ret = -EIO;
> > dev_err(&client->dev, "i2c read reg failed (%d)\n", ret);
> > return ret;
> > }
> >
> > return 0;
> >
> >
> > Or maybe we need i2c_transfer_exact() wrapper? Jean?
>
> What would this function do? Return 0 on success instead of the number
> of transferred messages? And -EIO on partial transfers?
Yes, exactly.
>
> That would make sense. Partial success is a rare case anyway, and
> recovery possibilities are even rarer. I think most drivers don't
> bother and either retry the whole transaction or fail right away. In
> fact the number of messages successfully transferred is more useful to
> diagnose problems during driver development or debugging.
>
> Feel free to write and send a patch introducing i2c_transfer_exact().
> It would make sense to have it log a debug message on partial success,
> as it is a rare case. Bonus points if you also sent one or more patches
> converting (some of) the existing callers to make use of the new
> function.
OK, thanks.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists