From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Jean Delvare <khali@linux-fr.org>,
"ben-linux@fluff.org" <ben-linux@fluff.org>,
"hsweeten@visionengravers.com" <hsweeten@visionengravers.com>,
"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] i2c/mips: Fix error return codes from Sibyte i2c bus driver
Date: Sat, 26 Jun 2010 17:14:59 +0100 (BST) [thread overview]
Message-ID: <alpine.LFD.2.00.1006261709110.14683@eddie.linux-mips.org> (raw)
In-Reply-To: <20100622115417.GA14418@ericsson.com>
On Tue, 22 Jun 2010, Guenter Roeck wrote:
> > > @@ -104,7 +104,7 @@ static int smbus_xfer(struct i2c_adapter *i2c_adap, u16 addr,
> > > if (error & M_SMB_ERROR) {
> > > /* Clear error bit by writing a 1 */
> > > csr_out32(M_SMB_ERROR, SMB_CSR(adap, R_SMB_STATUS));
> > > - return -1; /* XXXKW better error code? */
> > > + return -ENXIO;
> > > }
> > >
> > > if (data_bytes == 1)
> >
> > Definitely an improvement. However, returning -ENXIO on all errors
> > seems wrong. This error value should only be returned on missing ack
> > from the slave on address byte. Isn't it possible to distinguish
> > between different error kinds? M_SMB_ERROR_TYPE seems promising, but
> > one would need to look up the datasheet (which I don't have) to
> > discover its meaning.
> >
> Makes sense. I'll dig up a copy of the datasheet and see if I can improve it.
The M_SMB_ERROR_TYPE bit is cleared if an expected ackonwledgement has
not been seen and set if the transfer has failed after 15 retries. So
that's probably ENXIO for the former and EIO for the latter.
Maciej
next prev parent reply other threads:[~2010-06-26 16:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-20 17:57 [PATCH] i2c/mips: Fix error return codes from Sibyte i2c bus driver Guenter Roeck
[not found] ` <1277056673-4305-1-git-send-email-guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
2010-06-21 17:02 ` Jean Delvare
[not found] ` <20100621190252.2adc6bd8-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-06-22 11:54 ` Guenter Roeck
2010-06-26 16:14 ` Maciej W. Rozycki [this message]
2010-06-26 16:29 ` 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=alpine.LFD.2.00.1006261709110.14683@eddie.linux-mips.org \
--to=macro@linux-mips.org \
--cc=ben-linux@fluff.org \
--cc=guenter.roeck@ericsson.com \
--cc=hsweeten@visionengravers.com \
--cc=khali@linux-fr.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).