Skip to contentSkip to conversation

aic7xxx: ahd_delay() fix

PATCH New [email protected] 1 participant 1 message Apr 11, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 15/15 aic7xxx: ahd_delay() fix

From: Denis Vlasenko <[email protected]>

ahd_delay() isn't delaying for as long as it should - each time around the allegedly 1024-usec loop it actually delays for something less than that, depending upon the value of the incoming arg.

---

 drivers/scsi/aic7xxx/aic79xx_osm_o.c |    6 ++++--
 drivers/scsi/aic7xxx/aic7xxx_osm_o.c |    6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/scsi/aic7xxx/aic79xx_osm_o.c renamed from drivers/scsi/aic7xxx/aic79xx_osm_o.c~aic7xxx-ahd_delay-fix +4 -2
diff -puN drivers/scsi/aic7xxx/aic79xx_osm_o.c~aic7xxx-ahd_delay-fix drivers/scsi/aic7xxx/aic79xx_osm_o.c
@@ -28,9 +28,11 @@ ahd_delay(long usec)
 	 * multi-millisecond waits.  Wait at most
 	 * 1024us per call.
 	 */
+	udelay(usec & 1023);
+	usec >>= 10;
 	while (usec > 0) {
-		udelay(usec % 1024);
-		usec -= 1024;
+		udelay(1024);
+		usec--;
 	}
 }
 
drivers/scsi/aic7xxx/aic7xxx_osm_o.c renamed from drivers/scsi/aic7xxx/aic7xxx_osm_o.c~aic7xxx-ahd_delay-fix +4 -2
diff -puN drivers/scsi/aic7xxx/aic7xxx_osm_o.c~aic7xxx-ahd_delay-fix drivers/scsi/aic7xxx/aic7xxx_osm_o.c
@@ -14,9 +14,11 @@ ahc_delay(long usec)
 	 * multi-millisecond waits.  Wait at most
 	 * 1024us per call.
 	 */
+	udelay(usec & 1023);
+	usec >>= 10;
 	while (usec > 0) {
-		udelay(usec % 1024);
-		usec -= 1024;
+		udelay(1024);
+		usec--;
 	}
 }
 

_