From: Jeff Garzik So, the kernel needs a 'sleep', but that token is far too common, so I chose ssleep(). scsi_sleep() is a manually implemented msleep(), so I remove it. Signed-off-by: Andrew Morton --- 25-akpm/drivers/scsi/aacraid/linit.c | 3 + 25-akpm/drivers/scsi/aha1542.c | 4 +- 25-akpm/drivers/scsi/aic7xxx/aic79xx_osm.c | 7 ++-- 25-akpm/drivers/scsi/aic7xxx/aic7xxx_osm.c | 7 ++-- 25-akpm/drivers/scsi/aic7xxx_old.c | 8 ++--- 25-akpm/drivers/scsi/arm/fas216.c | 4 +- 25-akpm/drivers/scsi/scsi_error.c | 46 +++-------------------------- 25-akpm/drivers/scsi/scsi_syms.c | 2 - 25-akpm/drivers/scsi/sg.c | 5 +-- 25-akpm/drivers/scsi/sr_ioctl.c | 3 + 25-akpm/include/linux/delay.h | 5 +++ 25-akpm/include/scsi/scsi_eh.h | 1 12 files changed, 33 insertions(+), 62 deletions(-) diff -puN drivers/scsi/aacraid/linit.c~add-ssleep-kill-scsi_sleep drivers/scsi/aacraid/linit.c --- 25/drivers/scsi/aacraid/linit.c~add-ssleep-kill-scsi_sleep 2004-08-18 23:03:34.185317176 -0700 +++ 25-akpm/drivers/scsi/aacraid/linit.c 2004-08-18 23:03:34.265305016 -0700 @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -430,7 +431,7 @@ static int aac_eh_reset(struct scsi_cmnd if (active == 0) return SUCCESS; spin_unlock_irq(host->host_lock); - scsi_sleep(HZ); + ssleep(1); spin_lock_irq(host->host_lock); } printk(KERN_ERR "%s: SCSI bus appears hung\n", AAC_DRIVERNAME); diff -puN drivers/scsi/aha1542.c~add-ssleep-kill-scsi_sleep drivers/scsi/aha1542.c --- 25/drivers/scsi/aha1542.c~add-ssleep-kill-scsi_sleep 2004-08-18 23:03:34.188316720 -0700 +++ 25-akpm/drivers/scsi/aha1542.c 2004-08-18 23:03:34.238309120 -0700 @@ -1479,7 +1479,7 @@ static int aha1542_bus_reset(Scsi_Cmnd * * we are pretty desperate anyways. */ spin_unlock_irq(SCpnt->device->host->host_lock); - scsi_sleep(4 * HZ); + ssleep(4); spin_lock_irq(SCpnt->device->host->host_lock); WAIT(STATUS(SCpnt->device->host->io_port), @@ -1543,7 +1543,7 @@ static int aha1542_host_reset(Scsi_Cmnd * we are pretty desperate anyways. */ spin_unlock_irq(SCpnt->device->host->host_lock); - scsi_sleep(4 * HZ); + ssleep(4); spin_lock_irq(SCpnt->device->host->host_lock); WAIT(STATUS(SCpnt->device->host->io_port), diff -puN drivers/scsi/aic7xxx/aic79xx_osm.c~add-ssleep-kill-scsi_sleep drivers/scsi/aic7xxx/aic79xx_osm.c --- 25/drivers/scsi/aic7xxx/aic79xx_osm.c~add-ssleep-kill-scsi_sleep 2004-08-18 23:03:34.190316416 -0700 +++ 25-akpm/drivers/scsi/aic7xxx/aic79xx_osm.c 2004-08-18 23:03:34.269304408 -0700 @@ -61,6 +61,7 @@ #endif #include /* For fetching system memory size */ +#include /* For ssleep/msleep */ /* * Lock protecting manipulation of the ahd softc list. @@ -3170,7 +3171,7 @@ ahd_linux_dv_transition(struct ahd_softc break; } if (status & SSQ_DELAY) - scsi_sleep(1 * HZ); + ssleep(1); break; case SS_START: @@ -3330,7 +3331,7 @@ ahd_linux_dv_transition(struct ahd_softc } if (targ->dv_state_retry <= 10) { if ((status & (SSQ_DELAY_RANDOM|SSQ_DELAY))!= 0) - scsi_sleep(ahd->our_id*HZ/10); + msleep(ahd->our_id*1000/10); break; } #ifdef AHD_DEBUG @@ -3374,7 +3375,7 @@ ahd_linux_dv_transition(struct ahd_softc targ->dv_state_retry--; } else if (targ->dv_state_retry < 60) { if ((status & SSQ_DELAY) != 0) - scsi_sleep(1 * HZ); + ssleep(1); } else { #ifdef AHD_DEBUG if (ahd_debug & AHD_SHOW_DV) { diff -puN drivers/scsi/aic7xxx/aic7xxx_osm.c~add-ssleep-kill-scsi_sleep drivers/scsi/aic7xxx/aic7xxx_osm.c --- 25/drivers/scsi/aic7xxx/aic7xxx_osm.c~add-ssleep-kill-scsi_sleep 2004-08-18 23:03:34.193315960 -0700 +++ 25-akpm/drivers/scsi/aic7xxx/aic7xxx_osm.c 2004-08-18 23:03:34.273303800 -0700 @@ -140,6 +140,7 @@ #include /* For fetching system memory size */ #include /* For block_size() */ +#include /* For ssleep/msleep */ /* * Lock protecting manipulation of the ahc softc list. @@ -2822,7 +2823,7 @@ ahc_linux_dv_transition(struct ahc_softc break; } if (status & SSQ_DELAY) - scsi_sleep(1 * HZ); + ssleep(1); break; case SS_START: @@ -2982,7 +2983,7 @@ ahc_linux_dv_transition(struct ahc_softc } if (targ->dv_state_retry <= 10) { if ((status & (SSQ_DELAY_RANDOM|SSQ_DELAY))!= 0) - scsi_sleep(ahc->our_id*HZ/10); + msleep(ahc->our_id*1000/10); break; } #ifdef AHC_DEBUG @@ -3026,7 +3027,7 @@ ahc_linux_dv_transition(struct ahc_softc targ->dv_state_retry--; } else if (targ->dv_state_retry < 60) { if ((status & SSQ_DELAY) != 0) - scsi_sleep(1 * HZ); + ssleep(1); } else { #ifdef AHC_DEBUG if (ahc_debug & AHC_SHOW_DV) { diff -puN drivers/scsi/aic7xxx_old.c~add-ssleep-kill-scsi_sleep drivers/scsi/aic7xxx_old.c --- 25/drivers/scsi/aic7xxx_old.c~add-ssleep-kill-scsi_sleep 2004-08-18 23:03:34.197315352 -0700 +++ 25-akpm/drivers/scsi/aic7xxx_old.c 2004-08-18 23:03:34.252306992 -0700 @@ -10489,7 +10489,7 @@ aic7xxx_bus_device_reset(Scsi_Cmnd *cmd) aic_outb(p, lastphase | ATNO, SCSISIGO); unpause_sequencer(p, FALSE); spin_unlock_irq(p->host->host_lock); - scsi_sleep(HZ); + ssleep(1); spin_lock_irq(p->host->host_lock); if(aic_dev->flags & BUS_DEVICE_RESET_PENDING) return FAILED; @@ -10548,7 +10548,7 @@ aic7xxx_bus_device_reset(Scsi_Cmnd *cmd) aic_outb(p, saved_scbptr, SCBPTR); unpause_sequencer(p, FALSE); spin_unlock_irq(p->host->host_lock); - scsi_sleep(HZ/4); + msleep(1000/4); spin_lock_irq(p->host->host_lock); if(aic_dev->flags & BUS_DEVICE_RESET_PENDING) return FAILED; @@ -10786,7 +10786,7 @@ aic7xxx_abort(Scsi_Cmnd *cmd) } unpause_sequencer(p, FALSE); spin_unlock_irq(p->host->host_lock); - scsi_sleep(HZ/4); + msleep(1000/4); spin_lock_irq(p->host->host_lock); if (p->flags & AHC_ABORT_PENDING) { @@ -10887,7 +10887,7 @@ aic7xxx_reset(Scsi_Cmnd *cmd) aic7xxx_run_done_queue(p, TRUE); unpause_sequencer(p, FALSE); spin_unlock_irq(p->host->host_lock); - scsi_sleep(2 * HZ); + ssleep(2); spin_lock_irq(p->host->host_lock); return SUCCESS; } diff -puN drivers/scsi/arm/fas216.c~add-ssleep-kill-scsi_sleep drivers/scsi/arm/fas216.c --- 25/drivers/scsi/arm/fas216.c~add-ssleep-kill-scsi_sleep 2004-08-18 23:03:34.199315048 -0700 +++ 25-akpm/drivers/scsi/arm/fas216.c 2004-08-18 23:03:34.276303344 -0700 @@ -2681,7 +2681,7 @@ int fas216_eh_host_reset(Scsi_Cmnd *SCpn * IRQs after the sleep. */ spin_unlock_irq(info->host->host_lock); - scsi_sleep(50 * HZ/100); + msleep(50 * 1000/100); spin_lock_irq(info->host->host_lock); /* @@ -2920,7 +2920,7 @@ int fas216_add(struct Scsi_Host *host, s * scsi standard says wait 250ms */ spin_unlock_irq(info->host->host_lock); - scsi_sleep(100*HZ/100); + msleep(100*1000/100); spin_lock_irq(info->host->host_lock); fas216_writeb(info, REG_CNTL1, info->scsi.cfg[0]); diff -puN drivers/scsi/scsi_error.c~add-ssleep-kill-scsi_sleep drivers/scsi/scsi_error.c --- 25/drivers/scsi/scsi_error.c~add-ssleep-kill-scsi_sleep 2004-08-18 23:03:34.202314592 -0700 +++ 25-akpm/drivers/scsi/scsi_error.c 2004-08-18 23:03:34.257306232 -0700 @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -42,8 +43,8 @@ * These should *probably* be handled by the host itself. * Since it is allowed to sleep, it probably should. */ -#define BUS_RESET_SETTLE_TIME (10*HZ) -#define HOST_RESET_SETTLE_TIME (10*HZ) +#define BUS_RESET_SETTLE_TIME (10) +#define HOST_RESET_SETTLE_TIME (10) /* called with shost->host_lock held */ void scsi_eh_wakeup(struct Scsi_Host *shost) @@ -1044,7 +1045,7 @@ static int scsi_try_bus_reset(struct scs if (rtn == SUCCESS) { if (!scmd->device->host->hostt->skip_settle_delay) - scsi_sleep(BUS_RESET_SETTLE_TIME); + ssleep(BUS_RESET_SETTLE_TIME); spin_lock_irqsave(scmd->device->host->host_lock, flags); scsi_report_bus_reset(scmd->device->host, scmd->device->channel); spin_unlock_irqrestore(scmd->device->host->host_lock, flags); @@ -1076,7 +1077,7 @@ static int scsi_try_host_reset(struct sc if (rtn == SUCCESS) { if (!scmd->device->host->hostt->skip_settle_delay) - scsi_sleep(HOST_RESET_SETTLE_TIME); + ssleep(HOST_RESET_SETTLE_TIME); spin_lock_irqsave(scmd->device->host->host_lock, flags); scsi_report_bus_reset(scmd->device->host, scmd->device->channel); spin_unlock_irqrestore(scmd->device->host->host_lock, flags); @@ -1216,43 +1217,6 @@ static void scsi_eh_offline_sdevs(struct } /** - * scsi_sleep_done - timer function for scsi_sleep - * @sem: semphore to signal - * - **/ -static void scsi_sleep_done(unsigned long data) -{ - struct semaphore *sem = (struct semaphore *)data; - - if (sem) - up(sem); -} - -/** - * scsi_sleep - sleep for specified timeout - * @timeout: timeout value - * - **/ -void scsi_sleep(int timeout) -{ - DECLARE_MUTEX_LOCKED(sem); - struct timer_list timer; - - init_timer(&timer); - timer.data = (unsigned long)&sem; - timer.expires = jiffies + timeout; - timer.function = (void (*)(unsigned long))scsi_sleep_done; - - SCSI_LOG_ERROR_RECOVERY(5, printk("sleeping for timer tics %d\n", - timeout)); - - add_timer(&timer); - - down(&sem); - del_timer(&timer); -} - -/** * scsi_decide_disposition - Disposition a cmd on return from LLD. * @scmd: SCSI cmd to examine. * diff -puN drivers/scsi/scsi_syms.c~add-ssleep-kill-scsi_sleep drivers/scsi/scsi_syms.c --- 25/drivers/scsi/scsi_syms.c~add-ssleep-kill-scsi_sleep 2004-08-18 23:03:34.203314440 -0700 +++ 25-akpm/drivers/scsi/scsi_syms.c 2004-08-18 23:03:34.257306232 -0700 @@ -69,8 +69,6 @@ EXPORT_SYMBOL(scsi_track_queue_full); EXPORT_SYMBOL(scsi_get_host_dev); EXPORT_SYMBOL(scsi_free_host_dev); -EXPORT_SYMBOL(scsi_sleep); - EXPORT_SYMBOL(scsi_io_completion); EXPORT_SYMBOL(scsi_add_device); diff -puN drivers/scsi/sg.c~add-ssleep-kill-scsi_sleep drivers/scsi/sg.c --- 25/drivers/scsi/sg.c~add-ssleep-kill-scsi_sleep 2004-08-18 23:03:34.207313832 -0700 +++ 25-akpm/drivers/scsi/sg.c 2004-08-18 23:03:34.261305624 -0700 @@ -47,8 +47,9 @@ static int sg_version_num = 30531; /* 2 #include #include #include - #include +#include + #include "scsi.h" #include #include @@ -1532,7 +1533,7 @@ sg_remove(struct class_device *cl_dev) } if (delay) - scsi_sleep(2); /* dirty detach so delay device destruction */ + msleep(10); /* dirty detach so delay device destruction */ } /* Set 'perm' (4th argument) to 0 to disable module_param's definition diff -puN drivers/scsi/sr_ioctl.c~add-ssleep-kill-scsi_sleep drivers/scsi/sr_ioctl.c --- 25/drivers/scsi/sr_ioctl.c~add-ssleep-kill-scsi_sleep 2004-08-18 23:03:34.209313528 -0700 +++ 25-akpm/drivers/scsi/sr_ioctl.c 2004-08-18 23:03:34.263305320 -0700 @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -131,7 +132,7 @@ int sr_do_ioctl(Scsi_CD *cd, struct pack printk(KERN_INFO "%s: CDROM not ready yet.\n", cd->cdi.name); if (retries++ < 10) { /* sleep 2 sec and try again */ - scsi_sleep(2 * HZ); + ssleep(2); goto retry; } else { /* 20 secs are enough? */ diff -puN include/linux/delay.h~add-ssleep-kill-scsi_sleep include/linux/delay.h --- 25/include/linux/delay.h~add-ssleep-kill-scsi_sleep 2004-08-18 23:03:34.211313224 -0700 +++ 25-akpm/include/linux/delay.h 2004-08-18 23:03:34.276303344 -0700 @@ -40,4 +40,9 @@ extern unsigned long loops_per_jiffy; void msleep(unsigned int msecs); +static inline void ssleep(unsigned int seconds) +{ + msleep(seconds * 1000); +} + #endif /* defined(_LINUX_DELAY_H) */ diff -puN include/scsi/scsi_eh.h~add-ssleep-kill-scsi_sleep include/scsi/scsi_eh.h --- 25/include/scsi/scsi_eh.h~add-ssleep-kill-scsi_sleep 2004-08-18 23:03:34.222311552 -0700 +++ 25-akpm/include/scsi/scsi_eh.h 2004-08-18 23:03:34.277303192 -0700 @@ -11,7 +11,6 @@ extern int scsi_delete_timer(struct scsi extern void scsi_report_bus_reset(struct Scsi_Host *, int); extern void scsi_report_device_reset(struct Scsi_Host *, int, int); extern int scsi_block_when_processing_errors(struct scsi_device *); -extern void scsi_sleep(int); /* * Reset request from external source _