From: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
To: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
Subject: Re: [patch 2.6.25-git] i2c_adapters: return -Errno not -1
Date: Wed, 14 May 2008 07:48:36 -0700 [thread overview]
Message-ID: <200805140748.36400.david-b@pacbell.net> (raw)
In-Reply-To: <20080514141738.327be680-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
On Wednesday 14 May 2008, Jean Delvare wrote:
> Hi David,
>
> On Mon, 12 May 2008 09:48:23 -0700, David Brownell wrote:
> > On Saturday 10 May 2008, Jean Delvare wrote:
> > > ... list your error value choices for the common
> > > error conditions of I2C and SMBus controllers ...
> >
> > Here's a patch adding such information ... against 2.6.26-rc2 and
> > in synch with both the "-Errno not -1" patches I've sent.
>
> Thanks for doing this. This document will be very helpful both for me
> when reviewing your patches, and for both I2C bus and I2C device driver
> authors later.
Exactly. ;)
I addressed your comments; no further responses except as below.
> > +EBADMSG
> > + Returned by SMBus logic when an invalid Packet Error Code byte
> > + is received. This code is a CRC covering all bytes in the
> > + transaction, and is sent before the terminating STOP. This
> > + fault is only reported on read transactions; the SMBus slave
> > + may have a way to report PEC mismatches on writes from the
> > + host. Note that even if PECs are in use, you should not rely
> > + on these as the only way to detect incorrect data transfers.
>
> As far as I can see, only the i2c-core is returning this error when
> SMBus is emulated over I2C, SMBus master drivers do not?
I didn't check hardware specs or driver details for the three
adapters currently reporting I2C_FUNC_SMBUS_PEC: amd8111, i801,
and nforce2. So I don't know what they report ...
> If it is a
> hardware limitation of most SMBus controllers then I wonder if it is
> worth having a separate error code just for i2c-core.
As a rule, it's important to know that an error is "soft" (like
PEC corruption) or not ... soft errors are very amenable to retries.
So even if those SMBus controllers have braindead designs which
don't let drivers know if the failure was from PEC, I'd think that
it's worth having such a code. After all, it's not like there's
anything *preventing* sane nardware. (Right?!?)
> > +EOPNOTSUPP
> > + Returned by an adapter when asked to perform an operation
> > + that it doesn't, or can't, support. For example, if an
> > + adapter doesn't support SMBus block transfers, this would
> > + be returned when it is asked to issue one. Or if an I2C
> > + adapter can't execute all legal I2C messages, it should
> > + return this in some cases.
>
> It might be worth mentioning here that I2C device drivers are supposed
> to check the adapter functionality before they run any transaction.
Done.
> So,
> in most cases, I2C bus drivers would be in their own right to return
> -EINVAL when requested to perform operations they don't support.
I'll disagree. The request was valid, and the only thing that
was inappropriate was sending it to *this* adapter. Whether a
request is valid (or not) should be minimally context-sensitive.
It's an error to make a given valid request to certain adapters;
sure. But the *reason* is that the adapter doesn't support such
calls ... not that the request itself is invalid.
> As far as I remember, clock stretching by a slave during the
> address byte is not even allowed.
It's allowed anywhere. Remember that one of the reasons to stretch
is to make sure the device has enough time to react ... and also
that multi-master configurations will effectively need to arbitrate
the clock signal (looks just like clock stretching), not just the
data signal.
> So, there is no need to mention ENXIO and the address byte here.
Right, I realized that but it was time to send for review rather
than make more edits. ;)
Updated patch in a separate message.
- Dave
_______________________________________________
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-14 14:48 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-02 3:46 [patch 2.6.25-git] i2c_adapters: return -Errno not -1 David Brownell
[not found] ` <200805012046.07885.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-05-10 18:18 ` Jean Delvare
[not found] ` <20080510201825.489198d2-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-05-11 7:32 ` David Brownell
2008-05-12 16:48 ` David Brownell
[not found] ` <200805120948.23842.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-05-14 12:17 ` Jean Delvare
[not found] ` <20080514141738.327be680-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-05-14 14:48 ` David Brownell [this message]
2008-05-14 14:50 ` David Brownell
[not found] ` <200805140750.49365.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-05-15 18:33 ` Jean Delvare
2008-05-10 20:55 ` Jean Delvare
[not found] ` <20080510225548.36297637-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-05-11 8:17 ` David Brownell
[not found] ` <200805110117.23023.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-05-11 10:26 ` Jean Delvare
[not found] ` <20080511122647.1e04c9c0-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-05-11 16:23 ` David Brownell
[not found] ` <200805110923.44693.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-05-12 14:05 ` Jean Delvare
[not found] ` <20080512160537.13e7739a-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-05-12 16:44 ` David Brownell
2008-05-11 17:13 ` David Brownell
[not found] ` <200805111013.25440.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-05-12 13:05 ` Jean Delvare
[not found] ` <20080512150512.1837e3e7-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-05-12 16:25 ` David Brownell
[not found] ` <200805120925.33533.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-05-12 16:54 ` Jean Delvare
[not found] ` <20080512185439.1a9cf3c1-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-05-12 17:08 ` David Brownell
2008-05-11 17:16 ` David Brownell
2008-05-12 16:43 ` David Brownell
[not found] ` <200805120943.04899.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-05-15 17:16 ` Jean Delvare
[not found] ` <20080515191631.7791346c-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-05-18 0:54 ` David Brownell
[not found] ` <200805171754.15976.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-05-18 7:06 ` Jean Delvare
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=200805140748.36400.david-b@pacbell.net \
--to=david-b-ybekhbn/0ldr7s880joybq@public.gmane.org \
--cc=i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
--cc=khali-PUYAD+kWke1g9hUCZPvPmw@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox