* [PATCH] i2c-cpm: Detect and report NAK right away instead of timing out.
@ 2008-11-01 0:29 Mike Ditto
[not found] ` <490BA2E5.8010309-Vjf7OWgA3BLqlBn2x/YWAg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Mike Ditto @ 2008-11-01 0:29 UTC (permalink / raw)
To: Jochen Friedrich, linuxppc-dev-mnsaURCQ41sdnm+yROfE0A,
linux-i2c-u79uwXL29TY76Z2rM5mHXA
Make the driver report an ENXIO error immediately upon NAK instead of
waiting for another interrupt and getting a timeout.
Signed-off-by: Mike Ditto <mditto-Vjf7OWgA3BLqlBn2x/YWAg@public.gmane.org>
---
When reading from a device that is not present or declines to respond
to, e.g., a non-existent register address, CPM immediately reports a
NAK condition in the TxBD, but the driver kept waiting until a timeout,
which takes 1 second and causes an ugly console error message.
Index: linux/drivers/i2c/busses/i2c-cpm.c
===================================================================
retrieving revision 1.3
diff -u -p -r1.3 i2c-cpm.c
--- linux/drivers/i2c/busses/i2c-cpm.c 31 Oct 2008 06:36:08 -0000 1.3
+++ linux/drivers/i2c/busses/i2c-cpm.c 1 Nov 2008 00:12:45 -0000
@@ -369,6 +369,7 @@ static int cpm_i2c_xfer(struct i2c_adapt
pmsg = &msgs[tptr];
if (pmsg->flags & I2C_M_RD)
ret = wait_event_interruptible_timeout(cpm->i2c_wait,
+ (in_be16(&tbdf[tptr].cbd_sc) & BD_SC_NAK) ||
!(in_be16(&rbdf[rptr].cbd_sc) & BD_SC_EMPTY),
1 * HZ);
else
^ permalink raw reply [flat|nested] 4+ messages in thread[parent not found: <490BA2E5.8010309-Vjf7OWgA3BLqlBn2x/YWAg@public.gmane.org>]
* Re: [PATCH] i2c-cpm: Detect and report NAK right away instead of timing out. [not found] ` <490BA2E5.8010309-Vjf7OWgA3BLqlBn2x/YWAg@public.gmane.org> @ 2008-11-03 0:23 ` Ben Dooks [not found] ` <20081103002328.GC30438-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Ben Dooks @ 2008-11-03 0:23 UTC (permalink / raw) To: Mike Ditto Cc: Jochen Friedrich, linuxppc-dev-mnsaURCQ41sdnm+yROfE0A, linux-i2c-u79uwXL29TY76Z2rM5mHXA On Fri, Oct 31, 2008 at 05:29:25PM -0700, Mike Ditto wrote: > Make the driver report an ENXIO error immediately upon NAK instead of > waiting for another interrupt and getting a timeout. > > Signed-off-by: Mike Ditto <mditto-Vjf7OWgA3BLqlBn2x/YWAg@public.gmane.org> > --- > When reading from a device that is not present or declines to respond > to, e.g., a non-existent register address, CPM immediately reports a > NAK condition in the TxBD, but the driver kept waiting until a timeout, > which takes 1 second and causes an ugly console error message. hmm, that block of text could probably go into the patch description. It looks ok, I'll merge and push out to linus with the s3c fixes. > Index: linux/drivers/i2c/busses/i2c-cpm.c > =================================================================== > retrieving revision 1.3 > diff -u -p -r1.3 i2c-cpm.c > --- linux/drivers/i2c/busses/i2c-cpm.c 31 Oct 2008 06:36:08 -0000 1.3 > +++ linux/drivers/i2c/busses/i2c-cpm.c 1 Nov 2008 00:12:45 -0000 > @@ -369,6 +369,7 @@ static int cpm_i2c_xfer(struct i2c_adapt > pmsg = &msgs[tptr]; > if (pmsg->flags & I2C_M_RD) > ret = wait_event_interruptible_timeout(cpm->i2c_wait, > + (in_be16(&tbdf[tptr].cbd_sc) & BD_SC_NAK) || > !(in_be16(&rbdf[rptr].cbd_sc) & BD_SC_EMPTY), > 1 * HZ); > else > -- > To unsubscribe from this list: send the line "unsubscribe linux-i2c" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Ben (ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/) 'a smiley only costs 4 bytes' ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <20081103002328.GC30438-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>]
* Re: [PATCH] i2c-cpm: Detect and report NAK right away instead of timing out. [not found] ` <20081103002328.GC30438-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org> @ 2008-11-03 3:50 ` Mike Ditto 2008-11-03 11:44 ` Jochen Friedrich 1 sibling, 0 replies; 4+ messages in thread From: Mike Ditto @ 2008-11-03 3:50 UTC (permalink / raw) To: Ben Dooks Cc: Jochen Friedrich, linuxppc-dev-mnsaURCQ41sdnm+yROfE0A, linux-i2c-u79uwXL29TY76Z2rM5mHXA Ben Dooks wrote: >> When reading from a device that is not present or declines to respond >> to, e.g., a non-existent register address, CPM immediately reports a >> NAK condition in the TxBD, but the driver kept waiting until a timeout, >> which takes 1 second and causes an ugly console error message. > > hmm, that block of text could probably go into the patch description. It's certainly fine with me if you want to include it. I was just trying, perhaps inappropriately, to separate the "bug report" from the "description of the change". -=] Mike [=- ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c-cpm: Detect and report NAK right away instead of timing out. [not found] ` <20081103002328.GC30438-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org> 2008-11-03 3:50 ` Mike Ditto @ 2008-11-03 11:44 ` Jochen Friedrich 1 sibling, 0 replies; 4+ messages in thread From: Jochen Friedrich @ 2008-11-03 11:44 UTC (permalink / raw) To: Ben Dooks Cc: Mike Ditto, linuxppc-dev-mnsaURCQ41sdnm+yROfE0A, linux-i2c-u79uwXL29TY76Z2rM5mHXA Hi Ben, > On Fri, Oct 31, 2008 at 05:29:25PM -0700, Mike Ditto wrote: >> Make the driver report an ENXIO error immediately upon NAK instead of >> waiting for another interrupt and getting a timeout. >> >> Signed-off-by: Mike Ditto <mditto-Vjf7OWgA3BLqlBn2x/YWAg@public.gmane.org> Acked-by: Jochen Friedrich <jochen-NIgtFMG+Po8@public.gmane.org> > It looks ok, I'll merge and push out to linus with the s3c fixes. Thanks! Jochen ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-11-03 11:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-01 0:29 [PATCH] i2c-cpm: Detect and report NAK right away instead of timing out Mike Ditto
[not found] ` <490BA2E5.8010309-Vjf7OWgA3BLqlBn2x/YWAg@public.gmane.org>
2008-11-03 0:23 ` Ben Dooks
[not found] ` <20081103002328.GC30438-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
2008-11-03 3:50 ` Mike Ditto
2008-11-03 11:44 ` Jochen Friedrich
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox