public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] atp870u: Split long udelay()
@ 2010-02-19  1:56 Ben Hutchings
  2010-02-19 15:28 ` James Bottomley
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2010-02-19  1:56 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-scsi

udelay() is supposed to be limited to 1 ms, and will generate a
__bad_udelay() on ARM for constant arguments > 2000.  Split
udelay(0x800) into mdelay(2); udelay(48).  (I suspect that msleep(3)
would work but I do not know how critical the timing is here.)

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/scsi/atp870u.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index b137e56..bf0ecda 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -1171,7 +1171,8 @@ wait_io1:
 	outw(val, tmport);
 	outb(2, 0x80);
 TCM_SYNC:
-	udelay(0x800);
+	mdelay(2);
+	udelay(48);
 	if ((inb(tmport) & 0x80) == 0x00) {	/* bsy ? */
 		outw(0, tmport--);
 		outb(0, tmport);
-- 
1.6.6.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] atp870u: Split long udelay()
  2010-02-19  1:56 [PATCH] atp870u: Split long udelay() Ben Hutchings
@ 2010-02-19 15:28 ` James Bottomley
  2010-02-19 16:44   ` Ben Hutchings
  0 siblings, 1 reply; 4+ messages in thread
From: James Bottomley @ 2010-02-19 15:28 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: linux-scsi

On Fri, 2010-02-19 at 01:56 +0000, Ben Hutchings wrote:
> udelay() is supposed to be limited to 1 ms, and will generate a
> __bad_udelay() on ARM for constant arguments > 2000.  Split
> udelay(0x800) into mdelay(2); udelay(48).  (I suspect that msleep(3)
> would work but I do not know how critical the timing is here.)

So no to this one.  Either ARM is right and udelay > 2000 is wrong
(which actually sounds correct given how long this will eat CPU for) so
the driver needs fixing, or ARM is wrong and the warning needs fixing.

Splitting the delay to defeat the warning while retaining the behaviour
it was trying to warn about is the wrong thing to do.

James



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] atp870u: Split long udelay()
  2010-02-19 15:28 ` James Bottomley
@ 2010-02-19 16:44   ` Ben Hutchings
  2010-02-27 21:17     ` Ben Hutchings
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2010-02-19 16:44 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

On Fri, Feb 19, 2010 at 09:28:19AM -0600, James Bottomley wrote:
> On Fri, 2010-02-19 at 01:56 +0000, Ben Hutchings wrote:
> > udelay() is supposed to be limited to 1 ms, and will generate a
> > __bad_udelay() on ARM for constant arguments > 2000.  Split
> > udelay(0x800) into mdelay(2); udelay(48).  (I suspect that msleep(3)
> > would work but I do not know how critical the timing is here.)
> 
> So no to this one.  Either ARM is right and udelay > 2000 is wrong
> (which actually sounds correct given how long this will eat CPU for) so
> the driver needs fixing, or ARM is wrong and the warning needs fixing.
> 
> Splitting the delay to defeat the warning while retaining the behaviour
> it was trying to warn about is the wrong thing to do.
 
AIUI the restrictions on udelay() are there because the delay is likely
to be inaccurate for large arguments.  If it was actually wrong to wait
for over a millisecond then mdelay() would not exist.

Ben.

-- 
Ben Hutchings
The two most common things in the universe are hydrogen and stupidity.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] atp870u: Split long udelay()
  2010-02-19 16:44   ` Ben Hutchings
@ 2010-02-27 21:17     ` Ben Hutchings
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Hutchings @ 2010-02-27 21:17 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

On Fri, 2010-02-19 at 16:44 +0000, Ben Hutchings wrote:
> On Fri, Feb 19, 2010 at 09:28:19AM -0600, James Bottomley wrote:
> > On Fri, 2010-02-19 at 01:56 +0000, Ben Hutchings wrote:
> > > udelay() is supposed to be limited to 1 ms, and will generate a
> > > __bad_udelay() on ARM for constant arguments > 2000.  Split
> > > udelay(0x800) into mdelay(2); udelay(48).  (I suspect that msleep(3)
> > > would work but I do not know how critical the timing is here.)
> > 
> > So no to this one.  Either ARM is right and udelay > 2000 is wrong
> > (which actually sounds correct given how long this will eat CPU for) so
> > the driver needs fixing, or ARM is wrong and the warning needs fixing.
> > 
> > Splitting the delay to defeat the warning while retaining the behaviour
> > it was trying to warn about is the wrong thing to do.
>  
> AIUI the restrictions on udelay() are there because the delay is likely
> to be inaccurate for large arguments.  If it was actually wrong to wait
> for over a millisecond then mdelay() would not exist.

Please could you respond to the above?

Ben.

-- 
Ben Hutchings
Horngren's Observation:
                   Among economists, the real world is often a special case.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-02-27 21:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-19  1:56 [PATCH] atp870u: Split long udelay() Ben Hutchings
2010-02-19 15:28 ` James Bottomley
2010-02-19 16:44   ` Ben Hutchings
2010-02-27 21:17     ` Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox