Skip to contentSkip to conversation

scsi: fix bad use of udelay in atp870u.c

PATCH NAK [email protected] 2 participants 3 messages Oct 29, 2008 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 14/17 scsi: fix bad use of udelay in atp870u.c

From: Martin Michlmayr <[email protected]>

The ACARD driver calls udelay() with a value > 2000, which leads to to the following compilation error on ARM:
ERROR: "__bad_udelay" [drivers/scsi/atp870u.ko] undefined! make[1]: *** [__modpost] Error 1
Fix this by using a combination of mdelay and udelay.

---

 drivers/scsi/atp870u.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/atp870u.c renamed from drivers/scsi/atp870u.c~scsi-fix-bad-use-of-udelay-in-atp870uc +2 -1
diff -puN drivers/scsi/atp870u.c~scsi-fix-bad-use-of-udelay-in-atp870uc 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);

_

maintainer
#1 lore raw

drivers/scsi/atp870u.c wait_io1: · line 1175

Quoted 3 lines · On Wed, 2008-10-29 at 14:24 -0700, [email protected] wrote:
drivers/scsi/atp870u.c renamed from drivers/scsi/atp870u.c~scsi-fix-bad-use-of-udelay-in-atp870uc +2 -1
-       udelay(0x800);
+       mdelay(2);
+       udelay(48);

OK, this fix is obviously wrong ... the code holds off interrupts for two ticks that's clearly completely bogus. In this case silencing the warning is hiding the bogosity ... now if only someone could actually fix it ...

James

#2 lore raw
Quoted 10 lines · On Wed, 29 Oct 2008 16:42:15 -0500 James Bottomley…

drivers/scsi/atp870u.c wait_io1: · line 1175

Quoted 3 lines · On Wed, 2008-10-29 at 14:24 -0700, [email protected] wrote:
drivers/scsi/atp870u.c renamed from drivers/scsi/atp870u.c~scsi-fix-bad-use-of-udelay-in-atp870uc +2 -1
-       udelay(0x800);
+       mdelay(2);
+       udelay(48);

OK, this fix is obviously wrong ... the code holds off interrupts for two ticks that's clearly completely bogus. In this case silencing the warning is hiding the bogosity ... now if only someone could actually fix it ...

That'll take some heavy lifting. There's an mdelay(128) a few lines up!

I'd suggest that you merge this to fix the ARM build then hurriedly find something else to look at :(