Skip to contentSkip to conversation

scsi/sd: replace schedule_timeout() with msleep()

PATCH New [email protected] 1 participant 1 message Sep 1, 2004 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 6/7 scsi/sd: replace schedule_timeout() with msleep()

I would appreciate any comments from the janitor@sternweltens list.

Description: Use msleep() instead of schedule_timeout() to guarantee the task delays for the desired time.

---

 linux-2.6.9-rc1-bk7-max/drivers/scsi/sd.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
drivers/scsi/sd.c renamed from drivers/scsi/sd.c~msleep-drivers_scsi_sd +2 -6
diff -puN drivers/scsi/sd.c~msleep-drivers_scsi_sd drivers/scsi/sd.c
@@ -48,6 +48,7 @@
 #include <linux/blkdev.h>
 #include <linux/blkpg.h>
 #include <linux/kref.h>
+#include <linux/delay.h>
 #include <asm/uaccess.h>
 
 #include <scsi/scsi.h>
@@ -943,7 +944,6 @@ sd_spinup_disk(struct scsi_disk *sdkp, c
 		 * Issue command to spin up drive when not ready
 		 */
 		} else if (SRpnt->sr_sense_buffer[2] == NOT_READY) {
-			unsigned long time1;
 			if (!spintime) {
 				printk(KERN_NOTICE "%s: Spinning up disk...",
 				       diskname);
@@ -962,12 +962,8 @@ sd_spinup_disk(struct scsi_disk *sdkp, c
 				spintime_value = jiffies;
 			}
 			spintime = 1;
-			time1 = HZ;
 			/* Wait 1 second for next try */
-			do {
-				current->state = TASK_UNINTERRUPTIBLE;
-				time1 = schedule_timeout(time1);
-			} while(time1);
+			msleep(1000);
 			printk(".");
 		} else {
 			/* we don't understand the sense code, so it's

_