add ssleep(), kill scsi_sleep()
Subsystems (6)
PATCH 1/1 add ssleep(), kill scsi_sleep()
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.
===== drivers/scsi/aha1542.c 1.37 vs edited =====
drivers/scsi/aha1542.c +2 -2
@@ -1479,7 +1479,7 @@* 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 @@* 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),
===== drivers/scsi/aic7xxx_old.c 1.57 vs edited =====
drivers/scsi/aic7xxx_old.c +4 -4
@@ -10489,7 +10489,7 @@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 @@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 @@ }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_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 ; }
===== drivers/scsi/scsi_error.c 1.79 vs edited =====
drivers/scsi/scsi_error.c +5 -41
76 lines not on this page · raw message
===== drivers/scsi/scsi_syms.c 1.49 vs edited =====
drivers/scsi/scsi_syms.c +0 -2
@@ -69,8 +69,6 @@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);
===== drivers/scsi/sg.c 1.95 vs edited =====
drivers/scsi/sg.c +3 -2
@@ -47,8 +47,9 @@#include <linux/devfs_fs_kernel.h> #include <linux/cdev.h> #include <linux/seq_file.h> -#include <linux/blkdev.h> +#include <linux/delay.h> +#include "scsi.h" #include <scsi/scsi_host.h> #include <scsi/scsi_driver.h>
@@ -1547,7 +1548,7 @@ }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
===== drivers/scsi/sr_ioctl.c 1.35 vs edited =====
drivers/scsi/sr_ioctl.c +2 -1
@@ -7,6 +7,7 @@#include <linux/blkdev.h> #include <linux/blkpg.h> #include <linux/cdrom.h> +#include <linux/delay.h> #include <asm/io.h> #include <asm/uaccess.h>
@@ -131,7 +132,7 @@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? */
===== drivers/scsi/aacraid/linit.c 1.33 vs edited =====
drivers/scsi/aacraid/linit.c +2 -1
@@ -44,6 +44,7 @@#include <linux/spinlock.h> #include <linux/syscalls.h> #include <linux/ioctl32.h> +#include <linux/delay.h> #include <asm/semaphore.h> #include <scsi/scsi.h>
@@ -416,7 +417,7 @@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 );
===== drivers/scsi/aic7xxx/aic79xx_osm.c 1.53 vs edited =====
drivers/scsi/aic7xxx/aic79xx_osm.c +4 -3
@@ -61,6 +61,7 @@#endif #include <linux/mm.h> /* For fetching system memory size */ +#include <linux/delay.h> /* For ssleep/msleep */ /* * Lock protecting manipulation of the ahd softc list.
@@ -3163,7 +3164,7 @@break ; }if (status &SSQ_DELAY ) -scsi_sleep (1 *HZ ); +ssleep (1 );break ;case SS_START :
@@ -3323,7 +3324,7 @@ }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
@@ -3367,7 +3368,7 @@ 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 ) {
===== drivers/scsi/aic7xxx/aic7xxx_osm.c 1.55 vs edited =====
drivers/scsi/aic7xxx/aic7xxx_osm.c +4 -3
@@ -140,6 +140,7 @@#include <linux/mm.h> /* For fetching system memory size */ #include <linux/blkdev.h> /* For block_size() */ +#include <linux/delay.h> /* For ssleep/msleep */ /* * Lock protecting manipulation of the ahc softc list.
@@ -2825,7 +2826,7 @@break ; }if (status &SSQ_DELAY ) -scsi_sleep (1 *HZ ); +ssleep (1 );break ;case SS_START :
@@ -2985,7 +2986,7 @@ }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
@@ -3029,7 +3030,7 @@ 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 ) {
===== drivers/scsi/arm/fas216.c 1.27 vs edited =====
drivers/scsi/arm/fas216.c +2 -2
@@ -2681,7 +2681,7 @@* 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 @@* 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 ]);
===== include/linux/delay.h 1.4 vs edited =====
include/linux/delay.h +5 -0
@@ -40,4 +40,9 @@void msleep (unsigned int msecs); +static inline void ssleep (unsigned int seconds) +{ +msleep (seconds *1000 ); +} +#endif /* defined(_LINUX_DELAY_H) */
===== include/scsi/scsi_eh.h 1.2 vs edited =====
include/scsi/scsi_eh.h +0 -1
@@ -11,7 +11,6 @@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
Quoted 3 lines · Jeff Garzik
So, the kernel needs a 'sleep', but that token is far too common, so I
chosessleep().
Dorky name, but whatever.
Quoted 1 line
scsi_sleep()is a manually implementedmsleep(), so I remove it.
scsi_sleep() was buggy anyway: the CPU running scsi_sleep_done() could still be dinking with the semaphore when it goes out of scope on the CPU running scsi_sleep(). That's why struct completion was added.
Quoted 6 lines · Andrew Morton
Quoted 1 line · Jeff Garzik
So, the kernel needs a 'sleep', but that token is far too common, so I chose
ssleep().Dorky name, but whatever.
Feel free to rename :) I care mainly about the end results:
1) having a function that takes a 'seconds' argument, since that matches common usage in many places
2) killing scsi_sleep