From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: vitb-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org,
htoa-hi6Y0CQ0nG0@public.gmane.org,
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org,
tmbinc-hi6Y0CQ0nG0@public.gmane.org
Subject: Re: [patch 3/3] i2c: add support for i2c bus on Freescale CPM1/CPM2 controllers
Date: Mon, 19 May 2008 18:49:07 +0200 [thread overview]
Message-ID: <20080519184907.651a4e48@hyperion.delvare> (raw)
In-Reply-To: <20080519155443.GA4279-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Hi Wolfram,
On Mon, 19 May 2008 17:54:43 +0200, Wolfram Sang wrote:
> On Wed, May 14, 2008 at 04:14:45PM -0700, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org wrote:
>
> Here is a more detailed review of this driver. After applying my fix, it
> worked fine on a MPC8260 + X24645 (EEPROM) + LM84 (Sensor) + RS5C372
> (RTC). I use this and the previous version for more than two weeks on a
> daily basis now.
Thanks for the review.
> > + /* Set up the IIC parameters in the parameter ram. */
>
> Minor nit, in most cases within the driver I2C was preferred to IIC. Is
> there a preferred way, Jean?
"I2C" is preferred.
> > + if (pmsg->flags & I2C_M_RD) {
> > + dev_dbg(&adap->dev, "tx sc 0x%04x, rx sc 0x%04x\n",
> > + in_be16(&tbdf->cbd_sc), in_be16(&rbdf->cbd_sc));
> > +
> > + if (in_be16(&tbdf->cbd_sc) & BD_SC_NAK) {
> > + dev_err(&adap->dev, "IIC read; No ack\n");
> > + return -EIO;
> > + }
> > + if (in_be16(&rbdf->cbd_sc) & BD_SC_EMPTY) {
> > + dev_err(&adap->dev,
> > + "IIC read; complete but rbuf empty\n");
> > + return -EREMOTEIO;
> > + }
> > + if (in_be16(&rbdf->cbd_sc) & BD_SC_OV) {
> > + dev_err(&adap->dev, "IIC read; Overrun\n");
> > + return -EREMOTEIO;
> > + }
> > + memcpy(pmsg->buf, rb, pmsg->len);
> > + } else {
> > + dev_dbg(&adap->dev, "tx sc %d 0x%04x\n", tx,
> > + in_be16(&tbdf->cbd_sc));
> > +
> > + if (in_be16(&tbdf->cbd_sc) & BD_SC_NAK) {
> > + dev_err(&adap->dev, "IIC write; No ack\n");
> > + return -EIO;
> > + }
> > + if (in_be16(&tbdf->cbd_sc) & BD_SC_UN) {
> > + dev_err(&adap->dev, "IIC write; Underrun\n");
> > + return -EIO;
> > + }
> > + if (in_be16(&tbdf->cbd_sc) & BD_SC_CL) {
> > + dev_err(&adap->dev, "IIC write; Collision\n");
> > + return -EIO;
> > + }
>
> The dev_err-statements are too strong, IMHO. For example, the
> at24-driver tries to write as fast as possible and may recieve a NACK,
> then it will wait a bit and retry. I wouldn't call this NACK an error
> then. I also wonder if it is worth a warning, as there is a timeout
> message later on, which will be printed as dev_dbg only. As other
> drivers I glimpsed at also don't write anything on NACK, maybe dev_dbg
> consistency would be preferable.
>
> > + }
> > + return 0;
> > +}
I agree that dev_err() on nack is too strong, most drivers log it at
dev_dbg() level. However I fail to see the relation with timeout? A
nack isn't a timeout. A timeout would be very wrong and should be
reported with dev_err() I think.
Oh, BTW, nacks should be reported with -ENXIO according to:
http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/i2c-document-standard-fault-codes.patch
It might be worth checking that this new driver complies with these
freshly adopted error codes standard.
Thanks,
--
Jean Delvare
_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
next prev parent reply other threads:[~2008-05-19 16:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-14 23:14 [patch 3/3] i2c: add support for i2c bus on Freescale CPM1/CPM2 controllers akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
[not found] ` <200805142314.m4ENEjPV026316-AB4EexQrvXRQetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
2008-05-16 8:37 ` Wolfram Sang
[not found] ` <20080516083743.GA4180-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2008-05-16 19:08 ` Jean Delvare
[not found] ` <20080516210818.26bf8cb8-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-05-16 19:27 ` Jochen Friedrich
2008-05-17 13:46 ` Wolfram Sang
2008-05-19 15:54 ` Wolfram Sang
[not found] ` <20080519155443.GA4279-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2008-05-19 16:49 ` Jean Delvare [this message]
[not found] ` <20080519184907.651a4e48-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-06-01 22:24 ` Ben Dooks
[not found] ` <20080601222428.GC6226-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
2008-06-02 7:08 ` Jean Delvare
[not found] ` <20080602090850.1b8db039-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-06-02 19:26 ` Ben Dooks
[not found] ` <20080602192630.GD6226-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
2008-06-02 19:53 ` Jean Delvare
[not found] ` <20080602215343.07ad6e02-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-06-02 21:03 ` David Brownell
[not found] ` <200806021403.46232.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-06-02 22:19 ` Ben Dooks
[not found] ` <20080602221923.GF6226-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
2008-06-03 10:06 ` Jean Delvare
[not found] ` <20080603120625.7bde7698-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-06-03 20:13 ` David Brownell
2008-06-03 20:49 ` Trent Piepho
2008-05-19 20:43 ` Jochen Friedrich
[not found] ` <4831E654.4020802-NIgtFMG+Po8@public.gmane.org>
2008-05-20 6:54 ` Wolfram Sang
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=20080519184907.651a4e48@hyperion.delvare \
--to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=htoa-hi6Y0CQ0nG0@public.gmane.org \
--cc=i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
--cc=tmbinc-hi6Y0CQ0nG0@public.gmane.org \
--cc=vitb-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
--cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.