aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-05-28 07:56:31 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-06-17 13:05:10 -0400
commit68b3aa7c9805aee9005a8ca53c5e99177961fbb9 (patch)
tree3f28891df0b3a1ecdfe6a98547d8f3c43b74e905 /drivers
parent94d0e7b805961c44e4dc486ffc21075084bb7175 (diff)
[SCSI] allow sleeping in ->eh_bus_reset_handler()
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/fc4/fc.c3
-rw-r--r--drivers/message/fusion/mptscsih.c3
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c3
-rw-r--r--drivers/scsi/53c700.c9
-rw-r--r--drivers/scsi/NCR5380.c14
-rw-r--r--drivers/scsi/NCR53C9x.c4
-rw-r--r--drivers/scsi/a2091.c4
-rw-r--r--drivers/scsi/a3000.c4
-rw-r--r--drivers/scsi/aha1542.c4
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c4
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c4
-rw-r--r--drivers/scsi/dc395x.c12
-rw-r--r--drivers/scsi/fd_mcs.c5
-rw-r--r--drivers/scsi/fdomain.c6
-rw-r--r--drivers/scsi/gvp11.c4
-rw-r--r--drivers/scsi/imm.c9
-rw-r--r--drivers/scsi/in2000.c6
-rw-r--r--drivers/scsi/initio.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c12
-rw-r--r--drivers/scsi/mvme147.c4
-rw-r--r--drivers/scsi/nsp32.c3
-rw-r--r--drivers/scsi/ppa.c5
-rw-r--r--drivers/scsi/qla1280.c8
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c4
-rw-r--r--drivers/scsi/qlogicfas408.c6
-rw-r--r--drivers/scsi/scsi_error.c2
-rw-r--r--drivers/scsi/seagate.c3
-rw-r--r--drivers/scsi/sgiwd93.c4
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c8
-rw-r--r--drivers/scsi/tmscsim.c6
-rw-r--r--drivers/usb/storage/scsiglue.c3
31 files changed, 132 insertions, 38 deletions
diff --git a/drivers/fc4/fc.c b/drivers/fc4/fc.c
index d9e11b536659..cdea598d0c1b 100644
--- a/drivers/fc4/fc.c
+++ b/drivers/fc4/fc.c
@@ -983,7 +983,10 @@ int fcp_scsi_dev_reset(Scsi_Cmnd *SCpnt)
983 fc->rst_pkt->request->rq_status = RQ_SCSI_BUSY; 983 fc->rst_pkt->request->rq_status = RQ_SCSI_BUSY;
984 984
985 fc->rst_pkt->done = fcp_scsi_reset_done; 985 fc->rst_pkt->done = fcp_scsi_reset_done;
986
987 spin_lock_irqsave(SCpnt->device->host->host_lock, flags);
986 fcp_scsi_queue_it(fc, fc->rst_pkt, fcmd, 0); 988 fcp_scsi_queue_it(fc, fc->rst_pkt, fcmd, 0);
989 spin_unlock_irqrestore(SCpnt->device->host->host_lock, flags);
987 990
988 down(&sem); 991 down(&sem);
989 992
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 82cd9bc3b024..efae9be45370 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -1865,7 +1865,6 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
1865 hd->timeouts++; 1865 hd->timeouts++;
1866 1866
1867 /* We are now ready to execute the task management request. */ 1867 /* We are now ready to execute the task management request. */
1868 spin_unlock_irq(host_lock);
1869 if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, 1868 if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS,
1870 SCpnt->device->channel, 0, 0, 0, 5 /* 5 second timeout */) 1869 SCpnt->device->channel, 0, 0, 0, 5 /* 5 second timeout */)
1871 < 0){ 1870 < 0){
@@ -1881,7 +1880,7 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
1881 spin_lock_irq(host_lock); 1880 spin_lock_irq(host_lock);
1882 return FAILED; 1881 return FAILED;
1883 } 1882 }
1884 spin_lock_irq(host_lock); 1883
1885 return SUCCESS; 1884 return SUCCESS;
1886} 1885}
1887 1886
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index be7c91d4ae8c..ac5a5da434b3 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -731,8 +731,6 @@ zfcp_scsi_eh_bus_reset_handler(struct scsi_cmnd *scpnt)
731 struct zfcp_unit *unit; 731 struct zfcp_unit *unit;
732 struct Scsi_Host *scsi_host = scpnt->device->host; 732 struct Scsi_Host *scsi_host = scpnt->device->host;
733 733
734 spin_unlock_irq(scsi_host->host_lock);
735
736 unit = (struct zfcp_unit *) scpnt->device->hostdata; 734 unit = (struct zfcp_unit *) scpnt->device->hostdata;
737 ZFCP_LOG_NORMAL("bus reset because of problems with " 735 ZFCP_LOG_NORMAL("bus reset because of problems with "
738 "unit 0x%016Lx\n", unit->fcp_lun); 736 "unit 0x%016Lx\n", unit->fcp_lun);
@@ -740,7 +738,6 @@ zfcp_scsi_eh_bus_reset_handler(struct scsi_cmnd *scpnt)
740 zfcp_erp_wait(unit->port->adapter); 738 zfcp_erp_wait(unit->port->adapter);
741 retval = SUCCESS; 739 retval = SUCCESS;
742 740
743 spin_lock_irq(scsi_host->host_lock);
744 return retval; 741 return retval;
745} 742}
746 743
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 8c64212e9608..47cf9bd55d90 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -1957,23 +1957,30 @@ NCR_700_bus_reset(struct scsi_cmnd * SCp)
1957 printk(KERN_INFO "scsi%d (%d:%d) New error handler wants BUS reset, cmd %p\n\t", 1957 printk(KERN_INFO "scsi%d (%d:%d) New error handler wants BUS reset, cmd %p\n\t",
1958 SCp->device->host->host_no, SCp->device->id, SCp->device->lun, SCp); 1958 SCp->device->host->host_no, SCp->device->id, SCp->device->lun, SCp);
1959 scsi_print_command(SCp); 1959 scsi_print_command(SCp);
1960
1960 /* In theory, eh_complete should always be null because the 1961 /* In theory, eh_complete should always be null because the
1961 * eh is single threaded, but just in case we're handling a 1962 * eh is single threaded, but just in case we're handling a
1962 * reset via sg or something */ 1963 * reset via sg or something */
1963 while(hostdata->eh_complete != NULL) { 1964 spin_lock_irq(SCp->device->host->host_lock);
1965 while (hostdata->eh_complete != NULL) {
1964 spin_unlock_irq(SCp->device->host->host_lock); 1966 spin_unlock_irq(SCp->device->host->host_lock);
1965 msleep_interruptible(100); 1967 msleep_interruptible(100);
1966 spin_lock_irq(SCp->device->host->host_lock); 1968 spin_lock_irq(SCp->device->host->host_lock);
1967 } 1969 }
1970
1968 hostdata->eh_complete = &complete; 1971 hostdata->eh_complete = &complete;
1969 NCR_700_internal_bus_reset(SCp->device->host); 1972 NCR_700_internal_bus_reset(SCp->device->host);
1973
1970 spin_unlock_irq(SCp->device->host->host_lock); 1974 spin_unlock_irq(SCp->device->host->host_lock);
1971 wait_for_completion(&complete); 1975 wait_for_completion(&complete);
1972 spin_lock_irq(SCp->device->host->host_lock); 1976 spin_lock_irq(SCp->device->host->host_lock);
1977
1973 hostdata->eh_complete = NULL; 1978 hostdata->eh_complete = NULL;
1974 /* Revalidate the transport parameters of the failing device */ 1979 /* Revalidate the transport parameters of the failing device */
1975 if(hostdata->fast) 1980 if(hostdata->fast)
1976 spi_schedule_dv_device(SCp->device); 1981 spi_schedule_dv_device(SCp->device);
1982
1983 spin_unlock_irq(SCp->device->host->host_lock);
1977 return SUCCESS; 1984 return SUCCESS;
1978} 1985}
1979 1986
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 7ae19d4181be..f8ec6fe7d858 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -2825,11 +2825,17 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
2825 * Locks: host lock taken by caller 2825 * Locks: host lock taken by caller
2826 */ 2826 */
2827 2827
2828static int NCR5380_bus_reset(Scsi_Cmnd * cmd) { 2828static int NCR5380_bus_reset(Scsi_Cmnd * cmd)
2829{
2830 struct Scsi_Host *instance = cmd->device->host;
2831
2829 NCR5380_local_declare(); 2832 NCR5380_local_declare();
2830 NCR5380_setup(cmd->device->host); 2833 NCR5380_setup(instance);
2834 NCR5380_print_status(instance);
2835
2836 spin_lock_irq(instance->host_lock);
2837 do_reset(instance);
2838 spin_unlock_irq(instance->host_lock);
2831 2839
2832 NCR5380_print_status(cmd->device->host);
2833 do_reset(cmd->device->host);
2834 return SUCCESS; 2840 return SUCCESS;
2835} 2841}
diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c
index 064781a2cb1a..6ceabbd42a3d 100644
--- a/drivers/scsi/NCR53C9x.c
+++ b/drivers/scsi/NCR53C9x.c
@@ -1467,14 +1467,12 @@ int esp_reset(Scsi_Cmnd *SCptr)
1467{ 1467{
1468 struct NCR_ESP *esp = (struct NCR_ESP *) SCptr->device->host->hostdata; 1468 struct NCR_ESP *esp = (struct NCR_ESP *) SCptr->device->host->hostdata;
1469 1469
1470 spin_lock_irq(esp->ehost->host_lock);
1470 (void) esp_do_resetbus(esp, esp->eregs); 1471 (void) esp_do_resetbus(esp, esp->eregs);
1471
1472 spin_unlock_irq(esp->ehost->host_lock); 1472 spin_unlock_irq(esp->ehost->host_lock);
1473 1473
1474 wait_event(esp->reset_queue, (esp->resetting_bus == 0)); 1474 wait_event(esp->reset_queue, (esp->resetting_bus == 0));
1475 1475
1476 spin_lock_irq(esp->ehost->host_lock);
1477
1478 return SUCCESS; 1476 return SUCCESS;
1479} 1477}
1480 1478
diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c
index 9928a2fbce0c..ce3c37610c5c 100644
--- a/drivers/scsi/a2091.c
+++ b/drivers/scsi/a2091.c
@@ -221,7 +221,11 @@ int __init a2091_detect(Scsi_Host_Template *tpnt)
221static int a2091_bus_reset(Scsi_Cmnd *cmd) 221static int a2091_bus_reset(Scsi_Cmnd *cmd)
222{ 222{
223 /* FIXME perform bus-specific reset */ 223 /* FIXME perform bus-specific reset */
224
225 spin_lock_irq(cmd->device->host->host_lock);
224 wd33c93_host_reset(cmd); 226 wd33c93_host_reset(cmd);
227 spin_unlock_irq(cmd->device->host->host_lock);
228
225 return SUCCESS; 229 return SUCCESS;
226} 230}
227 231
diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c
index f8a89ec25042..92698f335591 100644
--- a/drivers/scsi/a3000.c
+++ b/drivers/scsi/a3000.c
@@ -208,7 +208,11 @@ fail_register:
208static int a3000_bus_reset(Scsi_Cmnd *cmd) 208static int a3000_bus_reset(Scsi_Cmnd *cmd)
209{ 209{
210 /* FIXME perform bus-specific reset */ 210 /* FIXME perform bus-specific reset */
211
212 spin_lock_irq(cmd->device->host->host_lock);
211 wd33c93_host_reset(cmd); 213 wd33c93_host_reset(cmd);
214 spin_unlock_irq(cmd->device->host->host_lock);
215
212 return SUCCESS; 216 return SUCCESS;
213} 217}
214 218
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index eb8bc6822cc1..f911b51e3042 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -1464,8 +1464,8 @@ static int aha1542_bus_reset(Scsi_Cmnd * SCpnt)
1464 * check for timeout, and if we are doing something like this 1464 * check for timeout, and if we are doing something like this
1465 * we are pretty desperate anyways. 1465 * we are pretty desperate anyways.
1466 */ 1466 */
1467 spin_unlock_irq(SCpnt->device->host->host_lock);
1468 ssleep(4); 1467 ssleep(4);
1468
1469 spin_lock_irq(SCpnt->device->host->host_lock); 1469 spin_lock_irq(SCpnt->device->host->host_lock);
1470 1470
1471 WAIT(STATUS(SCpnt->device->host->io_port), 1471 WAIT(STATUS(SCpnt->device->host->io_port),
@@ -1503,9 +1503,11 @@ static int aha1542_bus_reset(Scsi_Cmnd * SCpnt)
1503 } 1503 }
1504 } 1504 }
1505 1505
1506 spin_unlock_irq(SCpnt->device->host->host_lock);
1506 return SUCCESS; 1507 return SUCCESS;
1507 1508
1508fail: 1509fail:
1510 spin_unlock_irq(SCpnt->device->host->host_lock);
1509 return FAILED; 1511 return FAILED;
1510} 1512}
1511 1513
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 31db0edc7cf9..53b7b2c15f86 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1591,11 +1591,11 @@ ahd_linux_bus_reset(Scsi_Cmnd *cmd)
1591 printf("%s: Bus reset called for cmd %p\n", 1591 printf("%s: Bus reset called for cmd %p\n",
1592 ahd_name(ahd), cmd); 1592 ahd_name(ahd), cmd);
1593#endif 1593#endif
1594 ahd_midlayer_entrypoint_lock(ahd, &s); 1594 ahd_lock(ahd, &s);
1595 found = ahd_reset_channel(ahd, cmd->device->channel + 'A', 1595 found = ahd_reset_channel(ahd, cmd->device->channel + 'A',
1596 /*initiate reset*/TRUE); 1596 /*initiate reset*/TRUE);
1597 ahd_linux_run_complete_queue(ahd); 1597 ahd_linux_run_complete_queue(ahd);
1598 ahd_midlayer_entrypoint_unlock(ahd, &s); 1598 ahd_unlock(ahd, &s);
1599 1599
1600 if (bootverbose) 1600 if (bootverbose)
1601 printf("%s: SCSI bus reset delivered. " 1601 printf("%s: SCSI bus reset delivered. "
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 89f073a3b766..b89094db14c1 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -829,10 +829,14 @@ ahc_linux_bus_reset(struct scsi_cmnd *cmd)
829{ 829{
830 struct ahc_softc *ahc; 830 struct ahc_softc *ahc;
831 int found; 831 int found;
832 unsigned long flags;
832 833
833 ahc = *(struct ahc_softc **)cmd->device->host->hostdata; 834 ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
835
836 ahc_lock(ahc, &flags);
834 found = ahc_reset_channel(ahc, cmd->device->channel + 'A', 837 found = ahc_reset_channel(ahc, cmd->device->channel + 'A',
835 /*initiate reset*/TRUE); 838 /*initiate reset*/TRUE);
839 ahc_unlock(ahc, &flags);
836 840
837 if (bootverbose) 841 if (bootverbose)
838 printf("%s: SCSI bus reset delivered. " 842 printf("%s: SCSI bus reset delivered. "
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index cca41cf8d3e7..ae13c002f60d 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -1310,7 +1310,7 @@ static void reset_dev_param(struct AdapterCtlBlk *acb)
1310 * @cmd - some command for this host (for fetching hooks) 1310 * @cmd - some command for this host (for fetching hooks)
1311 * Returns: SUCCESS (0x2002) on success, else FAILED (0x2003). 1311 * Returns: SUCCESS (0x2002) on success, else FAILED (0x2003).
1312 */ 1312 */
1313static int dc395x_eh_bus_reset(struct scsi_cmnd *cmd) 1313static int __dc395x_eh_bus_reset(struct scsi_cmnd *cmd)
1314{ 1314{
1315 struct AdapterCtlBlk *acb = 1315 struct AdapterCtlBlk *acb =
1316 (struct AdapterCtlBlk *)cmd->device->host->hostdata; 1316 (struct AdapterCtlBlk *)cmd->device->host->hostdata;
@@ -1356,6 +1356,16 @@ static int dc395x_eh_bus_reset(struct scsi_cmnd *cmd)
1356 return SUCCESS; 1356 return SUCCESS;
1357} 1357}
1358 1358
1359static int dc395x_eh_bus_reset(struct scsi_cmnd *cmd)
1360{
1361 int rc;
1362
1363 spin_lock_irq(cmd->device->host->host_lock);
1364 rc = __dc395x_eh_bus_reset(cmd);
1365 spin_unlock_irq(cmd->device->host->host_lock);
1366
1367 return rc;
1368}
1359 1369
1360/* 1370/*
1361 * abort an errant SCSI command 1371 * abort an errant SCSI command
diff --git a/drivers/scsi/fd_mcs.c b/drivers/scsi/fd_mcs.c
index 4a358aec2e59..fa652f8aa643 100644
--- a/drivers/scsi/fd_mcs.c
+++ b/drivers/scsi/fd_mcs.c
@@ -1243,6 +1243,7 @@ static int fd_mcs_abort(Scsi_Cmnd * SCpnt)
1243 1243
1244static int fd_mcs_bus_reset(Scsi_Cmnd * SCpnt) { 1244static int fd_mcs_bus_reset(Scsi_Cmnd * SCpnt) {
1245 struct Scsi_Host *shpnt = SCpnt->device->host; 1245 struct Scsi_Host *shpnt = SCpnt->device->host;
1246 unsigned long flags;
1246 1247
1247#if DEBUG_RESET 1248#if DEBUG_RESET
1248 static int called_once = 0; 1249 static int called_once = 0;
@@ -1259,6 +1260,8 @@ static int fd_mcs_bus_reset(Scsi_Cmnd * SCpnt) {
1259 called_once = 1; 1260 called_once = 1;
1260#endif 1261#endif
1261 1262
1263 spin_lock_irqsave(shpnt->host_lock, flags);
1264
1262 outb(1, SCSI_Cntl_port); 1265 outb(1, SCSI_Cntl_port);
1263 do_pause(2); 1266 do_pause(2);
1264 outb(0, SCSI_Cntl_port); 1267 outb(0, SCSI_Cntl_port);
@@ -1266,6 +1269,8 @@ static int fd_mcs_bus_reset(Scsi_Cmnd * SCpnt) {
1266 outb(0, SCSI_Mode_Cntl_port); 1269 outb(0, SCSI_Mode_Cntl_port);
1267 outb(PARITY_MASK, TMC_Cntl_port); 1270 outb(PARITY_MASK, TMC_Cntl_port);
1268 1271
1272 spin_unlock_irqrestore(shpnt->host_lock, flags);
1273
1269 /* Unless this is the very first call (i.e., SCPnt == NULL), everything 1274 /* Unless this is the very first call (i.e., SCPnt == NULL), everything
1270 is probably hosed at this point. We will, however, try to keep 1275 is probably hosed at this point. We will, however, try to keep
1271 things going by informing the high-level code that we need help. */ 1276 things going by informing the high-level code that we need help. */
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index a843c080c1d8..4ba6a15cf43d 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -1543,12 +1543,18 @@ static int fdomain_16x0_abort(struct scsi_cmnd *SCpnt)
1543 1543
1544int fdomain_16x0_bus_reset(struct scsi_cmnd *SCpnt) 1544int fdomain_16x0_bus_reset(struct scsi_cmnd *SCpnt)
1545{ 1545{
1546 unsigned long flags;
1547
1548 local_irq_save(flags);
1549
1546 outb(1, port_base + SCSI_Cntl); 1550 outb(1, port_base + SCSI_Cntl);
1547 do_pause( 2 ); 1551 do_pause( 2 );
1548 outb(0, port_base + SCSI_Cntl); 1552 outb(0, port_base + SCSI_Cntl);
1549 do_pause( 115 ); 1553 do_pause( 115 );
1550 outb(0, port_base + SCSI_Mode_Cntl); 1554 outb(0, port_base + SCSI_Mode_Cntl);
1551 outb(PARITY_MASK, port_base + TMC_Cntl); 1555 outb(PARITY_MASK, port_base + TMC_Cntl);
1556
1557 local_irq_restore(flags);
1552 return SUCCESS; 1558 return SUCCESS;
1553} 1559}
1554 1560
diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c
index 30cbf73c7433..66990af1dc9c 100644
--- a/drivers/scsi/gvp11.c
+++ b/drivers/scsi/gvp11.c
@@ -345,7 +345,11 @@ release:
345static int gvp11_bus_reset(Scsi_Cmnd *cmd) 345static int gvp11_bus_reset(Scsi_Cmnd *cmd)
346{ 346{
347 /* FIXME perform bus-specific reset */ 347 /* FIXME perform bus-specific reset */
348
349 spin_lock_irq(cmd->device->host->host_lock);
348 wd33c93_host_reset(cmd); 350 wd33c93_host_reset(cmd);
351 spin_unlock_irq(cmd->device->host->host_lock);
352
349 return SUCCESS; 353 return SUCCESS;
350} 354}
351 355
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c
index be7f2ca0183f..65e845665b85 100644
--- a/drivers/scsi/imm.c
+++ b/drivers/scsi/imm.c
@@ -18,6 +18,7 @@
18#include <linux/blkdev.h> 18#include <linux/blkdev.h>
19#include <linux/parport.h> 19#include <linux/parport.h>
20#include <linux/workqueue.h> 20#include <linux/workqueue.h>
21#include <linux/delay.h>
21#include <asm/io.h> 22#include <asm/io.h>
22 23
23#include <scsi/scsi.h> 24#include <scsi/scsi.h>
@@ -610,9 +611,9 @@ static int imm_init(imm_struct *dev)
610 if (imm_connect(dev, 0) != 1) 611 if (imm_connect(dev, 0) != 1)
611 return -EIO; 612 return -EIO;
612 imm_reset_pulse(dev->base); 613 imm_reset_pulse(dev->base);
613 udelay(1000); /* Delay to allow devices to settle */ 614 mdelay(1); /* Delay to allow devices to settle */
614 imm_disconnect(dev); 615 imm_disconnect(dev);
615 udelay(1000); /* Another delay to allow devices to settle */ 616 mdelay(1); /* Another delay to allow devices to settle */
616 return device_check(dev); 617 return device_check(dev);
617} 618}
618 619
@@ -1026,9 +1027,9 @@ static int imm_reset(struct scsi_cmnd *cmd)
1026 1027
1027 imm_connect(dev, CONNECT_NORMAL); 1028 imm_connect(dev, CONNECT_NORMAL);
1028 imm_reset_pulse(dev->base); 1029 imm_reset_pulse(dev->base);
1029 udelay(1000); /* device settle delay */ 1030 mdelay(1); /* device settle delay */
1030 imm_disconnect(dev); 1031 imm_disconnect(dev);
1031 udelay(1000); /* device settle delay */ 1032 mdelay(1); /* device settle delay */
1032 return SUCCESS; 1033 return SUCCESS;
1033} 1034}
1034 1035
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
index fbb29f7971d7..aed7e64865fa 100644
--- a/drivers/scsi/in2000.c
+++ b/drivers/scsi/in2000.c
@@ -1644,14 +1644,16 @@ static int in2000_bus_reset(Scsi_Cmnd * cmd)
1644 struct Scsi_Host *instance; 1644 struct Scsi_Host *instance;
1645 struct IN2000_hostdata *hostdata; 1645 struct IN2000_hostdata *hostdata;
1646 int x; 1646 int x;
1647 unsigned long flags;
1647 1648
1648 instance = cmd->device->host; 1649 instance = cmd->device->host;
1649 hostdata = (struct IN2000_hostdata *) instance->hostdata; 1650 hostdata = (struct IN2000_hostdata *) instance->hostdata;
1650 1651
1651 printk(KERN_WARNING "scsi%d: Reset. ", instance->host_no); 1652 printk(KERN_WARNING "scsi%d: Reset. ", instance->host_no);
1652 1653
1653 /* do scsi-reset here */ 1654 spin_lock_irqsave(instance->host_lock, flags);
1654 1655
1656 /* do scsi-reset here */
1655 reset_hardware(instance, RESET_CARD_AND_BUS); 1657 reset_hardware(instance, RESET_CARD_AND_BUS);
1656 for (x = 0; x < 8; x++) { 1658 for (x = 0; x < 8; x++) {
1657 hostdata->busy[x] = 0; 1659 hostdata->busy[x] = 0;
@@ -1668,6 +1670,8 @@ static int in2000_bus_reset(Scsi_Cmnd * cmd)
1668 hostdata->outgoing_len = 0; 1670 hostdata->outgoing_len = 0;
1669 1671
1670 cmd->result = DID_RESET << 16; 1672 cmd->result = DID_RESET << 16;
1673
1674 spin_unlock_irqrestore(instance->host_lock, flags);
1671 return SUCCESS; 1675 return SUCCESS;
1672} 1676}
1673 1677
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index a7b74d8c53b9..f7ddc9f1ba41 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -3014,7 +3014,11 @@ static int i91u_bus_reset(struct scsi_cmnd * SCpnt)
3014 HCS *pHCB; 3014 HCS *pHCB;
3015 3015
3016 pHCB = (HCS *) SCpnt->device->host->base; 3016 pHCB = (HCS *) SCpnt->device->host->base;
3017
3018 spin_lock_irq(SCpnt->device->host->host_lock);
3017 tul_reset_scsi(pHCB, 0); 3019 tul_reset_scsi(pHCB, 0);
3020 spin_unlock_irq(SCpnt->device->host->host_lock);
3021
3018 return SUCCESS; 3022 return SUCCESS;
3019} 3023}
3020 3024
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 13da26883da3..f2aff3f4042b 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -1054,7 +1054,7 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
1054 * Note: midlayer calls this function with the host_lock held 1054 * Note: midlayer calls this function with the host_lock held
1055 */ 1055 */
1056static int 1056static int
1057lpfc_reset_bus_handler(struct scsi_cmnd *cmnd) 1057__lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
1058{ 1058{
1059 struct Scsi_Host *shost = cmnd->device->host; 1059 struct Scsi_Host *shost = cmnd->device->host;
1060 struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0]; 1060 struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0];
@@ -1144,6 +1144,16 @@ out:
1144} 1144}
1145 1145
1146static int 1146static int
1147lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
1148{
1149 int rc;
1150 spin_lock_irq(cmnd->device->host->host_lock);
1151 rc = __lpfc_reset_bus_handler(cmnd);
1152 spin_unlock_irq(cmnd->device->host->host_lock);
1153 return rc;
1154}
1155
1156static int
1147lpfc_slave_alloc(struct scsi_device *sdev) 1157lpfc_slave_alloc(struct scsi_device *sdev)
1148{ 1158{
1149 struct lpfc_hba *phba = (struct lpfc_hba *)sdev->host->hostdata[0]; 1159 struct lpfc_hba *phba = (struct lpfc_hba *)sdev->host->hostdata[0];
diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c
index e73b33f293a0..5c42021189eb 100644
--- a/drivers/scsi/mvme147.c
+++ b/drivers/scsi/mvme147.c
@@ -116,7 +116,11 @@ int mvme147_detect(Scsi_Host_Template *tpnt)
116static int mvme147_bus_reset(Scsi_Cmnd *cmd) 116static int mvme147_bus_reset(Scsi_Cmnd *cmd)
117{ 117{
118 /* FIXME perform bus-specific reset */ 118 /* FIXME perform bus-specific reset */
119
120 spin_lock_irq(cmd->device->host->host_lock);
119 wd33c93_host_reset(cmd); 121 wd33c93_host_reset(cmd);
122 spin_unlock_irq(cmd->device->host->host_lock);
123
120 return SUCCESS; 124 return SUCCESS;
121} 125}
122 126
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 029cef4ad694..6f15e7adbc65 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -2987,6 +2987,8 @@ static int nsp32_eh_bus_reset(struct scsi_cmnd *SCpnt)
2987 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata; 2987 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
2988 unsigned int base = SCpnt->device->host->io_port; 2988 unsigned int base = SCpnt->device->host->io_port;
2989 2989
2990 spin_lock_irq(SCpnt->device->host->host_lock);
2991
2990 nsp32_msg(KERN_INFO, "Bus Reset"); 2992 nsp32_msg(KERN_INFO, "Bus Reset");
2991 nsp32_dbg(NSP32_DEBUG_BUSRESET, "SCpnt=0x%x", SCpnt); 2993 nsp32_dbg(NSP32_DEBUG_BUSRESET, "SCpnt=0x%x", SCpnt);
2992 2994
@@ -2994,6 +2996,7 @@ static int nsp32_eh_bus_reset(struct scsi_cmnd *SCpnt)
2994 nsp32_do_bus_reset(data); 2996 nsp32_do_bus_reset(data);
2995 nsp32_write2(base, IRQ_CONTROL, 0); 2997 nsp32_write2(base, IRQ_CONTROL, 0);
2996 2998
2999 spin_unlock_irq(SCpnt->device->host->host_lock);
2997 return SUCCESS; /* SCSI bus reset is succeeded at any time. */ 3000 return SUCCESS; /* SCSI bus reset is succeeded at any time. */
2998} 3001}
2999 3002
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
index 96b4522523d9..fafcf5d185e7 100644
--- a/drivers/scsi/ppa.c
+++ b/drivers/scsi/ppa.c
@@ -17,6 +17,7 @@
17#include <linux/blkdev.h> 17#include <linux/blkdev.h>
18#include <linux/parport.h> 18#include <linux/parport.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20#include <linux/delay.h>
20#include <asm/io.h> 21#include <asm/io.h>
21 22
22#include <scsi/scsi.h> 23#include <scsi/scsi.h>
@@ -891,9 +892,9 @@ static int ppa_reset(struct scsi_cmnd *cmd)
891 892
892 ppa_connect(dev, CONNECT_NORMAL); 893 ppa_connect(dev, CONNECT_NORMAL);
893 ppa_reset_pulse(dev->base); 894 ppa_reset_pulse(dev->base);
894 udelay(1000); /* device settle delay */ 895 mdelay(1); /* device settle delay */
895 ppa_disconnect(dev); 896 ppa_disconnect(dev);
896 udelay(1000); /* device settle delay */ 897 mdelay(1); /* device settle delay */
897 return SUCCESS; 898 return SUCCESS;
898} 899}
899 900
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 907a1e8cc880..d26dbe2a33fe 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -1130,7 +1130,13 @@ qla1280_eh_device_reset(struct scsi_cmnd *cmd)
1130static int 1130static int
1131qla1280_eh_bus_reset(struct scsi_cmnd *cmd) 1131qla1280_eh_bus_reset(struct scsi_cmnd *cmd)
1132{ 1132{
1133 return qla1280_error_action(cmd, BUS_RESET); 1133 int rc;
1134
1135 spin_lock_irq(cmd->device->host->host_lock);
1136 rc = qla1280_error_action(cmd, BUS_RESET);
1137 spin_unlock_irq(cmd->device->host->host_lock);
1138
1139 return rc;
1134} 1140}
1135 1141
1136/************************************************************************** 1142/**************************************************************************
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 360974eb2b26..e9091f9fbf25 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -753,8 +753,6 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
753 qla_printk(KERN_INFO, ha, 753 qla_printk(KERN_INFO, ha,
754 "scsi(%ld:%d:%d): LOOP RESET ISSUED.\n", ha->host_no, id, lun); 754 "scsi(%ld:%d:%d): LOOP RESET ISSUED.\n", ha->host_no, id, lun);
755 755
756 spin_unlock_irq(ha->host->host_lock);
757
758 if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) { 756 if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) {
759 DEBUG2(printk("%s failed:board disabled\n",__func__)); 757 DEBUG2(printk("%s failed:board disabled\n",__func__));
760 goto eh_bus_reset_done; 758 goto eh_bus_reset_done;
@@ -776,8 +774,6 @@ eh_bus_reset_done:
776 qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__, 774 qla_printk(KERN_INFO, ha, "%s: reset %s\n", __func__,
777 (ret == FAILED) ? "failed" : "succeded"); 775 (ret == FAILED) ? "failed" : "succeded");
778 776
779 spin_lock_irq(ha->host->host_lock);
780
781 return ret; 777 return ret;
782} 778}
783 779
diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c
index 575f8a8fcf34..cb75e0b7baea 100644
--- a/drivers/scsi/qlogicfas408.c
+++ b/drivers/scsi/qlogicfas408.c
@@ -511,8 +511,14 @@ int qlogicfas408_abort(Scsi_Cmnd * cmd)
511int qlogicfas408_bus_reset(Scsi_Cmnd * cmd) 511int qlogicfas408_bus_reset(Scsi_Cmnd * cmd)
512{ 512{
513 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); 513 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
514 unsigned long flags;
515
514 priv->qabort = 2; 516 priv->qabort = 2;
517
518 spin_lock_irqsave(cmd->device->host->host_lock, flags);
515 ql_zap(priv); 519 ql_zap(priv);
520 spin_unlock_irqrestore(cmd->device->host->host_lock, flags);
521
516 return SUCCESS; 522 return SUCCESS;
517} 523}
518 524
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 87d925055b47..be56ee67b7fe 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1053,9 +1053,7 @@ static int scsi_try_bus_reset(struct scsi_cmnd *scmd)
1053 if (!scmd->device->host->hostt->eh_bus_reset_handler) 1053 if (!scmd->device->host->hostt->eh_bus_reset_handler)
1054 return FAILED; 1054 return FAILED;
1055 1055
1056 spin_lock_irqsave(scmd->device->host->host_lock, flags);
1057 rtn = scmd->device->host->hostt->eh_bus_reset_handler(scmd); 1056 rtn = scmd->device->host->hostt->eh_bus_reset_handler(scmd);
1058 spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
1059 1057
1060 if (rtn == SUCCESS) { 1058 if (rtn == SUCCESS) {
1061 if (!scmd->device->host->hostt->skip_settle_delay) 1059 if (!scmd->device->host->hostt->skip_settle_delay)
diff --git a/drivers/scsi/seagate.c b/drivers/scsi/seagate.c
index ae9fdb52847b..a0cace9aeb79 100644
--- a/drivers/scsi/seagate.c
+++ b/drivers/scsi/seagate.c
@@ -97,6 +97,7 @@
97#include <linux/delay.h> 97#include <linux/delay.h>
98#include <linux/blkdev.h> 98#include <linux/blkdev.h>
99#include <linux/stat.h> 99#include <linux/stat.h>
100#include <linux/delay.h>
100 101
101#include <asm/io.h> 102#include <asm/io.h>
102#include <asm/system.h> 103#include <asm/system.h>
@@ -1631,7 +1632,7 @@ static int seagate_st0x_bus_reset(Scsi_Cmnd * SCpnt)
1631 /* assert RESET signal on SCSI bus. */ 1632 /* assert RESET signal on SCSI bus. */
1632 WRITE_CONTROL (BASE_CMD | CMD_RST); 1633 WRITE_CONTROL (BASE_CMD | CMD_RST);
1633 1634
1634 udelay (20 * 1000); 1635 mdelay (20);
1635 1636
1636 WRITE_CONTROL (BASE_CMD); 1637 WRITE_CONTROL (BASE_CMD);
1637 st0x_aborted = DID_RESET; 1638 st0x_aborted = DID_RESET;
diff --git a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c
index 270f2aa88faa..ed66828705e1 100644
--- a/drivers/scsi/sgiwd93.c
+++ b/drivers/scsi/sgiwd93.c
@@ -310,7 +310,11 @@ int sgiwd93_release(struct Scsi_Host *instance)
310static int sgiwd93_bus_reset(Scsi_Cmnd *cmd) 310static int sgiwd93_bus_reset(Scsi_Cmnd *cmd)
311{ 311{
312 /* FIXME perform bus-specific reset */ 312 /* FIXME perform bus-specific reset */
313
314 spin_lock_irq(cmd->device->host->host_lock);
313 wd33c93_host_reset(cmd); 315 wd33c93_host_reset(cmd);
316 spin_unlock_irq(cmd->device->host->host_lock);
317
314 return SUCCESS; 318 return SUCCESS;
315} 319}
316 320
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 5ea62552d47d..6af9c18b3f97 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -878,7 +878,13 @@ static int sym53c8xx_eh_device_reset_handler(struct scsi_cmnd *cmd)
878 878
879static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd) 879static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd)
880{ 880{
881 return sym_eh_handler(SYM_EH_BUS_RESET, "BUS RESET", cmd); 881 int rc;
882
883 spin_lock_irq(cmd->device->host->host_lock);
884 rc = sym_eh_handler(SYM_EH_BUS_RESET, "BUS RESET", cmd);
885 spin_unlock_irq(cmd->device->host->host_lock);
886
887 return rc;
882} 888}
883 889
884static int sym53c8xx_eh_host_reset_handler(struct scsi_cmnd *cmd) 890static int sym53c8xx_eh_host_reset_handler(struct scsi_cmnd *cmd)
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index ee9df02efd5b..9589c67de535 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -2120,6 +2120,8 @@ static int DC390_bus_reset (struct scsi_cmnd *cmd)
2120 struct dc390_acb* pACB = (struct dc390_acb*) cmd->device->host->hostdata; 2120 struct dc390_acb* pACB = (struct dc390_acb*) cmd->device->host->hostdata;
2121 u8 bval; 2121 u8 bval;
2122 2122
2123 spin_lock_irq(cmd->device->host->host_lock);
2124
2123 bval = DC390_read8(CtrlReg1) | DIS_INT_ON_SCSI_RST; 2125 bval = DC390_read8(CtrlReg1) | DIS_INT_ON_SCSI_RST;
2124 DC390_write8(CtrlReg1, bval); /* disable IRQ on bus reset */ 2126 DC390_write8(CtrlReg1, bval); /* disable IRQ on bus reset */
2125 2127
@@ -2127,7 +2129,7 @@ static int DC390_bus_reset (struct scsi_cmnd *cmd)
2127 dc390_ResetSCSIBus(pACB); 2129 dc390_ResetSCSIBus(pACB);
2128 2130
2129 dc390_ResetDevParam(pACB); 2131 dc390_ResetDevParam(pACB);
2130 udelay(1000); 2132 mdelay(1);
2131 pACB->pScsiHost->last_reset = jiffies + 3*HZ/2 2133 pACB->pScsiHost->last_reset = jiffies + 3*HZ/2
2132 + HZ * dc390_eepromBuf[pACB->AdapterIndex][EE_DELAY]; 2134 + HZ * dc390_eepromBuf[pACB->AdapterIndex][EE_DELAY];
2133 2135
@@ -2142,6 +2144,8 @@ static int DC390_bus_reset (struct scsi_cmnd *cmd)
2142 bval = DC390_read8(CtrlReg1) & ~DIS_INT_ON_SCSI_RST; 2144 bval = DC390_read8(CtrlReg1) & ~DIS_INT_ON_SCSI_RST;
2143 DC390_write8(CtrlReg1, bval); /* re-enable interrupt */ 2145 DC390_write8(CtrlReg1, bval); /* re-enable interrupt */
2144 2146
2147 spin_unlock_irq(cmd->device->host->host_lock);
2148
2145 return SUCCESS; 2149 return SUCCESS;
2146} 2150}
2147 2151
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 739a9143477d..1035b248eff4 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -276,8 +276,6 @@ static int bus_reset(struct scsi_cmnd *srb)
276 276
277 US_DEBUGP("%s called\n", __FUNCTION__); 277 US_DEBUGP("%s called\n", __FUNCTION__);
278 278
279 scsi_unlock(us_to_host(us));
280
281 /* The USB subsystem doesn't handle synchronisation between 279 /* The USB subsystem doesn't handle synchronisation between
282 * a device's several drivers. Therefore we reset only devices 280 * a device's several drivers. Therefore we reset only devices
283 * with just one interface, which we of course own. */ 281 * with just one interface, which we of course own. */
@@ -304,7 +302,6 @@ static int bus_reset(struct scsi_cmnd *srb)
304 up(&(us->dev_semaphore)); 302 up(&(us->dev_semaphore));
305 303
306 /* lock the host for the return */ 304 /* lock the host for the return */
307 scsi_lock(us_to_host(us));
308 return result < 0 ? FAILED : SUCCESS; 305 return result < 0 ? FAILED : SUCCESS;
309} 306}
310 307