Skip to contentSkip to conversation

atp870u: Split long udelay()

PATCH In review Ben Hutchings 2 participants 4 messages Feb 19, 2010 – Feb 27, 2010 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atp870u: Split long udelay()

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.)

---
 drivers/scsi/atp870u.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/scsi/atp870u.c +2 -1
index b137e56..bf0ecda 100644
@@ -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);
Signature · 1 line
1.6.6.2
#1 lore raw
Quoted 4 lines · Ben Hutchings

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

#2 lore raw
Quoted 6 lines · James Bottomley
Quoted 4 lines · Ben Hutchings

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.)

Quoted 6 lines

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.

Signature · 2 lines
Ben Hutchings
The two most common things in the universe are hydrogen and stupidity.
#3 lore raw
Quoted 11 lines · Ben Hutchings
Quoted 10 lines · James Bottomley
Quoted 4 lines · Ben Hutchings

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.

Quoted 6 lines
Quoted 2 lines

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.

Signature · 3 lines
Ben Hutchings
Horngren's Observation:
                   Among economists, the real world is often a special case.