aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/hp/sim/simscsi.c4
-rw-r--r--drivers/ata/libata-scsi.c4
-rw-r--r--drivers/block/cciss_scsi.c8
-rw-r--r--drivers/firewire/sbp2.c4
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c4
-rw-r--r--drivers/message/fusion/mptfc.c7
-rw-r--r--drivers/message/fusion/mptsas.c4
-rw-r--r--drivers/message/fusion/mptspi.c4
-rw-r--r--drivers/message/i2o/i2o_scsi.c6
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c4
-rw-r--r--drivers/scsi/3w-9xxx.c4
-rw-r--r--drivers/scsi/3w-sas.c4
-rw-r--r--drivers/scsi/3w-xxxx.c4
-rw-r--r--drivers/scsi/53c700.c8
-rw-r--r--drivers/scsi/BusLogic.c3
-rw-r--r--drivers/scsi/BusLogic.h2
-rw-r--r--drivers/scsi/NCR5380.c3
-rw-r--r--drivers/scsi/NCR5380.h2
-rw-r--r--drivers/scsi/NCR53c406a.c4
-rw-r--r--drivers/scsi/a100u2w.c4
-rw-r--r--drivers/scsi/aacraid/linit.c4
-rw-r--r--drivers/scsi/advansys.c4
-rw-r--r--drivers/scsi/aha152x.c4
-rw-r--r--drivers/scsi/aha1542.c4
-rw-r--r--drivers/scsi/aha1542.h2
-rw-r--r--drivers/scsi/aha1740.c4
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c4
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c4
-rw-r--r--drivers/scsi/aic7xxx_old.c4
-rw-r--r--drivers/scsi/arcmsr/arcmsr_hba.c7
-rw-r--r--drivers/scsi/arm/acornscsi.c4
-rw-r--r--drivers/scsi/arm/fas216.c10
-rw-r--r--drivers/scsi/arm/fas216.h18
-rw-r--r--drivers/scsi/atari_NCR5380.c4
-rw-r--r--drivers/scsi/atari_scsi.c17
-rw-r--r--drivers/scsi/atp870u.c4
-rw-r--r--drivers/scsi/bfa/bfad_im.c7
-rw-r--r--drivers/scsi/dc395x.c3
-rw-r--r--drivers/scsi/dpt_i2o.c4
-rw-r--r--drivers/scsi/dpti.h2
-rw-r--r--drivers/scsi/dtc.h2
-rw-r--r--drivers/scsi/eata.c7
-rw-r--r--drivers/scsi/eata_pio.c4
-rw-r--r--drivers/scsi/esp_scsi.c4
-rw-r--r--drivers/scsi/fd_mcs.c4
-rw-r--r--drivers/scsi/fdomain.c4
-rw-r--r--drivers/scsi/fnic/fnic.h2
-rw-r--r--drivers/scsi/fnic/fnic_scsi.c4
-rw-r--r--drivers/scsi/g_NCR5380.h2
-rw-r--r--drivers/scsi/gdth.c6
-rw-r--r--drivers/scsi/hpsa.c7
-rw-r--r--drivers/scsi/hptiop.c4
-rw-r--r--drivers/scsi/ibmmca.c6
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c4
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c4
-rw-r--r--drivers/scsi/imm.c4
-rw-r--r--drivers/scsi/in2000.c4
-rw-r--r--drivers/scsi/in2000.h2
-rw-r--r--drivers/scsi/initio.c4
-rw-r--r--drivers/scsi/ipr.c4
-rw-r--r--drivers/scsi/ips.c6
-rw-r--r--drivers/scsi/libfc/fc_fcp.c4
-rw-r--r--drivers/scsi/libiscsi.c4
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c4
-rw-r--r--drivers/scsi/mac53c94.c4
-rw-r--r--drivers/scsi/megaraid.c6
-rw-r--r--drivers/scsi/megaraid.h2
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c7
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c4
-rw-r--r--drivers/scsi/mesh.c4
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c4
-rw-r--r--drivers/scsi/ncr53c8xx.c4
-rw-r--r--drivers/scsi/nsp32.c7
-rw-r--r--drivers/scsi/pas16.h2
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c4
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.h3
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c4
-rw-r--r--drivers/scsi/pmcraid.c4
-rw-r--r--drivers/scsi/ppa.c4
-rw-r--r--drivers/scsi/ps3rom.c4
-rw-r--r--drivers/scsi/qla1280.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c7
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c7
-rw-r--r--drivers/scsi/qlogicfas408.c4
-rw-r--r--drivers/scsi/qlogicfas408.h3
-rw-r--r--drivers/scsi/qlogicpti.c4
-rw-r--r--drivers/scsi/scsi.c18
-rw-r--r--drivers/scsi/scsi_debug.c4
-rw-r--r--drivers/scsi/scsi_error.c6
-rw-r--r--drivers/scsi/stex.c4
-rw-r--r--drivers/scsi/sun3_NCR5380.c4
-rw-r--r--drivers/scsi/sun3_scsi.h3
-rw-r--r--drivers/scsi/sym53c416.c4
-rw-r--r--drivers/scsi/sym53c416.h2
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c4
-rw-r--r--drivers/scsi/t128.h3
-rw-r--r--drivers/scsi/tmscsim.c4
-rw-r--r--drivers/scsi/u14-34f.c6
-rw-r--r--drivers/scsi/ultrastor.c4
-rw-r--r--drivers/scsi/ultrastor.h3
-rw-r--r--drivers/scsi/vmw_pvscsi.c4
-rw-r--r--drivers/scsi/wd33c93.c6
-rw-r--r--drivers/scsi/wd33c93.h3
-rw-r--r--drivers/scsi/wd7000.c4
-rw-r--r--drivers/staging/hv/storvsc_drv.c7
-rw-r--r--drivers/staging/keucr/scsiglue.c4
-rw-r--r--drivers/usb/image/microtek.c6
-rw-r--r--drivers/usb/storage/scsiglue.c4
-rw-r--r--drivers/usb/storage/uas.c4
-rw-r--r--include/linux/libata.h2
-rw-r--r--include/scsi/libfc.h3
-rw-r--r--include/scsi/libiscsi.h3
-rw-r--r--include/scsi/libsas.h3
-rw-r--r--include/scsi/scsi_host.h23
115 files changed, 347 insertions, 199 deletions
diff --git a/arch/ia64/hp/sim/simscsi.c b/arch/ia64/hp/sim/simscsi.c
index 3a078ad3aa44..331de723c676 100644
--- a/arch/ia64/hp/sim/simscsi.c
+++ b/arch/ia64/hp/sim/simscsi.c
@@ -202,7 +202,7 @@ simscsi_readwrite10 (struct scsi_cmnd *sc, int mode)
202} 202}
203 203
204static int 204static int
205simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) 205simscsi_queuecommand_lck (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
206{ 206{
207 unsigned int target_id = sc->device->id; 207 unsigned int target_id = sc->device->id;
208 char fname[MAX_ROOT_LEN+16]; 208 char fname[MAX_ROOT_LEN+16];
@@ -326,6 +326,8 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
326 return 0; 326 return 0;
327} 327}
328 328
329static DEF_SCSI_QCMD(simscsi_queuecommand)
330
329static int 331static int
330simscsi_host_reset (struct scsi_cmnd *sc) 332simscsi_host_reset (struct scsi_cmnd *sc)
331{ 333{
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 3f91c01c217f..19835d39289d 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3183,7 +3183,7 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
3183 * Return value from __ata_scsi_queuecmd() if @cmd can be queued, 3183 * Return value from __ata_scsi_queuecmd() if @cmd can be queued,
3184 * 0 otherwise. 3184 * 0 otherwise.
3185 */ 3185 */
3186int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 3186static int ata_scsi_queuecmd_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
3187{ 3187{
3188 struct ata_port *ap; 3188 struct ata_port *ap;
3189 struct ata_device *dev; 3189 struct ata_device *dev;
@@ -3211,6 +3211,8 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
3211 return rc; 3211 return rc;
3212} 3212}
3213 3213
3214DEF_SCSI_QCMD(ata_scsi_queuecmd)
3215
3214/** 3216/**
3215 * ata_scsi_simulate - simulate SCSI command on ATA device 3217 * ata_scsi_simulate - simulate SCSI command on ATA device
3216 * @dev: the target device 3218 * @dev: the target device
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index 575495f3c4b8..727d0225b7d0 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -62,8 +62,8 @@ static int cciss_scsi_proc_info(
62 int length, /* length of data in buffer */ 62 int length, /* length of data in buffer */
63 int func); /* 0 == read, 1 == write */ 63 int func); /* 0 == read, 1 == write */
64 64
65static int cciss_scsi_queue_command (struct scsi_cmnd *cmd, 65static int cciss_scsi_queue_command (struct Scsi_Host *h,
66 void (* done)(struct scsi_cmnd *)); 66 struct scsi_cmnd *cmd);
67static int cciss_eh_device_reset_handler(struct scsi_cmnd *); 67static int cciss_eh_device_reset_handler(struct scsi_cmnd *);
68static int cciss_eh_abort_handler(struct scsi_cmnd *); 68static int cciss_eh_abort_handler(struct scsi_cmnd *);
69 69
@@ -1406,7 +1406,7 @@ static void cciss_scatter_gather(ctlr_info_t *h, CommandList_struct *c,
1406 1406
1407 1407
1408static int 1408static int
1409cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) 1409cciss_scsi_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
1410{ 1410{
1411 ctlr_info_t *h; 1411 ctlr_info_t *h;
1412 int rc; 1412 int rc;
@@ -1504,6 +1504,8 @@ cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd
1504 return 0; 1504 return 0;
1505} 1505}
1506 1506
1507static DEF_SCSI_QCMD(cciss_scsi_queue_command)
1508
1507static void cciss_unregister_scsi(ctlr_info_t *h) 1509static void cciss_unregister_scsi(ctlr_info_t *h)
1508{ 1510{
1509 struct cciss_scsi_adapter_data_t *sa; 1511 struct cciss_scsi_adapter_data_t *sa;
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
index bfae4b309791..afa576a75a8e 100644
--- a/drivers/firewire/sbp2.c
+++ b/drivers/firewire/sbp2.c
@@ -1468,7 +1468,7 @@ static int sbp2_map_scatterlist(struct sbp2_command_orb *orb,
1468 1468
1469/* SCSI stack integration */ 1469/* SCSI stack integration */
1470 1470
1471static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) 1471static int sbp2_scsi_queuecommand_lck(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1472{ 1472{
1473 struct sbp2_logical_unit *lu = cmd->device->hostdata; 1473 struct sbp2_logical_unit *lu = cmd->device->hostdata;
1474 struct fw_device *device = target_device(lu->tgt); 1474 struct fw_device *device = target_device(lu->tgt);
@@ -1534,6 +1534,8 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1534 return retval; 1534 return retval;
1535} 1535}
1536 1536
1537static DEF_SCSI_QCMD(sbp2_scsi_queuecommand)
1538
1537static int sbp2_scsi_slave_alloc(struct scsi_device *sdev) 1539static int sbp2_scsi_slave_alloc(struct scsi_device *sdev)
1538{ 1540{
1539 struct sbp2_logical_unit *lu = sdev->hostdata; 1541 struct sbp2_logical_unit *lu = sdev->hostdata;
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index cfc1d65c4577..1e1e347a7715 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1123,7 +1123,7 @@ static void srp_send_completion(struct ib_cq *cq, void *target_ptr)
1123 } 1123 }
1124} 1124}
1125 1125
1126static int srp_queuecommand(struct scsi_cmnd *scmnd, 1126static int srp_queuecommand_lck(struct scsi_cmnd *scmnd,
1127 void (*done)(struct scsi_cmnd *)) 1127 void (*done)(struct scsi_cmnd *))
1128{ 1128{
1129 struct srp_target_port *target = host_to_target(scmnd->device->host); 1129 struct srp_target_port *target = host_to_target(scmnd->device->host);
@@ -1196,6 +1196,8 @@ err:
1196 return SCSI_MLQUEUE_HOST_BUSY; 1196 return SCSI_MLQUEUE_HOST_BUSY;
1197} 1197}
1198 1198
1199static DEF_SCSI_QCMD(srp_queuecommand)
1200
1199static int srp_alloc_iu_bufs(struct srp_target_port *target) 1201static int srp_alloc_iu_bufs(struct srp_target_port *target)
1200{ 1202{
1201 int i; 1203 int i;
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index e15220ff52fc..d784c36707c0 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -97,8 +97,7 @@ static u8 mptfcInternalCtx = MPT_MAX_PROTOCOL_DRIVERS;
97 97
98static int mptfc_target_alloc(struct scsi_target *starget); 98static int mptfc_target_alloc(struct scsi_target *starget);
99static int mptfc_slave_alloc(struct scsi_device *sdev); 99static int mptfc_slave_alloc(struct scsi_device *sdev);
100static int mptfc_qcmd(struct scsi_cmnd *SCpnt, 100static int mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt);
101 void (*done)(struct scsi_cmnd *));
102static void mptfc_target_destroy(struct scsi_target *starget); 101static void mptfc_target_destroy(struct scsi_target *starget);
103static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout); 102static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout);
104static void __devexit mptfc_remove(struct pci_dev *pdev); 103static void __devexit mptfc_remove(struct pci_dev *pdev);
@@ -650,7 +649,7 @@ mptfc_slave_alloc(struct scsi_device *sdev)
650} 649}
651 650
652static int 651static int
653mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 652mptfc_qcmd_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
654{ 653{
655 struct mptfc_rport_info *ri; 654 struct mptfc_rport_info *ri;
656 struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device)); 655 struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device));
@@ -681,6 +680,8 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
681 return mptscsih_qcmd(SCpnt,done); 680 return mptscsih_qcmd(SCpnt,done);
682} 681}
683 682
683static DEF_SCSI_QCMD(mptfc_qcmd)
684
684/* 685/*
685 * mptfc_display_port_link_speed - displaying link speed 686 * mptfc_display_port_link_speed - displaying link speed
686 * @ioc: Pointer to MPT_ADAPTER structure 687 * @ioc: Pointer to MPT_ADAPTER structure
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 83a5115f0251..d48c2c6058e1 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1889,7 +1889,7 @@ mptsas_slave_alloc(struct scsi_device *sdev)
1889} 1889}
1890 1890
1891static int 1891static int
1892mptsas_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 1892mptsas_qcmd_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
1893{ 1893{
1894 MPT_SCSI_HOST *hd; 1894 MPT_SCSI_HOST *hd;
1895 MPT_ADAPTER *ioc; 1895 MPT_ADAPTER *ioc;
@@ -1913,6 +1913,8 @@ mptsas_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
1913 return mptscsih_qcmd(SCpnt,done); 1913 return mptscsih_qcmd(SCpnt,done);
1914} 1914}
1915 1915
1916static DEF_SCSI_QCMD(mptsas_qcmd)
1917
1916/** 1918/**
1917 * mptsas_mptsas_eh_timed_out - resets the scsi_cmnd timeout 1919 * mptsas_mptsas_eh_timed_out - resets the scsi_cmnd timeout
1918 * if the device under question is currently in the 1920 * if the device under question is currently in the
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 0e2803155ae2..6d9568d2ec59 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -780,7 +780,7 @@ static int mptspi_slave_configure(struct scsi_device *sdev)
780} 780}
781 781
782static int 782static int
783mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 783mptspi_qcmd_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
784{ 784{
785 struct _MPT_SCSI_HOST *hd = shost_priv(SCpnt->device->host); 785 struct _MPT_SCSI_HOST *hd = shost_priv(SCpnt->device->host);
786 VirtDevice *vdevice = SCpnt->device->hostdata; 786 VirtDevice *vdevice = SCpnt->device->hostdata;
@@ -805,6 +805,8 @@ mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
805 return mptscsih_qcmd(SCpnt,done); 805 return mptscsih_qcmd(SCpnt,done);
806} 806}
807 807
808static DEF_SCSI_QCMD(mptspi_qcmd)
809
808static void mptspi_slave_destroy(struct scsi_device *sdev) 810static void mptspi_slave_destroy(struct scsi_device *sdev)
809{ 811{
810 struct scsi_target *starget = scsi_target(sdev); 812 struct scsi_target *starget = scsi_target(sdev);
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c
index ea6b2197da8a..97bdf82ec905 100644
--- a/drivers/message/i2o/i2o_scsi.c
+++ b/drivers/message/i2o/i2o_scsi.c
@@ -506,7 +506,7 @@ static struct i2o_driver i2o_scsi_driver = {
506 * Locks: takes the controller lock on error path only 506 * Locks: takes the controller lock on error path only
507 */ 507 */
508 508
509static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt, 509static int i2o_scsi_queuecommand_lck(struct scsi_cmnd *SCpnt,
510 void (*done) (struct scsi_cmnd *)) 510 void (*done) (struct scsi_cmnd *))
511{ 511{
512 struct i2o_controller *c; 512 struct i2o_controller *c;
@@ -688,7 +688,9 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
688 688
689 exit: 689 exit:
690 return rc; 690 return rc;
691}; 691}
692
693static DEF_SCSI_QCMD(i2o_scsi_queuecommand)
692 694
693/** 695/**
694 * i2o_scsi_abort - abort a running command 696 * i2o_scsi_abort - abort a running command
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 50286d8707f3..6bd2dbc4c316 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -76,7 +76,7 @@ static void zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result)
76 scpnt->scsi_done(scpnt); 76 scpnt->scsi_done(scpnt);
77} 77}
78 78
79static int zfcp_scsi_queuecommand(struct scsi_cmnd *scpnt, 79static int zfcp_scsi_queuecommand_lck(struct scsi_cmnd *scpnt,
80 void (*done) (struct scsi_cmnd *)) 80 void (*done) (struct scsi_cmnd *))
81{ 81{
82 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device); 82 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
@@ -127,6 +127,8 @@ static int zfcp_scsi_queuecommand(struct scsi_cmnd *scpnt,
127 return ret; 127 return ret;
128} 128}
129 129
130static DEF_SCSI_QCMD(zfcp_scsi_queuecommand)
131
130static int zfcp_scsi_slave_alloc(struct scsi_device *sdev) 132static int zfcp_scsi_slave_alloc(struct scsi_device *sdev)
131{ 133{
132 struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); 134 struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index fcf08b3f52c1..b7bd5b0cc7aa 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -1765,7 +1765,7 @@ out:
1765} /* End twa_scsi_eh_reset() */ 1765} /* End twa_scsi_eh_reset() */
1766 1766
1767/* This is the main scsi queue function to handle scsi opcodes */ 1767/* This is the main scsi queue function to handle scsi opcodes */
1768static int twa_scsi_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 1768static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
1769{ 1769{
1770 int request_id, retval; 1770 int request_id, retval;
1771 TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; 1771 TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata;
@@ -1812,6 +1812,8 @@ out:
1812 return retval; 1812 return retval;
1813} /* End twa_scsi_queue() */ 1813} /* End twa_scsi_queue() */
1814 1814
1815static DEF_SCSI_QCMD(twa_scsi_queue)
1816
1815/* This function hands scsi cdb's to the firmware */ 1817/* This function hands scsi cdb's to the firmware */
1816static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg) 1818static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg)
1817{ 1819{
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index 6a95d111d207..13e39e1fdfe2 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -1501,7 +1501,7 @@ out:
1501} /* End twl_scsi_eh_reset() */ 1501} /* End twl_scsi_eh_reset() */
1502 1502
1503/* This is the main scsi queue function to handle scsi opcodes */ 1503/* This is the main scsi queue function to handle scsi opcodes */
1504static int twl_scsi_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 1504static int twl_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
1505{ 1505{
1506 int request_id, retval; 1506 int request_id, retval;
1507 TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata; 1507 TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata;
@@ -1536,6 +1536,8 @@ out:
1536 return retval; 1536 return retval;
1537} /* End twl_scsi_queue() */ 1537} /* End twl_scsi_queue() */
1538 1538
1539static DEF_SCSI_QCMD(twl_scsi_queue)
1540
1539/* This function tells the controller to shut down */ 1541/* This function tells the controller to shut down */
1540static void __twl_shutdown(TW_Device_Extension *tw_dev) 1542static void __twl_shutdown(TW_Device_Extension *tw_dev)
1541{ 1543{
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index b1125341f4c8..7fe96ff60c58 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -1947,7 +1947,7 @@ static int tw_scsiop_test_unit_ready_complete(TW_Device_Extension *tw_dev, int r
1947} /* End tw_scsiop_test_unit_ready_complete() */ 1947} /* End tw_scsiop_test_unit_ready_complete() */
1948 1948
1949/* This is the main scsi queue function to handle scsi opcodes */ 1949/* This is the main scsi queue function to handle scsi opcodes */
1950static int tw_scsi_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 1950static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
1951{ 1951{
1952 unsigned char *command = SCpnt->cmnd; 1952 unsigned char *command = SCpnt->cmnd;
1953 int request_id = 0; 1953 int request_id = 0;
@@ -2023,6 +2023,8 @@ static int tw_scsi_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd
2023 return retval; 2023 return retval;
2024} /* End tw_scsi_queue() */ 2024} /* End tw_scsi_queue() */
2025 2025
2026static DEF_SCSI_QCMD(tw_scsi_queue)
2027
2026/* This function is the interrupt service routine */ 2028/* This function is the interrupt service routine */
2027static irqreturn_t tw_interrupt(int irq, void *dev_instance) 2029static irqreturn_t tw_interrupt(int irq, void *dev_instance)
2028{ 2030{
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 89fc1c8af86b..f672491774eb 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -167,7 +167,7 @@ MODULE_LICENSE("GPL");
167#include "53c700_d.h" 167#include "53c700_d.h"
168 168
169 169
170STATIC int NCR_700_queuecommand(struct scsi_cmnd *, void (*done)(struct scsi_cmnd *)); 170STATIC int NCR_700_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *);
171STATIC int NCR_700_abort(struct scsi_cmnd * SCpnt); 171STATIC int NCR_700_abort(struct scsi_cmnd * SCpnt);
172STATIC int NCR_700_bus_reset(struct scsi_cmnd * SCpnt); 172STATIC int NCR_700_bus_reset(struct scsi_cmnd * SCpnt);
173STATIC int NCR_700_host_reset(struct scsi_cmnd * SCpnt); 173STATIC int NCR_700_host_reset(struct scsi_cmnd * SCpnt);
@@ -1749,8 +1749,8 @@ NCR_700_intr(int irq, void *dev_id)
1749 return IRQ_RETVAL(handled); 1749 return IRQ_RETVAL(handled);
1750} 1750}
1751 1751
1752STATIC int 1752static int
1753NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) 1753NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *))
1754{ 1754{
1755 struct NCR_700_Host_Parameters *hostdata = 1755 struct NCR_700_Host_Parameters *hostdata =
1756 (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0]; 1756 (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0];
@@ -1904,6 +1904,8 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *))
1904 return 0; 1904 return 0;
1905} 1905}
1906 1906
1907STATIC DEF_SCSI_QCMD(NCR_700_queuecommand)
1908
1907STATIC int 1909STATIC int
1908NCR_700_abort(struct scsi_cmnd * SCp) 1910NCR_700_abort(struct scsi_cmnd * SCp)
1909{ 1911{
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index fc0b4b81d552..f66c33b9ab41 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -2807,7 +2807,7 @@ static int BusLogic_host_reset(struct scsi_cmnd * SCpnt)
2807 Outgoing Mailbox for execution by the associated Host Adapter. 2807 Outgoing Mailbox for execution by the associated Host Adapter.
2808*/ 2808*/
2809 2809
2810static int BusLogic_QueueCommand(struct scsi_cmnd *Command, void (*CompletionRoutine) (struct scsi_cmnd *)) 2810static int BusLogic_QueueCommand_lck(struct scsi_cmnd *Command, void (*CompletionRoutine) (struct scsi_cmnd *))
2811{ 2811{
2812 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Command->device->host->hostdata; 2812 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Command->device->host->hostdata;
2813 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[Command->device->id]; 2813 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[Command->device->id];
@@ -2994,6 +2994,7 @@ static int BusLogic_QueueCommand(struct scsi_cmnd *Command, void (*CompletionRou
2994 return 0; 2994 return 0;
2995} 2995}
2996 2996
2997static DEF_SCSI_QCMD(BusLogic_QueueCommand)
2997 2998
2998#if 0 2999#if 0
2999/* 3000/*
diff --git a/drivers/scsi/BusLogic.h b/drivers/scsi/BusLogic.h
index 73f237a1ed94..649fcb31f26d 100644
--- a/drivers/scsi/BusLogic.h
+++ b/drivers/scsi/BusLogic.h
@@ -1319,7 +1319,7 @@ static inline void BusLogic_IncrementSizeBucket(BusLogic_CommandSizeBuckets_T Co
1319*/ 1319*/
1320 1320
1321static const char *BusLogic_DriverInfo(struct Scsi_Host *); 1321static const char *BusLogic_DriverInfo(struct Scsi_Host *);
1322static int BusLogic_QueueCommand(struct scsi_cmnd *, void (*CompletionRoutine) (struct scsi_cmnd *)); 1322static int BusLogic_QueueCommand(struct Scsi_Host *h, struct scsi_cmnd *);
1323static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *); 1323static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *);
1324static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *, char *, char **, off_t, int, int); 1324static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *, char *, char **, off_t, int, int);
1325static int BusLogic_SlaveConfigure(struct scsi_device *); 1325static int BusLogic_SlaveConfigure(struct scsi_device *);
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 5d2f148889ad..9a5629f94f95 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -952,7 +952,7 @@ static void NCR5380_exit(struct Scsi_Host *instance)
952 * Locks: host lock taken by caller 952 * Locks: host lock taken by caller
953 */ 953 */
954 954
955static int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) 955static int NCR5380_queue_command_lck(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
956{ 956{
957 struct Scsi_Host *instance = cmd->device->host; 957 struct Scsi_Host *instance = cmd->device->host;
958 struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata; 958 struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
@@ -1021,6 +1021,7 @@ static int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
1021 return 0; 1021 return 0;
1022} 1022}
1023 1023
1024static DEF_SCSI_QCMD(NCR5380_queue_command)
1024 1025
1025/** 1026/**
1026 * NCR5380_main - NCR state machines 1027 * NCR5380_main - NCR state machines
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index bdc468c9e1d9..fd40a32b1f6f 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -313,7 +313,7 @@ static void NCR5380_print(struct Scsi_Host *instance);
313#endif 313#endif
314static int NCR5380_abort(Scsi_Cmnd * cmd); 314static int NCR5380_abort(Scsi_Cmnd * cmd);
315static int NCR5380_bus_reset(Scsi_Cmnd * cmd); 315static int NCR5380_bus_reset(Scsi_Cmnd * cmd);
316static int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)); 316static int NCR5380_queue_command(struct Scsi_Host *, struct scsi_cmnd *);
317static int __maybe_unused NCR5380_proc_info(struct Scsi_Host *instance, 317static int __maybe_unused NCR5380_proc_info(struct Scsi_Host *instance,
318 char *buffer, char **start, off_t offset, int length, int inout); 318 char *buffer, char **start, off_t offset, int length, int inout);
319 319
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c
index 6961f78742ae..c91888a0a23c 100644
--- a/drivers/scsi/NCR53c406a.c
+++ b/drivers/scsi/NCR53c406a.c
@@ -693,7 +693,7 @@ static void wait_intr(void)
693} 693}
694#endif 694#endif
695 695
696static int NCR53c406a_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) 696static int NCR53c406a_queue_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
697{ 697{
698 int i; 698 int i;
699 699
@@ -726,6 +726,8 @@ static int NCR53c406a_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
726 return 0; 726 return 0;
727} 727}
728 728
729static DEF_SCSI_QCMD(NCR53c406a_queue)
730
729static int NCR53c406a_host_reset(Scsi_Cmnd * SCpnt) 731static int NCR53c406a_host_reset(Scsi_Cmnd * SCpnt)
730{ 732{
731 DEB(printk("NCR53c406a_reset called\n")); 733 DEB(printk("NCR53c406a_reset called\n"));
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index dbbc601948e5..dc5ac6e528c4 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -911,7 +911,7 @@ static int inia100_build_scb(struct orc_host * host, struct orc_scb * scb, struc
911 * queue the command down to the controller 911 * queue the command down to the controller
912 */ 912 */
913 913
914static int inia100_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *)) 914static int inia100_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *))
915{ 915{
916 struct orc_scb *scb; 916 struct orc_scb *scb;
917 struct orc_host *host; /* Point to Host adapter control block */ 917 struct orc_host *host; /* Point to Host adapter control block */
@@ -930,6 +930,8 @@ static int inia100_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd
930 return 0; 930 return 0;
931} 931}
932 932
933static DEF_SCSI_QCMD(inia100_queue)
934
933/***************************************************************************** 935/*****************************************************************************
934 Function name : inia100_abort 936 Function name : inia100_abort
935 Description : Abort a queued command. 937 Description : Abort a queued command.
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 29c0ed1cf507..2c93d9496d62 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -248,7 +248,7 @@ static struct aac_driver_ident aac_drivers[] = {
248 * TODO: unify with aac_scsi_cmd(). 248 * TODO: unify with aac_scsi_cmd().
249 */ 249 */
250 250
251static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 251static int aac_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
252{ 252{
253 struct Scsi_Host *host = cmd->device->host; 253 struct Scsi_Host *host = cmd->device->host;
254 struct aac_dev *dev = (struct aac_dev *)host->hostdata; 254 struct aac_dev *dev = (struct aac_dev *)host->hostdata;
@@ -267,6 +267,8 @@ static int aac_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd
267 return (aac_scsi_cmd(cmd) ? FAILED : 0); 267 return (aac_scsi_cmd(cmd) ? FAILED : 0);
268} 268}
269 269
270static DEF_SCSI_QCMD(aac_queuecommand)
271
270/** 272/**
271 * aac_info - Returns the host adapter name 273 * aac_info - Returns the host adapter name
272 * @shost: Scsi host to report on 274 * @shost: Scsi host to report on
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 0ec3da6f3e12..081c6de92bc5 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -9500,7 +9500,7 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
9500 * in the 'scp' result field. 9500 * in the 'scp' result field.
9501 */ 9501 */
9502static int 9502static int
9503advansys_queuecommand(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) 9503advansys_queuecommand_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *))
9504{ 9504{
9505 struct Scsi_Host *shost = scp->device->host; 9505 struct Scsi_Host *shost = scp->device->host;
9506 int asc_res, result = 0; 9506 int asc_res, result = 0;
@@ -9525,6 +9525,8 @@ advansys_queuecommand(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *))
9525 return result; 9525 return result;
9526} 9526}
9527 9527
9528static DEF_SCSI_QCMD(advansys_queuecommand)
9529
9528static ushort __devinit AscGetEisaChipCfg(PortAddr iop_base) 9530static ushort __devinit AscGetEisaChipCfg(PortAddr iop_base)
9529{ 9531{
9530 PortAddr eisa_cfg_iop = (PortAddr) ASC_GET_EISA_SLOT(iop_base) | 9532 PortAddr eisa_cfg_iop = (PortAddr) ASC_GET_EISA_SLOT(iop_base) |
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 8eab8587ff21..c5169f01c1cd 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -1056,7 +1056,7 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
1056 * queue a command 1056 * queue a command
1057 * 1057 *
1058 */ 1058 */
1059static int aha152x_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) 1059static int aha152x_queue_lck(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
1060{ 1060{
1061#if 0 1061#if 0
1062 if(*SCpnt->cmnd == REQUEST_SENSE) { 1062 if(*SCpnt->cmnd == REQUEST_SENSE) {
@@ -1070,6 +1070,8 @@ static int aha152x_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
1070 return aha152x_internal_queue(SCpnt, NULL, 0, done); 1070 return aha152x_internal_queue(SCpnt, NULL, 0, done);
1071} 1071}
1072 1072
1073static DEF_SCSI_QCMD(aha152x_queue)
1074
1073 1075
1074/* 1076/*
1075 * 1077 *
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 4f785f254c1f..195823a51aab 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -558,7 +558,7 @@ static void aha1542_intr_handle(struct Scsi_Host *shost)
558 }; 558 };
559} 559}
560 560
561static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) 561static int aha1542_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
562{ 562{
563 unchar ahacmd = CMD_START_SCSI; 563 unchar ahacmd = CMD_START_SCSI;
564 unchar direction; 564 unchar direction;
@@ -718,6 +718,8 @@ static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
718 return 0; 718 return 0;
719} 719}
720 720
721static DEF_SCSI_QCMD(aha1542_queuecommand)
722
721/* Initialize mailboxes */ 723/* Initialize mailboxes */
722static void setup_mailboxes(int bse, struct Scsi_Host *shpnt) 724static void setup_mailboxes(int bse, struct Scsi_Host *shpnt)
723{ 725{
diff --git a/drivers/scsi/aha1542.h b/drivers/scsi/aha1542.h
index 1db538552d56..b871d2b57f93 100644
--- a/drivers/scsi/aha1542.h
+++ b/drivers/scsi/aha1542.h
@@ -132,7 +132,7 @@ struct ccb { /* Command Control Block 5.3 */
132}; 132};
133 133
134static int aha1542_detect(struct scsi_host_template *); 134static int aha1542_detect(struct scsi_host_template *);
135static int aha1542_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 135static int aha1542_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
136static int aha1542_bus_reset(Scsi_Cmnd * SCpnt); 136static int aha1542_bus_reset(Scsi_Cmnd * SCpnt);
137static int aha1542_dev_reset(Scsi_Cmnd * SCpnt); 137static int aha1542_dev_reset(Scsi_Cmnd * SCpnt);
138static int aha1542_host_reset(Scsi_Cmnd * SCpnt); 138static int aha1542_host_reset(Scsi_Cmnd * SCpnt);
diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c
index 0107a4cc3331..d058f1ab82b5 100644
--- a/drivers/scsi/aha1740.c
+++ b/drivers/scsi/aha1740.c
@@ -331,7 +331,7 @@ static irqreturn_t aha1740_intr_handle(int irq, void *dev_id)
331 return IRQ_RETVAL(handled); 331 return IRQ_RETVAL(handled);
332} 332}
333 333
334static int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *)) 334static int aha1740_queuecommand_lck(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *))
335{ 335{
336 unchar direction; 336 unchar direction;
337 unchar *cmd = (unchar *) SCpnt->cmnd; 337 unchar *cmd = (unchar *) SCpnt->cmnd;
@@ -503,6 +503,8 @@ static int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *))
503 return 0; 503 return 0;
504} 504}
505 505
506static DEF_SCSI_QCMD(aha1740_queuecommand)
507
506/* Query the board for its irq_level and irq_type. Nothing else matters 508/* Query the board for its irq_level and irq_type. Nothing else matters
507 in enhanced mode on an EISA bus. */ 509 in enhanced mode on an EISA bus. */
508 510
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 88ad8482ef59..25d066624476 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -573,7 +573,7 @@ ahd_linux_info(struct Scsi_Host *host)
573 * Queue an SCB to the controller. 573 * Queue an SCB to the controller.
574 */ 574 */
575static int 575static int
576ahd_linux_queue(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *)) 576ahd_linux_queue_lck(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *))
577{ 577{
578 struct ahd_softc *ahd; 578 struct ahd_softc *ahd;
579 struct ahd_linux_device *dev = scsi_transport_device_data(cmd->device); 579 struct ahd_linux_device *dev = scsi_transport_device_data(cmd->device);
@@ -588,6 +588,8 @@ ahd_linux_queue(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *))
588 return rtn; 588 return rtn;
589} 589}
590 590
591static DEF_SCSI_QCMD(ahd_linux_queue)
592
591static struct scsi_target ** 593static struct scsi_target **
592ahd_linux_target_in_softc(struct scsi_target *starget) 594ahd_linux_target_in_softc(struct scsi_target *starget)
593{ 595{
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index aeea7a61478e..4a359bb307c6 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -528,7 +528,7 @@ ahc_linux_info(struct Scsi_Host *host)
528 * Queue an SCB to the controller. 528 * Queue an SCB to the controller.
529 */ 529 */
530static int 530static int
531ahc_linux_queue(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *)) 531ahc_linux_queue_lck(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *))
532{ 532{
533 struct ahc_softc *ahc; 533 struct ahc_softc *ahc;
534 struct ahc_linux_device *dev = scsi_transport_device_data(cmd->device); 534 struct ahc_linux_device *dev = scsi_transport_device_data(cmd->device);
@@ -548,6 +548,8 @@ ahc_linux_queue(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *))
548 return rtn; 548 return rtn;
549} 549}
550 550
551static DEF_SCSI_QCMD(ahc_linux_queue)
552
551static inline struct scsi_target ** 553static inline struct scsi_target **
552ahc_linux_target_in_softc(struct scsi_target *starget) 554ahc_linux_target_in_softc(struct scsi_target *starget)
553{ 555{
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index aee73fafccc8..4ff60a08df0f 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -10234,7 +10234,7 @@ static void aic7xxx_buildscb(struct aic7xxx_host *p, struct scsi_cmnd *cmd,
10234 * Description: 10234 * Description:
10235 * Queue a SCB to the controller. 10235 * Queue a SCB to the controller.
10236 *-F*************************************************************************/ 10236 *-F*************************************************************************/
10237static int aic7xxx_queue(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *)) 10237static int aic7xxx_queue_lck(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *))
10238{ 10238{
10239 struct aic7xxx_host *p; 10239 struct aic7xxx_host *p;
10240 struct aic7xxx_scb *scb; 10240 struct aic7xxx_scb *scb;
@@ -10292,6 +10292,8 @@ static int aic7xxx_queue(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *))
10292 return (0); 10292 return (0);
10293} 10293}
10294 10294
10295static DEF_SCSI_QCMD(aic7xxx_queue)
10296
10295/*+F************************************************************************* 10297/*+F*************************************************************************
10296 * Function: 10298 * Function:
10297 * aic7xxx_bus_device_reset 10299 * aic7xxx_bus_device_reset
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 05a78e515a24..17e3df4f016f 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -85,8 +85,7 @@ static int arcmsr_abort(struct scsi_cmnd *);
85static int arcmsr_bus_reset(struct scsi_cmnd *); 85static int arcmsr_bus_reset(struct scsi_cmnd *);
86static int arcmsr_bios_param(struct scsi_device *sdev, 86static int arcmsr_bios_param(struct scsi_device *sdev,
87 struct block_device *bdev, sector_t capacity, int *info); 87 struct block_device *bdev, sector_t capacity, int *info);
88static int arcmsr_queue_command(struct scsi_cmnd *cmd, 88static int arcmsr_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd);
89 void (*done) (struct scsi_cmnd *));
90static int arcmsr_probe(struct pci_dev *pdev, 89static int arcmsr_probe(struct pci_dev *pdev,
91 const struct pci_device_id *id); 90 const struct pci_device_id *id);
92static void arcmsr_remove(struct pci_dev *pdev); 91static void arcmsr_remove(struct pci_dev *pdev);
@@ -2081,7 +2080,7 @@ static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb,
2081 } 2080 }
2082} 2081}
2083 2082
2084static int arcmsr_queue_command(struct scsi_cmnd *cmd, 2083static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd,
2085 void (* done)(struct scsi_cmnd *)) 2084 void (* done)(struct scsi_cmnd *))
2086{ 2085{
2087 struct Scsi_Host *host = cmd->device->host; 2086 struct Scsi_Host *host = cmd->device->host;
@@ -2124,6 +2123,8 @@ static int arcmsr_queue_command(struct scsi_cmnd *cmd,
2124 return 0; 2123 return 0;
2125} 2124}
2126 2125
2126static DEF_SCSI_QCMD(arcmsr_queue_command)
2127
2127static bool arcmsr_get_hba_config(struct AdapterControlBlock *acb) 2128static bool arcmsr_get_hba_config(struct AdapterControlBlock *acb)
2128{ 2129{
2129 struct MessageUnit_A __iomem *reg = acb->pmuA; 2130 struct MessageUnit_A __iomem *reg = acb->pmuA;
diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c
index 918ccf818757..ec166726b314 100644
--- a/drivers/scsi/arm/acornscsi.c
+++ b/drivers/scsi/arm/acornscsi.c
@@ -2511,7 +2511,7 @@ acornscsi_intr(int irq, void *dev_id)
2511 * done - function called on completion, with pointer to command descriptor 2511 * done - function called on completion, with pointer to command descriptor
2512 * Returns : 0, or < 0 on error. 2512 * Returns : 0, or < 0 on error.
2513 */ 2513 */
2514int acornscsi_queuecmd(struct scsi_cmnd *SCpnt, 2514static int acornscsi_queuecmd_lck(struct scsi_cmnd *SCpnt,
2515 void (*done)(struct scsi_cmnd *)) 2515 void (*done)(struct scsi_cmnd *))
2516{ 2516{
2517 AS_Host *host = (AS_Host *)SCpnt->device->host->hostdata; 2517 AS_Host *host = (AS_Host *)SCpnt->device->host->hostdata;
@@ -2561,6 +2561,8 @@ int acornscsi_queuecmd(struct scsi_cmnd *SCpnt,
2561 return 0; 2561 return 0;
2562} 2562}
2563 2563
2564DEF_SCSI_QCMD(acornscsi_queuecmd)
2565
2564/* 2566/*
2565 * Prototype: void acornscsi_reportstatus(struct scsi_cmnd **SCpntp1, struct scsi_cmnd **SCpntp2, int result) 2567 * Prototype: void acornscsi_reportstatus(struct scsi_cmnd **SCpntp1, struct scsi_cmnd **SCpntp2, int result)
2566 * Purpose : pass a result to *SCpntp1, and check if *SCpntp1 = *SCpntp2 2568 * Purpose : pass a result to *SCpntp1, and check if *SCpntp1 = *SCpntp2
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index 9e71ac611146..2b2ce21e227e 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -2198,7 +2198,7 @@ no_command:
2198 * Returns: 0 on success, else error. 2198 * Returns: 0 on success, else error.
2199 * Notes: io_request_lock is held, interrupts are disabled. 2199 * Notes: io_request_lock is held, interrupts are disabled.
2200 */ 2200 */
2201int fas216_queue_command(struct scsi_cmnd *SCpnt, 2201static int fas216_queue_command_lck(struct scsi_cmnd *SCpnt,
2202 void (*done)(struct scsi_cmnd *)) 2202 void (*done)(struct scsi_cmnd *))
2203{ 2203{
2204 FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; 2204 FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata;
@@ -2240,6 +2240,8 @@ int fas216_queue_command(struct scsi_cmnd *SCpnt,
2240 return result; 2240 return result;
2241} 2241}
2242 2242
2243DEF_SCSI_QCMD(fas216_queue_command)
2244
2243/** 2245/**
2244 * fas216_internal_done - trigger restart of a waiting thread in fas216_noqueue_command 2246 * fas216_internal_done - trigger restart of a waiting thread in fas216_noqueue_command
2245 * @SCpnt: Command to wake 2247 * @SCpnt: Command to wake
@@ -2263,7 +2265,7 @@ static void fas216_internal_done(struct scsi_cmnd *SCpnt)
2263 * Returns: scsi result code. 2265 * Returns: scsi result code.
2264 * Notes: io_request_lock is held, interrupts are disabled. 2266 * Notes: io_request_lock is held, interrupts are disabled.
2265 */ 2267 */
2266int fas216_noqueue_command(struct scsi_cmnd *SCpnt, 2268static int fas216_noqueue_command_lck(struct scsi_cmnd *SCpnt,
2267 void (*done)(struct scsi_cmnd *)) 2269 void (*done)(struct scsi_cmnd *))
2268{ 2270{
2269 FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata; 2271 FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata;
@@ -2277,7 +2279,7 @@ int fas216_noqueue_command(struct scsi_cmnd *SCpnt,
2277 BUG_ON(info->scsi.irq != NO_IRQ); 2279 BUG_ON(info->scsi.irq != NO_IRQ);
2278 2280
2279 info->internal_done = 0; 2281 info->internal_done = 0;
2280 fas216_queue_command(SCpnt, fas216_internal_done); 2282 fas216_queue_command_lck(SCpnt, fas216_internal_done);
2281 2283
2282 /* 2284 /*
2283 * This wastes time, since we can't return until the command is 2285 * This wastes time, since we can't return until the command is
@@ -2310,6 +2312,8 @@ int fas216_noqueue_command(struct scsi_cmnd *SCpnt,
2310 return 0; 2312 return 0;
2311} 2313}
2312 2314
2315DEF_SCSI_QCMD(fas216_noqueue_command)
2316
2313/* 2317/*
2314 * Error handler timeout function. Indicate that we timed out, 2318 * Error handler timeout function. Indicate that we timed out,
2315 * and wake up any error handler process so it can continue. 2319 * and wake up any error handler process so it can continue.
diff --git a/drivers/scsi/arm/fas216.h b/drivers/scsi/arm/fas216.h
index b65f4cf0eec9..377cfb72cc66 100644
--- a/drivers/scsi/arm/fas216.h
+++ b/drivers/scsi/arm/fas216.h
@@ -331,23 +331,21 @@ extern int fas216_init (struct Scsi_Host *instance);
331 */ 331 */
332extern int fas216_add (struct Scsi_Host *instance, struct device *dev); 332extern int fas216_add (struct Scsi_Host *instance, struct device *dev);
333 333
334/* Function: int fas216_queue_command(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 334/* Function: int fas216_queue_command(struct Scsi_Host *h, struct scsi_cmnd *SCpnt)
335 * Purpose : queue a command for adapter to process. 335 * Purpose : queue a command for adapter to process.
336 * Params : SCpnt - Command to queue 336 * Params : h - host adapter
337 * done - done function to call once command is complete 337 * : SCpnt - Command to queue
338 * Returns : 0 - success, else error 338 * Returns : 0 - success, else error
339 */ 339 */
340extern int fas216_queue_command(struct scsi_cmnd *, 340extern int fas216_queue_command(struct Scsi_Host *h, struct scsi_cmnd *SCpnt);
341 void (*done)(struct scsi_cmnd *));
342 341
343/* Function: int fas216_noqueue_command(istruct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 342/* Function: int fas216_noqueue_command(struct Scsi_Host *h, struct scsi_cmnd *SCpnt)
344 * Purpose : queue a command for adapter to process, and process it to completion. 343 * Purpose : queue a command for adapter to process, and process it to completion.
345 * Params : SCpnt - Command to queue 344 * Params : h - host adapter
346 * done - done function to call once command is complete 345 * : SCpnt - Command to queue
347 * Returns : 0 - success, else error 346 * Returns : 0 - success, else error
348 */ 347 */
349extern int fas216_noqueue_command(struct scsi_cmnd *, 348extern int fas216_noqueue_command(struct Scsi_Host *, struct scsi_cmnd *)
350 void (*done)(struct scsi_cmnd *));
351 349
352/* Function: irqreturn_t fas216_intr (FAS216_Info *info) 350/* Function: irqreturn_t fas216_intr (FAS216_Info *info)
353 * Purpose : handle interrupts from the interface to progress a command 351 * Purpose : handle interrupts from the interface to progress a command
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 158ebc3644d8..88b2928b4d3b 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -910,7 +910,7 @@ static int __init NCR5380_init(struct Scsi_Host *instance, int flags)
910 * 910 *
911 */ 911 */
912 912
913static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) 913static int NCR5380_queue_command_lck(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
914{ 914{
915 SETUP_HOSTDATA(cmd->device->host); 915 SETUP_HOSTDATA(cmd->device->host);
916 Scsi_Cmnd *tmp; 916 Scsi_Cmnd *tmp;
@@ -1022,6 +1022,8 @@ static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
1022 return 0; 1022 return 0;
1023} 1023}
1024 1024
1025static DEF_SCSI_QCMD(NCR5380_queue_command)
1026
1025/* 1027/*
1026 * Function : NCR5380_main (void) 1028 * Function : NCR5380_main (void)
1027 * 1029 *
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index ad7a23aef0ec..3e8658e2f154 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -572,23 +572,6 @@ static void falcon_get_lock(void)
572} 572}
573 573
574 574
575/* This is the wrapper function for NCR5380_queue_command(). It just
576 * tries to get the lock on the ST-DMA (see above) and then calls the
577 * original function.
578 */
579
580#if 0
581int atari_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
582{
583 /* falcon_get_lock();
584 * ++guenther: moved to NCR5380_queue_command() to prevent
585 * race condition, see there for an explanation.
586 */
587 return NCR5380_queue_command(cmd, done);
588}
589#endif
590
591
592int __init atari_scsi_detect(struct scsi_host_template *host) 575int __init atari_scsi_detect(struct scsi_host_template *host)
593{ 576{
594 static int called = 0; 577 static int called = 0;
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index ab5bdda6903e..76029d570beb 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -605,7 +605,7 @@ handled:
605 * 605 *
606 * Queue a command to the ATP queue. Called with the host lock held. 606 * Queue a command to the ATP queue. Called with the host lock held.
607 */ 607 */
608static int atp870u_queuecommand(struct scsi_cmnd * req_p, 608static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,
609 void (*done) (struct scsi_cmnd *)) 609 void (*done) (struct scsi_cmnd *))
610{ 610{
611 unsigned char c; 611 unsigned char c;
@@ -694,6 +694,8 @@ static int atp870u_queuecommand(struct scsi_cmnd * req_p,
694 return 0; 694 return 0;
695} 695}
696 696
697static DEF_SCSI_QCMD(atp870u_queuecommand)
698
697/** 699/**
698 * send_s870 - send a command to the controller 700 * send_s870 - send a command to the controller
699 * @host: host 701 * @host: host
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 8daa716739d1..8ca967dee66d 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -30,8 +30,7 @@ DEFINE_IDR(bfad_im_port_index);
30struct scsi_transport_template *bfad_im_scsi_transport_template; 30struct scsi_transport_template *bfad_im_scsi_transport_template;
31struct scsi_transport_template *bfad_im_scsi_vport_transport_template; 31struct scsi_transport_template *bfad_im_scsi_vport_transport_template;
32static void bfad_im_itnim_work_handler(struct work_struct *work); 32static void bfad_im_itnim_work_handler(struct work_struct *work);
33static int bfad_im_queuecommand(struct scsi_cmnd *cmnd, 33static int bfad_im_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmnd);
34 void (*done)(struct scsi_cmnd *));
35static int bfad_im_slave_alloc(struct scsi_device *sdev); 34static int bfad_im_slave_alloc(struct scsi_device *sdev);
36static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, 35static void bfad_im_fc_rport_add(struct bfad_im_port_s *im_port,
37 struct bfad_itnim_s *itnim); 36 struct bfad_itnim_s *itnim);
@@ -1120,7 +1119,7 @@ bfad_im_itnim_work_handler(struct work_struct *work)
1120 * Scsi_Host template entry, queue a SCSI command to the BFAD. 1119 * Scsi_Host template entry, queue a SCSI command to the BFAD.
1121 */ 1120 */
1122static int 1121static int
1123bfad_im_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) 1122bfad_im_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
1124{ 1123{
1125 struct bfad_im_port_s *im_port = 1124 struct bfad_im_port_s *im_port =
1126 (struct bfad_im_port_s *) cmnd->device->host->hostdata[0]; 1125 (struct bfad_im_port_s *) cmnd->device->host->hostdata[0];
@@ -1187,6 +1186,8 @@ out_fail_cmd:
1187 return 0; 1186 return 0;
1188} 1187}
1189 1188
1189static DEF_SCSI_QCMD(bfad_im_queuecommand)
1190
1190void 1191void
1191bfad_os_rport_online_wait(struct bfad_s *bfad) 1192bfad_os_rport_online_wait(struct bfad_s *bfad)
1192{ 1193{
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 54f50b07dac7..8f1b5c8bf903 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -1080,7 +1080,7 @@ static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb,
1080 * and is expected to be held on return. 1080 * and is expected to be held on return.
1081 * 1081 *
1082 **/ 1082 **/
1083static int dc395x_queue_command(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 1083static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
1084{ 1084{
1085 struct DeviceCtlBlk *dcb; 1085 struct DeviceCtlBlk *dcb;
1086 struct ScsiReqBlk *srb; 1086 struct ScsiReqBlk *srb;
@@ -1154,6 +1154,7 @@ complete:
1154 return 0; 1154 return 0;
1155} 1155}
1156 1156
1157static DEF_SCSI_QCMD(dc395x_queue_command)
1157 1158
1158/* 1159/*
1159 * Return the disk geometry for the given SCSI device. 1160 * Return the disk geometry for the given SCSI device.
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 23dec0063385..cffcb108ac96 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -423,7 +423,7 @@ static int adpt_slave_configure(struct scsi_device * device)
423 return 0; 423 return 0;
424} 424}
425 425
426static int adpt_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *)) 426static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *))
427{ 427{
428 adpt_hba* pHba = NULL; 428 adpt_hba* pHba = NULL;
429 struct adpt_device* pDev = NULL; /* dpt per device information */ 429 struct adpt_device* pDev = NULL; /* dpt per device information */
@@ -491,6 +491,8 @@ static int adpt_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *))
491 return adpt_scsi_to_i2o(pHba, cmd, pDev); 491 return adpt_scsi_to_i2o(pHba, cmd, pDev);
492} 492}
493 493
494static DEF_SCSI_QCMD(adpt_queue)
495
494static int adpt_bios_param(struct scsi_device *sdev, struct block_device *dev, 496static int adpt_bios_param(struct scsi_device *sdev, struct block_device *dev,
495 sector_t capacity, int geom[]) 497 sector_t capacity, int geom[])
496{ 498{
diff --git a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h
index 337746d46043..beded716f93f 100644
--- a/drivers/scsi/dpti.h
+++ b/drivers/scsi/dpti.h
@@ -29,7 +29,7 @@
29 */ 29 */
30 30
31static int adpt_detect(struct scsi_host_template * sht); 31static int adpt_detect(struct scsi_host_template * sht);
32static int adpt_queue(struct scsi_cmnd * cmd, void (*cmdcomplete) (struct scsi_cmnd *)); 32static int adpt_queue(struct Scsi_Host *h, struct scsi_cmnd * cmd);
33static int adpt_abort(struct scsi_cmnd * cmd); 33static int adpt_abort(struct scsi_cmnd * cmd);
34static int adpt_reset(struct scsi_cmnd* cmd); 34static int adpt_reset(struct scsi_cmnd* cmd);
35static int adpt_release(struct Scsi_Host *host); 35static int adpt_release(struct Scsi_Host *host);
diff --git a/drivers/scsi/dtc.h b/drivers/scsi/dtc.h
index 0b205f8c7326..cdc621204b66 100644
--- a/drivers/scsi/dtc.h
+++ b/drivers/scsi/dtc.h
@@ -36,7 +36,7 @@ static int dtc_abort(Scsi_Cmnd *);
36static int dtc_biosparam(struct scsi_device *, struct block_device *, 36static int dtc_biosparam(struct scsi_device *, struct block_device *,
37 sector_t, int*); 37 sector_t, int*);
38static int dtc_detect(struct scsi_host_template *); 38static int dtc_detect(struct scsi_host_template *);
39static int dtc_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 39static int dtc_queue_command(struct Scsi_Host *, struct scsi_cmnd *);
40static int dtc_bus_reset(Scsi_Cmnd *); 40static int dtc_bus_reset(Scsi_Cmnd *);
41 41
42#ifndef CMD_PER_LUN 42#ifndef CMD_PER_LUN
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index d1c31378f6da..53925ac178fd 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -505,8 +505,7 @@
505 505
506static int eata2x_detect(struct scsi_host_template *); 506static int eata2x_detect(struct scsi_host_template *);
507static int eata2x_release(struct Scsi_Host *); 507static int eata2x_release(struct Scsi_Host *);
508static int eata2x_queuecommand(struct scsi_cmnd *, 508static int eata2x_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
509 void (*done) (struct scsi_cmnd *));
510static int eata2x_eh_abort(struct scsi_cmnd *); 509static int eata2x_eh_abort(struct scsi_cmnd *);
511static int eata2x_eh_host_reset(struct scsi_cmnd *); 510static int eata2x_eh_host_reset(struct scsi_cmnd *);
512static int eata2x_bios_param(struct scsi_device *, struct block_device *, 511static int eata2x_bios_param(struct scsi_device *, struct block_device *,
@@ -1758,7 +1757,7 @@ static void scsi_to_dev_dir(unsigned int i, struct hostdata *ha)
1758 1757
1759} 1758}
1760 1759
1761static int eata2x_queuecommand(struct scsi_cmnd *SCpnt, 1760static int eata2x_queuecommand_lck(struct scsi_cmnd *SCpnt,
1762 void (*done) (struct scsi_cmnd *)) 1761 void (*done) (struct scsi_cmnd *))
1763{ 1762{
1764 struct Scsi_Host *shost = SCpnt->device->host; 1763 struct Scsi_Host *shost = SCpnt->device->host;
@@ -1843,6 +1842,8 @@ static int eata2x_queuecommand(struct scsi_cmnd *SCpnt,
1843 return 0; 1842 return 0;
1844} 1843}
1845 1844
1845static DEF_SCSI_QCMD(eata2x_queuecommand)
1846
1846static int eata2x_eh_abort(struct scsi_cmnd *SCarg) 1847static int eata2x_eh_abort(struct scsi_cmnd *SCarg)
1847{ 1848{
1848 struct Scsi_Host *shost = SCarg->device->host; 1849 struct Scsi_Host *shost = SCarg->device->host;
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c
index 60886c19065e..4a9641e69f54 100644
--- a/drivers/scsi/eata_pio.c
+++ b/drivers/scsi/eata_pio.c
@@ -335,7 +335,7 @@ static inline unsigned int eata_pio_send_command(unsigned long base, unsigned ch
335 return 0; 335 return 0;
336} 336}
337 337
338static int eata_pio_queue(struct scsi_cmnd *cmd, 338static int eata_pio_queue_lck(struct scsi_cmnd *cmd,
339 void (*done)(struct scsi_cmnd *)) 339 void (*done)(struct scsi_cmnd *))
340{ 340{
341 unsigned int x, y; 341 unsigned int x, y;
@@ -438,6 +438,8 @@ static int eata_pio_queue(struct scsi_cmnd *cmd,
438 return 0; 438 return 0;
439} 439}
440 440
441static DEF_SCSI_QCMD(eata_pio_queue)
442
441static int eata_pio_abort(struct scsi_cmnd *cmd) 443static int eata_pio_abort(struct scsi_cmnd *cmd)
442{ 444{
443 unsigned int loop = 100; 445 unsigned int loop = 100;
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index e2bc779f86c1..57558523c1b8 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -916,7 +916,7 @@ static void esp_event_queue_full(struct esp *esp, struct esp_cmd_entry *ent)
916 scsi_track_queue_full(dev, lp->num_tagged - 1); 916 scsi_track_queue_full(dev, lp->num_tagged - 1);
917} 917}
918 918
919static int esp_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 919static int esp_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
920{ 920{
921 struct scsi_device *dev = cmd->device; 921 struct scsi_device *dev = cmd->device;
922 struct esp *esp = shost_priv(dev->host); 922 struct esp *esp = shost_priv(dev->host);
@@ -941,6 +941,8 @@ static int esp_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd
941 return 0; 941 return 0;
942} 942}
943 943
944static DEF_SCSI_QCMD(esp_queuecommand)
945
944static int esp_check_gross_error(struct esp *esp) 946static int esp_check_gross_error(struct esp *esp)
945{ 947{
946 if (esp->sreg & ESP_STAT_SPAM) { 948 if (esp->sreg & ESP_STAT_SPAM) {
diff --git a/drivers/scsi/fd_mcs.c b/drivers/scsi/fd_mcs.c
index 2ad95aa8f585..a2c6135d337e 100644
--- a/drivers/scsi/fd_mcs.c
+++ b/drivers/scsi/fd_mcs.c
@@ -1072,7 +1072,7 @@ static int fd_mcs_release(struct Scsi_Host *shpnt)
1072 return 0; 1072 return 0;
1073} 1073}
1074 1074
1075static int fd_mcs_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) 1075static int fd_mcs_queue_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
1076{ 1076{
1077 struct Scsi_Host *shpnt = SCpnt->device->host; 1077 struct Scsi_Host *shpnt = SCpnt->device->host;
1078 1078
@@ -1122,6 +1122,8 @@ static int fd_mcs_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
1122 return 0; 1122 return 0;
1123} 1123}
1124 1124
1125static DEF_SCSI_QCMD(fd_mcs_queue)
1126
1125#if DEBUG_ABORT || DEBUG_RESET 1127#if DEBUG_ABORT || DEBUG_RESET
1126static void fd_mcs_print_info(Scsi_Cmnd * SCpnt) 1128static void fd_mcs_print_info(Scsi_Cmnd * SCpnt)
1127{ 1129{
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index e296bcc57d5c..69b7aa54f43f 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -1419,7 +1419,7 @@ static irqreturn_t do_fdomain_16x0_intr(int irq, void *dev_id)
1419 return IRQ_HANDLED; 1419 return IRQ_HANDLED;
1420} 1420}
1421 1421
1422static int fdomain_16x0_queue(struct scsi_cmnd *SCpnt, 1422static int fdomain_16x0_queue_lck(struct scsi_cmnd *SCpnt,
1423 void (*done)(struct scsi_cmnd *)) 1423 void (*done)(struct scsi_cmnd *))
1424{ 1424{
1425 if (in_command) { 1425 if (in_command) {
@@ -1469,6 +1469,8 @@ static int fdomain_16x0_queue(struct scsi_cmnd *SCpnt,
1469 return 0; 1469 return 0;
1470} 1470}
1471 1471
1472static DEF_SCSI_QCMD(fdomain_16x0_queue)
1473
1472#if DEBUG_ABORT 1474#if DEBUG_ABORT
1473static void print_info(struct scsi_cmnd *SCpnt) 1475static void print_info(struct scsi_cmnd *SCpnt)
1474{ 1476{
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index cbb20b13b228..92f185081e62 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -246,7 +246,7 @@ void fnic_set_port_id(struct fc_lport *, u32, struct fc_frame *);
246void fnic_update_mac(struct fc_lport *, u8 *new); 246void fnic_update_mac(struct fc_lport *, u8 *new);
247void fnic_update_mac_locked(struct fnic *, u8 *new); 247void fnic_update_mac_locked(struct fnic *, u8 *new);
248 248
249int fnic_queuecommand(struct scsi_cmnd *, void (*done)(struct scsi_cmnd *)); 249int fnic_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
250int fnic_abort_cmd(struct scsi_cmnd *); 250int fnic_abort_cmd(struct scsi_cmnd *);
251int fnic_device_reset(struct scsi_cmnd *); 251int fnic_device_reset(struct scsi_cmnd *);
252int fnic_host_reset(struct scsi_cmnd *); 252int fnic_host_reset(struct scsi_cmnd *);
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 198cbab3e894..22d02404d15f 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -349,7 +349,7 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
349 * Routine to send a scsi cdb 349 * Routine to send a scsi cdb
350 * Called with host_lock held and interrupts disabled. 350 * Called with host_lock held and interrupts disabled.
351 */ 351 */
352int fnic_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) 352static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
353{ 353{
354 struct fc_lport *lp; 354 struct fc_lport *lp;
355 struct fc_rport *rport; 355 struct fc_rport *rport;
@@ -457,6 +457,8 @@ out:
457 return ret; 457 return ret;
458} 458}
459 459
460DEF_SCSI_QCMD(fnic_queuecommand)
461
460/* 462/*
461 * fnic_fcpio_fw_reset_cmpl_handler 463 * fnic_fcpio_fw_reset_cmpl_handler
462 * Routine to handle fw reset completion 464 * Routine to handle fw reset completion
diff --git a/drivers/scsi/g_NCR5380.h b/drivers/scsi/g_NCR5380.h
index 921764c9ab24..1bcdb7beb77b 100644
--- a/drivers/scsi/g_NCR5380.h
+++ b/drivers/scsi/g_NCR5380.h
@@ -46,7 +46,7 @@
46static int generic_NCR5380_abort(Scsi_Cmnd *); 46static int generic_NCR5380_abort(Scsi_Cmnd *);
47static int generic_NCR5380_detect(struct scsi_host_template *); 47static int generic_NCR5380_detect(struct scsi_host_template *);
48static int generic_NCR5380_release_resources(struct Scsi_Host *); 48static int generic_NCR5380_release_resources(struct Scsi_Host *);
49static int generic_NCR5380_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 49static int generic_NCR5380_queue_command(struct Scsi_Host *, struct scsi_cmnd *);
50static int generic_NCR5380_bus_reset(Scsi_Cmnd *); 50static int generic_NCR5380_bus_reset(Scsi_Cmnd *);
51static const char* generic_NCR5380_info(struct Scsi_Host *); 51static const char* generic_NCR5380_info(struct Scsi_Host *);
52 52
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 841101846b88..76365700e2d5 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -185,7 +185,7 @@ static long gdth_unlocked_ioctl(struct file *filep, unsigned int cmd,
185 unsigned long arg); 185 unsigned long arg);
186 186
187static void gdth_flush(gdth_ha_str *ha); 187static void gdth_flush(gdth_ha_str *ha);
188static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *)); 188static int gdth_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmd);
189static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp, 189static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp,
190 struct gdth_cmndinfo *cmndinfo); 190 struct gdth_cmndinfo *cmndinfo);
191static void gdth_scsi_done(struct scsi_cmnd *scp); 191static void gdth_scsi_done(struct scsi_cmnd *scp);
@@ -4004,7 +4004,7 @@ static int gdth_bios_param(struct scsi_device *sdev,struct block_device *bdev,se
4004} 4004}
4005 4005
4006 4006
4007static int gdth_queuecommand(struct scsi_cmnd *scp, 4007static int gdth_queuecommand_lck(struct scsi_cmnd *scp,
4008 void (*done)(struct scsi_cmnd *)) 4008 void (*done)(struct scsi_cmnd *))
4009{ 4009{
4010 gdth_ha_str *ha = shost_priv(scp->device->host); 4010 gdth_ha_str *ha = shost_priv(scp->device->host);
@@ -4022,6 +4022,8 @@ static int gdth_queuecommand(struct scsi_cmnd *scp,
4022 return __gdth_queuecommand(ha, scp, cmndinfo); 4022 return __gdth_queuecommand(ha, scp, cmndinfo);
4023} 4023}
4024 4024
4025static DEF_SCSI_QCMD(gdth_queuecommand)
4026
4025static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp, 4027static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp,
4026 struct gdth_cmndinfo *cmndinfo) 4028 struct gdth_cmndinfo *cmndinfo)
4027{ 4029{
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index c5d0606ad097..3759d1199b0c 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -143,8 +143,7 @@ static void fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
143 void *buff, size_t size, u8 page_code, unsigned char *scsi3addr, 143 void *buff, size_t size, u8 page_code, unsigned char *scsi3addr,
144 int cmd_type); 144 int cmd_type);
145 145
146static int hpsa_scsi_queue_command(struct scsi_cmnd *cmd, 146static int hpsa_scsi_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd);
147 void (*done)(struct scsi_cmnd *));
148static void hpsa_scan_start(struct Scsi_Host *); 147static void hpsa_scan_start(struct Scsi_Host *);
149static int hpsa_scan_finished(struct Scsi_Host *sh, 148static int hpsa_scan_finished(struct Scsi_Host *sh,
150 unsigned long elapsed_time); 149 unsigned long elapsed_time);
@@ -1926,7 +1925,7 @@ sglist_finished:
1926} 1925}
1927 1926
1928 1927
1929static int hpsa_scsi_queue_command(struct scsi_cmnd *cmd, 1928static int hpsa_scsi_queue_command_lck(struct scsi_cmnd *cmd,
1930 void (*done)(struct scsi_cmnd *)) 1929 void (*done)(struct scsi_cmnd *))
1931{ 1930{
1932 struct ctlr_info *h; 1931 struct ctlr_info *h;
@@ -2020,6 +2019,8 @@ static int hpsa_scsi_queue_command(struct scsi_cmnd *cmd,
2020 return 0; 2019 return 0;
2021} 2020}
2022 2021
2022static DEF_SCSI_QCMD(hpsa_scsi_queue_command)
2023
2023static void hpsa_scan_start(struct Scsi_Host *sh) 2024static void hpsa_scan_start(struct Scsi_Host *sh)
2024{ 2025{
2025 struct ctlr_info *h = shost_to_hba(sh); 2026 struct ctlr_info *h = shost_to_hba(sh);
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 0729f150b33a..10b65556937b 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -751,7 +751,7 @@ static void hptiop_post_req_mv(struct hptiop_hba *hba,
751 MVIOP_MU_QUEUE_ADDR_HOST_BIT | size_bit, hba); 751 MVIOP_MU_QUEUE_ADDR_HOST_BIT | size_bit, hba);
752} 752}
753 753
754static int hptiop_queuecommand(struct scsi_cmnd *scp, 754static int hptiop_queuecommand_lck(struct scsi_cmnd *scp,
755 void (*done)(struct scsi_cmnd *)) 755 void (*done)(struct scsi_cmnd *))
756{ 756{
757 struct Scsi_Host *host = scp->device->host; 757 struct Scsi_Host *host = scp->device->host;
@@ -819,6 +819,8 @@ cmd_done:
819 return 0; 819 return 0;
820} 820}
821 821
822static DEF_SCSI_QCMD(hptiop_queuecommand)
823
822static const char *hptiop_info(struct Scsi_Host *host) 824static const char *hptiop_info(struct Scsi_Host *host)
823{ 825{
824 return driver_name_long; 826 return driver_name_long;
diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c
index 9a4b69d4f4eb..67fc8ffd52e6 100644
--- a/drivers/scsi/ibmmca.c
+++ b/drivers/scsi/ibmmca.c
@@ -39,7 +39,7 @@
39#include <scsi/scsi_host.h> 39#include <scsi/scsi_host.h>
40 40
41/* Common forward declarations for all Linux-versions: */ 41/* Common forward declarations for all Linux-versions: */
42static int ibmmca_queuecommand (Scsi_Cmnd *, void (*done) (Scsi_Cmnd *)); 42static int ibmmca_queuecommand (struct Scsi_Host *, struct scsi_cmnd *);
43static int ibmmca_abort (Scsi_Cmnd *); 43static int ibmmca_abort (Scsi_Cmnd *);
44static int ibmmca_host_reset (Scsi_Cmnd *); 44static int ibmmca_host_reset (Scsi_Cmnd *);
45static int ibmmca_biosparam (struct scsi_device *, struct block_device *, sector_t, int *); 45static int ibmmca_biosparam (struct scsi_device *, struct block_device *, sector_t, int *);
@@ -1691,7 +1691,7 @@ static int __devexit ibmmca_remove(struct device *dev)
1691} 1691}
1692 1692
1693/* The following routine is the SCSI command queue for the midlevel driver */ 1693/* The following routine is the SCSI command queue for the midlevel driver */
1694static int ibmmca_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) 1694static int ibmmca_queuecommand_lck(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
1695{ 1695{
1696 unsigned int ldn; 1696 unsigned int ldn;
1697 unsigned int scsi_cmd; 1697 unsigned int scsi_cmd;
@@ -1996,6 +1996,8 @@ static int ibmmca_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
1996 return 0; 1996 return 0;
1997} 1997}
1998 1998
1999static DEF_SCSI_QCMD(ibmmca_queuecommand)
2000
1999static int __ibmmca_abort(Scsi_Cmnd * cmd) 2001static int __ibmmca_abort(Scsi_Cmnd * cmd)
2000{ 2002{
2001 /* Abort does not work, as the adapter never generates an interrupt on 2003 /* Abort does not work, as the adapter never generates an interrupt on
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 00d08b25425f..57cad7e20caa 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -1606,7 +1606,7 @@ static inline int ibmvfc_host_chkready(struct ibmvfc_host *vhost)
1606 * Returns: 1606 * Returns:
1607 * 0 on success / other on failure 1607 * 0 on success / other on failure
1608 **/ 1608 **/
1609static int ibmvfc_queuecommand(struct scsi_cmnd *cmnd, 1609static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd,
1610 void (*done) (struct scsi_cmnd *)) 1610 void (*done) (struct scsi_cmnd *))
1611{ 1611{
1612 struct ibmvfc_host *vhost = shost_priv(cmnd->device->host); 1612 struct ibmvfc_host *vhost = shost_priv(cmnd->device->host);
@@ -1672,6 +1672,8 @@ static int ibmvfc_queuecommand(struct scsi_cmnd *cmnd,
1672 return 0; 1672 return 0;
1673} 1673}
1674 1674
1675static DEF_SCSI_QCMD(ibmvfc_queuecommand)
1676
1675/** 1677/**
1676 * ibmvfc_sync_completion - Signal that a synchronous command has completed 1678 * ibmvfc_sync_completion - Signal that a synchronous command has completed
1677 * @evt: ibmvfc event struct 1679 * @evt: ibmvfc event struct
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 67f78a470f5f..041958453e2a 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -713,7 +713,7 @@ static inline u16 lun_from_dev(struct scsi_device *dev)
713 * @cmd: struct scsi_cmnd to be executed 713 * @cmd: struct scsi_cmnd to be executed
714 * @done: Callback function to be called when cmd is completed 714 * @done: Callback function to be called when cmd is completed
715*/ 715*/
716static int ibmvscsi_queuecommand(struct scsi_cmnd *cmnd, 716static int ibmvscsi_queuecommand_lck(struct scsi_cmnd *cmnd,
717 void (*done) (struct scsi_cmnd *)) 717 void (*done) (struct scsi_cmnd *))
718{ 718{
719 struct srp_cmd *srp_cmd; 719 struct srp_cmd *srp_cmd;
@@ -766,6 +766,8 @@ static int ibmvscsi_queuecommand(struct scsi_cmnd *cmnd,
766 return ibmvscsi_send_srp_event(evt_struct, hostdata, 0); 766 return ibmvscsi_send_srp_event(evt_struct, hostdata, 0);
767} 767}
768 768
769static DEF_SCSI_QCMD(ibmvscsi_queuecommand)
770
769/* ------------------------------------------------------------ 771/* ------------------------------------------------------------
770 * Routines for driver initialization 772 * Routines for driver initialization
771 */ 773 */
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c
index 4734ab0b3ff6..99aa0e5699bc 100644
--- a/drivers/scsi/imm.c
+++ b/drivers/scsi/imm.c
@@ -926,7 +926,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd)
926 return 0; 926 return 0;
927} 927}
928 928
929static int imm_queuecommand(struct scsi_cmnd *cmd, 929static int imm_queuecommand_lck(struct scsi_cmnd *cmd,
930 void (*done)(struct scsi_cmnd *)) 930 void (*done)(struct scsi_cmnd *))
931{ 931{
932 imm_struct *dev = imm_dev(cmd->device->host); 932 imm_struct *dev = imm_dev(cmd->device->host);
@@ -949,6 +949,8 @@ static int imm_queuecommand(struct scsi_cmnd *cmd,
949 return 0; 949 return 0;
950} 950}
951 951
952static DEF_SCSI_QCMD(imm_queuecommand)
953
952/* 954/*
953 * Apparently the disk->capacity attribute is off by 1 sector 955 * Apparently the disk->capacity attribute is off by 1 sector
954 * for all disk drives. We add the one here, but it should really 956 * for all disk drives. We add the one here, but it should really
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
index 52bdc6df6b92..6568aab745a0 100644
--- a/drivers/scsi/in2000.c
+++ b/drivers/scsi/in2000.c
@@ -334,7 +334,7 @@ static uchar calc_sync_xfer(unsigned int period, unsigned int offset)
334 334
335static void in2000_execute(struct Scsi_Host *instance); 335static void in2000_execute(struct Scsi_Host *instance);
336 336
337static int in2000_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) 337static int in2000_queuecommand_lck(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
338{ 338{
339 struct Scsi_Host *instance; 339 struct Scsi_Host *instance;
340 struct IN2000_hostdata *hostdata; 340 struct IN2000_hostdata *hostdata;
@@ -431,6 +431,8 @@ static int in2000_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
431 return 0; 431 return 0;
432} 432}
433 433
434static DEF_SCSI_QCMD(in2000_queuecommand)
435
434 436
435 437
436/* 438/*
diff --git a/drivers/scsi/in2000.h b/drivers/scsi/in2000.h
index 0fb8b06b8392..5821e1fbce08 100644
--- a/drivers/scsi/in2000.h
+++ b/drivers/scsi/in2000.h
@@ -396,7 +396,7 @@ struct IN2000_hostdata {
396 flags) 396 flags)
397 397
398static int in2000_detect(struct scsi_host_template *) in2000__INIT; 398static int in2000_detect(struct scsi_host_template *) in2000__INIT;
399static int in2000_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 399static int in2000_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
400static int in2000_abort(Scsi_Cmnd *); 400static int in2000_abort(Scsi_Cmnd *);
401static void in2000_setup(char *, int *) in2000__INIT; 401static void in2000_setup(char *, int *) in2000__INIT;
402static int in2000_biosparam(struct scsi_device *, struct block_device *, 402static int in2000_biosparam(struct scsi_device *, struct block_device *,
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index 108797761b95..9627d062e16b 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -2639,7 +2639,7 @@ static void initio_build_scb(struct initio_host * host, struct scsi_ctrl_blk * c
2639 * will cause the mid layer to call us again later with the command) 2639 * will cause the mid layer to call us again later with the command)
2640 */ 2640 */
2641 2641
2642static int i91u_queuecommand(struct scsi_cmnd *cmd, 2642static int i91u_queuecommand_lck(struct scsi_cmnd *cmd,
2643 void (*done)(struct scsi_cmnd *)) 2643 void (*done)(struct scsi_cmnd *))
2644{ 2644{
2645 struct initio_host *host = (struct initio_host *) cmd->device->host->hostdata; 2645 struct initio_host *host = (struct initio_host *) cmd->device->host->hostdata;
@@ -2656,6 +2656,8 @@ static int i91u_queuecommand(struct scsi_cmnd *cmd,
2656 return 0; 2656 return 0;
2657} 2657}
2658 2658
2659static DEF_SCSI_QCMD(i91u_queuecommand)
2660
2659/** 2661/**
2660 * i91u_bus_reset - reset the SCSI bus 2662 * i91u_bus_reset - reset the SCSI bus
2661 * @cmnd: Command block we want to trigger the reset for 2663 * @cmnd: Command block we want to trigger the reset for
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index fa60d7df44be..5bbaee597e88 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -5709,7 +5709,7 @@ static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd)
5709 * SCSI_MLQUEUE_DEVICE_BUSY if device is busy 5709 * SCSI_MLQUEUE_DEVICE_BUSY if device is busy
5710 * SCSI_MLQUEUE_HOST_BUSY if host is busy 5710 * SCSI_MLQUEUE_HOST_BUSY if host is busy
5711 **/ 5711 **/
5712static int ipr_queuecommand(struct scsi_cmnd *scsi_cmd, 5712static int ipr_queuecommand_lck(struct scsi_cmnd *scsi_cmd,
5713 void (*done) (struct scsi_cmnd *)) 5713 void (*done) (struct scsi_cmnd *))
5714{ 5714{
5715 struct ipr_ioa_cfg *ioa_cfg; 5715 struct ipr_ioa_cfg *ioa_cfg;
@@ -5792,6 +5792,8 @@ static int ipr_queuecommand(struct scsi_cmnd *scsi_cmd,
5792 return 0; 5792 return 0;
5793} 5793}
5794 5794
5795static DEF_SCSI_QCMD(ipr_queuecommand)
5796
5795/** 5797/**
5796 * ipr_ioctl - IOCTL handler 5798 * ipr_ioctl - IOCTL handler
5797 * @sdev: scsi device struct 5799 * @sdev: scsi device struct
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index f83a116955f2..b2511acd39bd 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -232,7 +232,7 @@ static int ips_detect(struct scsi_host_template *);
232static int ips_release(struct Scsi_Host *); 232static int ips_release(struct Scsi_Host *);
233static int ips_eh_abort(struct scsi_cmnd *); 233static int ips_eh_abort(struct scsi_cmnd *);
234static int ips_eh_reset(struct scsi_cmnd *); 234static int ips_eh_reset(struct scsi_cmnd *);
235static int ips_queue(struct scsi_cmnd *, void (*)(struct scsi_cmnd *)); 235static int ips_queue(struct Scsi_Host *, struct scsi_cmnd *);
236static const char *ips_info(struct Scsi_Host *); 236static const char *ips_info(struct Scsi_Host *);
237static irqreturn_t do_ipsintr(int, void *); 237static irqreturn_t do_ipsintr(int, void *);
238static int ips_hainit(ips_ha_t *); 238static int ips_hainit(ips_ha_t *);
@@ -1046,7 +1046,7 @@ static int ips_eh_reset(struct scsi_cmnd *SC)
1046/* Linux obtains io_request_lock before calling this function */ 1046/* Linux obtains io_request_lock before calling this function */
1047/* */ 1047/* */
1048/****************************************************************************/ 1048/****************************************************************************/
1049static int ips_queue(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)) 1049static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *))
1050{ 1050{
1051 ips_ha_t *ha; 1051 ips_ha_t *ha;
1052 ips_passthru_t *pt; 1052 ips_passthru_t *pt;
@@ -1137,6 +1137,8 @@ static int ips_queue(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *))
1137 return (0); 1137 return (0);
1138} 1138}
1139 1139
1140static DEF_SCSI_QCMD(ips_queue)
1141
1140/****************************************************************************/ 1142/****************************************************************************/
1141/* */ 1143/* */
1142/* Routine Name: ips_biosparam */ 1144/* Routine Name: ips_biosparam */
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index e340373b509b..2924363d142b 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -1753,7 +1753,7 @@ static inline int fc_fcp_lport_queue_ready(struct fc_lport *lport)
1753 * This is the i/o strategy routine, called by the SCSI layer. This routine 1753 * This is the i/o strategy routine, called by the SCSI layer. This routine
1754 * is called with the host_lock held. 1754 * is called with the host_lock held.
1755 */ 1755 */
1756int fc_queuecommand(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *)) 1756static int fc_queuecommand_lck(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *))
1757{ 1757{
1758 struct fc_lport *lport; 1758 struct fc_lport *lport;
1759 struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device)); 1759 struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device));
@@ -1851,6 +1851,8 @@ out:
1851 spin_lock_irq(lport->host->host_lock); 1851 spin_lock_irq(lport->host->host_lock);
1852 return rc; 1852 return rc;
1853} 1853}
1854
1855DEF_SCSI_QCMD(fc_queuecommand)
1854EXPORT_SYMBOL(fc_queuecommand); 1856EXPORT_SYMBOL(fc_queuecommand);
1855 1857
1856/** 1858/**
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 633e09036357..c15fde808c33 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1599,7 +1599,7 @@ enum {
1599 FAILURE_SESSION_NOT_READY, 1599 FAILURE_SESSION_NOT_READY,
1600}; 1600};
1601 1601
1602int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) 1602static int iscsi_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
1603{ 1603{
1604 struct iscsi_cls_session *cls_session; 1604 struct iscsi_cls_session *cls_session;
1605 struct Scsi_Host *host; 1605 struct Scsi_Host *host;
@@ -1736,6 +1736,8 @@ fault:
1736 spin_lock(host->host_lock); 1736 spin_lock(host->host_lock);
1737 return 0; 1737 return 0;
1738} 1738}
1739
1740DEF_SCSI_QCMD(iscsi_queuecommand)
1739EXPORT_SYMBOL_GPL(iscsi_queuecommand); 1741EXPORT_SYMBOL_GPL(iscsi_queuecommand);
1740 1742
1741int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, int reason) 1743int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, int reason)
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 55f09e92ab59..29251fabecc6 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -189,7 +189,7 @@ int sas_queue_up(struct sas_task *task)
189 * Note: XXX: Remove the host unlock/lock pair when SCSI Core can 189 * Note: XXX: Remove the host unlock/lock pair when SCSI Core can
190 * call us without holding an IRQ spinlock... 190 * call us without holding an IRQ spinlock...
191 */ 191 */
192int sas_queuecommand(struct scsi_cmnd *cmd, 192static int sas_queuecommand_lck(struct scsi_cmnd *cmd,
193 void (*scsi_done)(struct scsi_cmnd *)) 193 void (*scsi_done)(struct scsi_cmnd *))
194 __releases(host->host_lock) 194 __releases(host->host_lock)
195 __acquires(dev->sata_dev.ap->lock) 195 __acquires(dev->sata_dev.ap->lock)
@@ -254,6 +254,8 @@ out:
254 return res; 254 return res;
255} 255}
256 256
257DEF_SCSI_QCMD(sas_queuecommand)
258
257static void sas_eh_finish_cmd(struct scsi_cmnd *cmd) 259static void sas_eh_finish_cmd(struct scsi_cmnd *cmd)
258{ 260{
259 struct sas_task *task = TO_SAS_TASK(cmd); 261 struct sas_task *task = TO_SAS_TASK(cmd);
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index f64b65a770b8..581837b3c71a 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -2899,7 +2899,7 @@ void lpfc_poll_timeout(unsigned long ptr)
2899 * SCSI_MLQUEUE_HOST_BUSY - Block all devices served by this host temporarily. 2899 * SCSI_MLQUEUE_HOST_BUSY - Block all devices served by this host temporarily.
2900 **/ 2900 **/
2901static int 2901static int
2902lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *)) 2902lpfc_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
2903{ 2903{
2904 struct Scsi_Host *shost = cmnd->device->host; 2904 struct Scsi_Host *shost = cmnd->device->host;
2905 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; 2905 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
@@ -3060,6 +3060,8 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
3060 return 0; 3060 return 0;
3061} 3061}
3062 3062
3063static DEF_SCSI_QCMD(lpfc_queuecommand)
3064
3063/** 3065/**
3064 * lpfc_abort_handler - scsi_host_template eh_abort_handler entry point 3066 * lpfc_abort_handler - scsi_host_template eh_abort_handler entry point
3065 * @cmnd: Pointer to scsi_cmnd data structure. 3067 * @cmnd: Pointer to scsi_cmnd data structure.
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c
index 3ddb4dc62d5d..6c42dff0f4d3 100644
--- a/drivers/scsi/mac53c94.c
+++ b/drivers/scsi/mac53c94.c
@@ -66,7 +66,7 @@ static void cmd_done(struct fsc_state *, int result);
66static void set_dma_cmds(struct fsc_state *, struct scsi_cmnd *); 66static void set_dma_cmds(struct fsc_state *, struct scsi_cmnd *);
67 67
68 68
69static int mac53c94_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 69static int mac53c94_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
70{ 70{
71 struct fsc_state *state; 71 struct fsc_state *state;
72 72
@@ -99,6 +99,8 @@ static int mac53c94_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *
99 return 0; 99 return 0;
100} 100}
101 101
102static DEF_SCSI_QCMD(mac53c94_queue)
103
102static int mac53c94_host_reset(struct scsi_cmnd *cmd) 104static int mac53c94_host_reset(struct scsi_cmnd *cmd)
103{ 105{
104 struct fsc_state *state = (struct fsc_state *) cmd->device->host->hostdata; 106 struct fsc_state *state = (struct fsc_state *) cmd->device->host->hostdata;
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 7ceb5cf12c6b..9aa048525eb2 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -366,7 +366,7 @@ mega_runpendq(adapter_t *adapter)
366 * The command queuing entry point for the mid-layer. 366 * The command queuing entry point for the mid-layer.
367 */ 367 */
368static int 368static int
369megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *)) 369megaraid_queue_lck(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
370{ 370{
371 adapter_t *adapter; 371 adapter_t *adapter;
372 scb_t *scb; 372 scb_t *scb;
@@ -409,6 +409,8 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
409 return busy; 409 return busy;
410} 410}
411 411
412static DEF_SCSI_QCMD(megaraid_queue)
413
412/** 414/**
413 * mega_allocate_scb() 415 * mega_allocate_scb()
414 * @adapter - pointer to our soft state 416 * @adapter - pointer to our soft state
@@ -4456,7 +4458,7 @@ mega_internal_command(adapter_t *adapter, megacmd_t *mc, mega_passthru *pthru)
4456 4458
4457 scb->idx = CMDID_INT_CMDS; 4459 scb->idx = CMDID_INT_CMDS;
4458 4460
4459 megaraid_queue(scmd, mega_internal_done); 4461 megaraid_queue_lck(scmd, mega_internal_done);
4460 4462
4461 wait_for_completion(&adapter->int_waitq); 4463 wait_for_completion(&adapter->int_waitq);
4462 4464
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h
index 2b4a048cadf1..f5644745e24e 100644
--- a/drivers/scsi/megaraid.h
+++ b/drivers/scsi/megaraid.h
@@ -987,7 +987,7 @@ static int mega_query_adapter(adapter_t *);
987static int issue_scb(adapter_t *, scb_t *); 987static int issue_scb(adapter_t *, scb_t *);
988static int mega_setup_mailbox(adapter_t *); 988static int mega_setup_mailbox(adapter_t *);
989 989
990static int megaraid_queue (Scsi_Cmnd *, void (*)(Scsi_Cmnd *)); 990static int megaraid_queue (struct Scsi_Host *, struct scsi_cmnd *);
991static scb_t * mega_build_cmd(adapter_t *, Scsi_Cmnd *, int *); 991static scb_t * mega_build_cmd(adapter_t *, Scsi_Cmnd *, int *);
992static void __mega_runpendq(adapter_t *); 992static void __mega_runpendq(adapter_t *);
993static int issue_scb_block(adapter_t *, u_char *); 993static int issue_scb_block(adapter_t *, u_char *);
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index a7810a106b37..5708cb27d078 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -113,8 +113,7 @@ static int megaraid_mbox_fire_sync_cmd(adapter_t *);
113static void megaraid_mbox_display_scb(adapter_t *, scb_t *); 113static void megaraid_mbox_display_scb(adapter_t *, scb_t *);
114static void megaraid_mbox_setup_device_map(adapter_t *); 114static void megaraid_mbox_setup_device_map(adapter_t *);
115 115
116static int megaraid_queue_command(struct scsi_cmnd *, 116static int megaraid_queue_command(struct Scsi_Host *, struct scsi_cmnd *);
117 void (*)(struct scsi_cmnd *));
118static scb_t *megaraid_mbox_build_cmd(adapter_t *, struct scsi_cmnd *, int *); 117static scb_t *megaraid_mbox_build_cmd(adapter_t *, struct scsi_cmnd *, int *);
119static void megaraid_mbox_runpendq(adapter_t *, scb_t *); 118static void megaraid_mbox_runpendq(adapter_t *, scb_t *);
120static void megaraid_mbox_prepare_pthru(adapter_t *, scb_t *, 119static void megaraid_mbox_prepare_pthru(adapter_t *, scb_t *,
@@ -1484,7 +1483,7 @@ mbox_post_cmd(adapter_t *adapter, scb_t *scb)
1484 * Queue entry point for mailbox based controllers. 1483 * Queue entry point for mailbox based controllers.
1485 */ 1484 */
1486static int 1485static int
1487megaraid_queue_command(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *)) 1486megaraid_queue_command_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *))
1488{ 1487{
1489 adapter_t *adapter; 1488 adapter_t *adapter;
1490 scb_t *scb; 1489 scb_t *scb;
@@ -1513,6 +1512,8 @@ megaraid_queue_command(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *))
1513 return if_busy; 1512 return if_busy;
1514} 1513}
1515 1514
1515static DEF_SCSI_QCMD(megaraid_queue_command)
1516
1516/** 1517/**
1517 * megaraid_mbox_build_cmd - transform the mid-layer scsi commands 1518 * megaraid_mbox_build_cmd - transform the mid-layer scsi commands
1518 * @adapter : controller's soft state 1519 * @adapter : controller's soft state
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index eb29d5085131..7451bc096a01 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -1334,7 +1334,7 @@ megasas_dump_pending_frames(struct megasas_instance *instance)
1334 * @done: Callback entry point 1334 * @done: Callback entry point
1335 */ 1335 */
1336static int 1336static int
1337megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) 1337megasas_queue_command_lck(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *))
1338{ 1338{
1339 u32 frame_count; 1339 u32 frame_count;
1340 struct megasas_cmd *cmd; 1340 struct megasas_cmd *cmd;
@@ -1417,6 +1417,8 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *))
1417 return 0; 1417 return 0;
1418} 1418}
1419 1419
1420static DEF_SCSI_QCMD(megasas_queue_command)
1421
1420static struct megasas_instance *megasas_lookup_instance(u16 host_no) 1422static struct megasas_instance *megasas_lookup_instance(u16 host_no)
1421{ 1423{
1422 int i; 1424 int i;
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index 1f784fde2510..197aa1b3f0f3 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -1627,7 +1627,7 @@ static void cmd_complete(struct mesh_state *ms)
1627 * Called by midlayer with host locked to queue a new 1627 * Called by midlayer with host locked to queue a new
1628 * request 1628 * request
1629 */ 1629 */
1630static int mesh_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 1630static int mesh_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
1631{ 1631{
1632 struct mesh_state *ms; 1632 struct mesh_state *ms;
1633 1633
@@ -1648,6 +1648,8 @@ static int mesh_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
1648 return 0; 1648 return 0;
1649} 1649}
1650 1650
1651static DEF_SCSI_QCMD(mesh_queue)
1652
1651/* 1653/*
1652 * Called to handle interrupts, either call by the interrupt 1654 * Called to handle interrupts, either call by the interrupt
1653 * handler (do_mesh_interrupt) or by other functions in 1655 * handler (do_mesh_interrupt) or by other functions in
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 16e99b686354..1a96a00418a4 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -3315,7 +3315,7 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 ioc_status)
3315 * SCSI_MLQUEUE_HOST_BUSY if the entire host queue is full 3315 * SCSI_MLQUEUE_HOST_BUSY if the entire host queue is full
3316 */ 3316 */
3317static int 3317static int
3318_scsih_qcmd(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *)) 3318_scsih_qcmd_lck(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
3319{ 3319{
3320 struct MPT2SAS_ADAPTER *ioc = shost_priv(scmd->device->host); 3320 struct MPT2SAS_ADAPTER *ioc = shost_priv(scmd->device->host);
3321 struct MPT2SAS_DEVICE *sas_device_priv_data; 3321 struct MPT2SAS_DEVICE *sas_device_priv_data;
@@ -3441,6 +3441,8 @@ _scsih_qcmd(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
3441 return SCSI_MLQUEUE_HOST_BUSY; 3441 return SCSI_MLQUEUE_HOST_BUSY;
3442} 3442}
3443 3443
3444static DEF_SCSI_QCMD(_scsih_qcmd)
3445
3444/** 3446/**
3445 * _scsih_normalize_sense - normalize descriptor and fixed format sense data 3447 * _scsih_normalize_sense - normalize descriptor and fixed format sense data
3446 * @sense_buffer: sense data returned by target 3448 * @sense_buffer: sense data returned by target
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index d013a2aa2fd5..46cc3825638d 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -8029,7 +8029,7 @@ static int ncr53c8xx_slave_configure(struct scsi_device *device)
8029 return 0; 8029 return 0;
8030} 8030}
8031 8031
8032static int ncr53c8xx_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) 8032static int ncr53c8xx_queue_command_lck (struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
8033{ 8033{
8034 struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb; 8034 struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb;
8035 unsigned long flags; 8035 unsigned long flags;
@@ -8068,6 +8068,8 @@ printk("ncr53c8xx : command successfully queued\n");
8068 return sts; 8068 return sts;
8069} 8069}
8070 8070
8071static DEF_SCSI_QCMD(ncr53c8xx_queue_command)
8072
8071irqreturn_t ncr53c8xx_intr(int irq, void *dev_id) 8073irqreturn_t ncr53c8xx_intr(int irq, void *dev_id)
8072{ 8074{
8073 unsigned long flags; 8075 unsigned long flags;
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 4c1e54545200..6b8b021400f8 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -196,8 +196,7 @@ static void __exit exit_nsp32 (void);
196static int nsp32_proc_info (struct Scsi_Host *, char *, char **, off_t, int, int); 196static int nsp32_proc_info (struct Scsi_Host *, char *, char **, off_t, int, int);
197 197
198static int nsp32_detect (struct pci_dev *pdev); 198static int nsp32_detect (struct pci_dev *pdev);
199static int nsp32_queuecommand(struct scsi_cmnd *, 199static int nsp32_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
200 void (*done)(struct scsi_cmnd *));
201static const char *nsp32_info (struct Scsi_Host *); 200static const char *nsp32_info (struct Scsi_Host *);
202static int nsp32_release (struct Scsi_Host *); 201static int nsp32_release (struct Scsi_Host *);
203 202
@@ -909,7 +908,7 @@ static int nsp32_setup_sg_table(struct scsi_cmnd *SCpnt)
909 return TRUE; 908 return TRUE;
910} 909}
911 910
912static int nsp32_queuecommand(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 911static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
913{ 912{
914 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata; 913 nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
915 nsp32_target *target; 914 nsp32_target *target;
@@ -1050,6 +1049,8 @@ static int nsp32_queuecommand(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
1050 return 0; 1049 return 0;
1051} 1050}
1052 1051
1052static DEF_SCSI_QCMD(nsp32_queuecommand)
1053
1053/* initialize asic */ 1054/* initialize asic */
1054static int nsp32hw_init(nsp32_hw_data *data) 1055static int nsp32hw_init(nsp32_hw_data *data)
1055{ 1056{
diff --git a/drivers/scsi/pas16.h b/drivers/scsi/pas16.h
index 8dc5b1a5f5da..a04281cace2e 100644
--- a/drivers/scsi/pas16.h
+++ b/drivers/scsi/pas16.h
@@ -118,7 +118,7 @@ static int pas16_abort(Scsi_Cmnd *);
118static int pas16_biosparam(struct scsi_device *, struct block_device *, 118static int pas16_biosparam(struct scsi_device *, struct block_device *,
119 sector_t, int*); 119 sector_t, int*);
120static int pas16_detect(struct scsi_host_template *); 120static int pas16_detect(struct scsi_host_template *);
121static int pas16_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 121static int pas16_queue_command(struct Scsi_Host *, struct scsi_cmnd *);
122static int pas16_bus_reset(Scsi_Cmnd *); 122static int pas16_bus_reset(Scsi_Cmnd *);
123 123
124#ifndef CMD_PER_LUN 124#ifndef CMD_PER_LUN
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 9326c2c14880..be3f33d31a99 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -184,7 +184,7 @@ static void nsp_scsi_done(struct scsi_cmnd *SCpnt)
184 SCpnt->scsi_done(SCpnt); 184 SCpnt->scsi_done(SCpnt);
185} 185}
186 186
187static int nsp_queuecommand(struct scsi_cmnd *SCpnt, 187static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt,
188 void (*done)(struct scsi_cmnd *)) 188 void (*done)(struct scsi_cmnd *))
189{ 189{
190#ifdef NSP_DEBUG 190#ifdef NSP_DEBUG
@@ -264,6 +264,8 @@ static int nsp_queuecommand(struct scsi_cmnd *SCpnt,
264 return 0; 264 return 0;
265} 265}
266 266
267static DEF_SCSI_QCMD(nsp_queuecommand)
268
267/* 269/*
268 * setup PIO FIFO transfer mode and enable/disable to data out 270 * setup PIO FIFO transfer mode and enable/disable to data out
269 */ 271 */
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h
index d68c9f267c5e..7fc9a9d0a448 100644
--- a/drivers/scsi/pcmcia/nsp_cs.h
+++ b/drivers/scsi/pcmcia/nsp_cs.h
@@ -299,8 +299,7 @@ static int nsp_proc_info (
299 off_t offset, 299 off_t offset,
300 int length, 300 int length,
301 int inout); 301 int inout);
302static int nsp_queuecommand(struct scsi_cmnd *SCpnt, 302static int nsp_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *SCpnt);
303 void (* done)(struct scsi_cmnd *SCpnt));
304 303
305/* Error handler */ 304/* Error handler */
306/*static int nsp_eh_abort (struct scsi_cmnd *SCpnt);*/ 305/*static int nsp_eh_abort (struct scsi_cmnd *SCpnt);*/
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index 0ae27cb5cd6f..8552296edaa1 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -547,7 +547,7 @@ SYM53C500_info(struct Scsi_Host *SChost)
547} 547}
548 548
549static int 549static int
550SYM53C500_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) 550SYM53C500_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
551{ 551{
552 int i; 552 int i;
553 int port_base = SCpnt->device->host->io_port; 553 int port_base = SCpnt->device->host->io_port;
@@ -583,6 +583,8 @@ SYM53C500_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
583 return 0; 583 return 0;
584} 584}
585 585
586static DEF_SCSI_QCMD(SYM53C500_queue)
587
586static int 588static int
587SYM53C500_host_reset(struct scsi_cmnd *SCpnt) 589SYM53C500_host_reset(struct scsi_cmnd *SCpnt)
588{ 590{
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index cf89091e4c3d..5e76a624cb08 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -3478,7 +3478,7 @@ static int pmcraid_copy_sglist(
3478 * SCSI_MLQUEUE_DEVICE_BUSY if device is busy 3478 * SCSI_MLQUEUE_DEVICE_BUSY if device is busy
3479 * SCSI_MLQUEUE_HOST_BUSY if host is busy 3479 * SCSI_MLQUEUE_HOST_BUSY if host is busy
3480 */ 3480 */
3481static int pmcraid_queuecommand( 3481static int pmcraid_queuecommand_lck(
3482 struct scsi_cmnd *scsi_cmd, 3482 struct scsi_cmnd *scsi_cmd,
3483 void (*done) (struct scsi_cmnd *) 3483 void (*done) (struct scsi_cmnd *)
3484) 3484)
@@ -3584,6 +3584,8 @@ static int pmcraid_queuecommand(
3584 return rc; 3584 return rc;
3585} 3585}
3586 3586
3587static DEF_SCSI_QCMD(pmcraid_queuecommand)
3588
3587/** 3589/**
3588 * pmcraid_open -char node "open" entry, allowed only users with admin access 3590 * pmcraid_open -char node "open" entry, allowed only users with admin access
3589 */ 3591 */
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
index 7bc2d796e403..d164c9639361 100644
--- a/drivers/scsi/ppa.c
+++ b/drivers/scsi/ppa.c
@@ -798,7 +798,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
798 return 0; 798 return 0;
799} 799}
800 800
801static int ppa_queuecommand(struct scsi_cmnd *cmd, 801static int ppa_queuecommand_lck(struct scsi_cmnd *cmd,
802 void (*done) (struct scsi_cmnd *)) 802 void (*done) (struct scsi_cmnd *))
803{ 803{
804 ppa_struct *dev = ppa_dev(cmd->device->host); 804 ppa_struct *dev = ppa_dev(cmd->device->host);
@@ -821,6 +821,8 @@ static int ppa_queuecommand(struct scsi_cmnd *cmd,
821 return 0; 821 return 0;
822} 822}
823 823
824static DEF_SCSI_QCMD(ppa_queuecommand)
825
824/* 826/*
825 * Apparently the disk->capacity attribute is off by 1 sector 827 * Apparently the disk->capacity attribute is off by 1 sector
826 * for all disk drives. We add the one here, but it should really 828 * for all disk drives. We add the one here, but it should really
diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c
index 92ffbb510498..cd178b9e40cd 100644
--- a/drivers/scsi/ps3rom.c
+++ b/drivers/scsi/ps3rom.c
@@ -211,7 +211,7 @@ static int ps3rom_write_request(struct ps3_storage_device *dev,
211 return 0; 211 return 0;
212} 212}
213 213
214static int ps3rom_queuecommand(struct scsi_cmnd *cmd, 214static int ps3rom_queuecommand_lck(struct scsi_cmnd *cmd,
215 void (*done)(struct scsi_cmnd *)) 215 void (*done)(struct scsi_cmnd *))
216{ 216{
217 struct ps3rom_private *priv = shost_priv(cmd->device->host); 217 struct ps3rom_private *priv = shost_priv(cmd->device->host);
@@ -260,6 +260,8 @@ static int ps3rom_queuecommand(struct scsi_cmnd *cmd,
260 return 0; 260 return 0;
261} 261}
262 262
263static DEF_SCSI_QCMD(ps3rom_queuecommand)
264
263static int decode_lv1_status(u64 status, unsigned char *sense_key, 265static int decode_lv1_status(u64 status, unsigned char *sense_key,
264 unsigned char *asc, unsigned char *ascq) 266 unsigned char *asc, unsigned char *ascq)
265{ 267{
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index b8166ecfd0e3..5dec684bf010 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -727,7 +727,7 @@ qla1280_info(struct Scsi_Host *host)
727 * context which is a big NO! NO!. 727 * context which is a big NO! NO!.
728 **************************************************************************/ 728 **************************************************************************/
729static int 729static int
730qla1280_queuecommand(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *)) 730qla1280_queuecommand_lck(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *))
731{ 731{
732 struct Scsi_Host *host = cmd->device->host; 732 struct Scsi_Host *host = cmd->device->host;
733 struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; 733 struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata;
@@ -756,6 +756,8 @@ qla1280_queuecommand(struct scsi_cmnd *cmd, void (*fn)(struct scsi_cmnd *))
756 return status; 756 return status;
757} 757}
758 758
759static DEF_SCSI_QCMD(qla1280_queuecommand)
760
759enum action { 761enum action {
760 ABORT_COMMAND, 762 ABORT_COMMAND,
761 DEVICE_RESET, 763 DEVICE_RESET,
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 1830e6e97315..1644eabaafeb 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -179,8 +179,7 @@ static int qla2xxx_slave_alloc(struct scsi_device *);
179static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time); 179static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time);
180static void qla2xxx_scan_start(struct Scsi_Host *); 180static void qla2xxx_scan_start(struct Scsi_Host *);
181static void qla2xxx_slave_destroy(struct scsi_device *); 181static void qla2xxx_slave_destroy(struct scsi_device *);
182static int qla2xxx_queuecommand(struct scsi_cmnd *cmd, 182static int qla2xxx_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmd);
183 void (*fn)(struct scsi_cmnd *));
184static int qla2xxx_eh_abort(struct scsi_cmnd *); 183static int qla2xxx_eh_abort(struct scsi_cmnd *);
185static int qla2xxx_eh_device_reset(struct scsi_cmnd *); 184static int qla2xxx_eh_device_reset(struct scsi_cmnd *);
186static int qla2xxx_eh_target_reset(struct scsi_cmnd *); 185static int qla2xxx_eh_target_reset(struct scsi_cmnd *);
@@ -535,7 +534,7 @@ qla2x00_get_new_sp(scsi_qla_host_t *vha, fc_port_t *fcport,
535} 534}
536 535
537static int 536static int
538qla2xxx_queuecommand(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 537qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
539{ 538{
540 scsi_qla_host_t *vha = shost_priv(cmd->device->host); 539 scsi_qla_host_t *vha = shost_priv(cmd->device->host);
541 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; 540 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
@@ -609,6 +608,8 @@ qc24_fail_command:
609 return 0; 608 return 0;
610} 609}
611 610
611static DEF_SCSI_QCMD(qla2xxx_queuecommand)
612
612 613
613/* 614/*
614 * qla2x00_eh_wait_on_command 615 * qla2x00_eh_wait_on_command
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index f4cd846abf6d..0d48fb4d1044 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -79,8 +79,7 @@ static enum blk_eh_timer_return qla4xxx_eh_cmd_timed_out(struct scsi_cmnd *sc);
79/* 79/*
80 * SCSI host template entry points 80 * SCSI host template entry points
81 */ 81 */
82static int qla4xxx_queuecommand(struct scsi_cmnd *cmd, 82static int qla4xxx_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmd);
83 void (*done) (struct scsi_cmnd *));
84static int qla4xxx_eh_abort(struct scsi_cmnd *cmd); 83static int qla4xxx_eh_abort(struct scsi_cmnd *cmd);
85static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd); 84static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd);
86static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd); 85static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd);
@@ -464,7 +463,7 @@ void qla4xxx_srb_compl(struct kref *ref)
464 * completion handling). Unfortunely, it sometimes calls the scheduler 463 * completion handling). Unfortunely, it sometimes calls the scheduler
465 * in interrupt context which is a big NO! NO!. 464 * in interrupt context which is a big NO! NO!.
466 **/ 465 **/
467static int qla4xxx_queuecommand(struct scsi_cmnd *cmd, 466static int qla4xxx_queuecommand_lck(struct scsi_cmnd *cmd,
468 void (*done)(struct scsi_cmnd *)) 467 void (*done)(struct scsi_cmnd *))
469{ 468{
470 struct scsi_qla_host *ha = to_qla_host(cmd->device->host); 469 struct scsi_qla_host *ha = to_qla_host(cmd->device->host);
@@ -538,6 +537,8 @@ qc_fail_command:
538 return 0; 537 return 0;
539} 538}
540 539
540static DEF_SCSI_QCMD(qla4xxx_queuecommand)
541
541/** 542/**
542 * qla4xxx_mem_free - frees memory allocated to adapter 543 * qla4xxx_mem_free - frees memory allocated to adapter
543 * @ha: Pointer to host adapter structure. 544 * @ha: Pointer to host adapter structure.
diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c
index 1ad51552d6b1..c3a9151ca823 100644
--- a/drivers/scsi/qlogicfas408.c
+++ b/drivers/scsi/qlogicfas408.c
@@ -439,7 +439,7 @@ irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id)
439 * Queued command 439 * Queued command
440 */ 440 */
441 441
442int qlogicfas408_queuecommand(struct scsi_cmnd *cmd, 442static int qlogicfas408_queuecommand_lck(struct scsi_cmnd *cmd,
443 void (*done) (struct scsi_cmnd *)) 443 void (*done) (struct scsi_cmnd *))
444{ 444{
445 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); 445 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
@@ -459,6 +459,8 @@ int qlogicfas408_queuecommand(struct scsi_cmnd *cmd,
459 return 0; 459 return 0;
460} 460}
461 461
462DEF_SCSI_QCMD(qlogicfas408_queuecommand)
463
462/* 464/*
463 * Return bios parameters 465 * Return bios parameters
464 */ 466 */
diff --git a/drivers/scsi/qlogicfas408.h b/drivers/scsi/qlogicfas408.h
index 260626427a32..2f6c0a166200 100644
--- a/drivers/scsi/qlogicfas408.h
+++ b/drivers/scsi/qlogicfas408.h
@@ -103,8 +103,7 @@ struct qlogicfas408_priv {
103#define get_priv_by_host(x) (struct qlogicfas408_priv *)&((x)->hostdata[0]) 103#define get_priv_by_host(x) (struct qlogicfas408_priv *)&((x)->hostdata[0])
104 104
105irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id); 105irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id);
106int qlogicfas408_queuecommand(struct scsi_cmnd * cmd, 106int qlogicfas408_queuecommand(struct Scsi_Host *h, struct scsi_cmnd * cmd);
107 void (*done) (struct scsi_cmnd *));
108int qlogicfas408_biosparam(struct scsi_device * disk, 107int qlogicfas408_biosparam(struct scsi_device * disk,
109 struct block_device *dev, 108 struct block_device *dev,
110 sector_t capacity, int ip[]); 109 sector_t capacity, int ip[]);
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index f8c561cf751e..664c9572d0c9 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -1003,7 +1003,7 @@ static int qlogicpti_slave_configure(struct scsi_device *sdev)
1003 * 1003 *
1004 * "This code must fly." -davem 1004 * "This code must fly." -davem
1005 */ 1005 */
1006static int qlogicpti_queuecommand(struct scsi_cmnd *Cmnd, void (*done)(struct scsi_cmnd *)) 1006static int qlogicpti_queuecommand_lck(struct scsi_cmnd *Cmnd, void (*done)(struct scsi_cmnd *))
1007{ 1007{
1008 struct Scsi_Host *host = Cmnd->device->host; 1008 struct Scsi_Host *host = Cmnd->device->host;
1009 struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata; 1009 struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata;
@@ -1052,6 +1052,8 @@ toss_command:
1052 return 1; 1052 return 1;
1053} 1053}
1054 1054
1055static DEF_SCSI_QCMD(qlogicpti_queuecommand)
1056
1055static int qlogicpti_return_status(struct Status_Entry *sts, int id) 1057static int qlogicpti_return_status(struct Status_Entry *sts, int id)
1056{ 1058{
1057 int host_status = DID_ERROR; 1059 int host_status = DID_ERROR;
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 348fba0a8976..2aeb2e9c4d3b 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -634,12 +634,13 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
634 * Description: a serial number identifies a request for error recovery 634 * Description: a serial number identifies a request for error recovery
635 * and debugging purposes. Protected by the Host_Lock of host. 635 * and debugging purposes. Protected by the Host_Lock of host.
636 */ 636 */
637static inline void scsi_cmd_get_serial(struct Scsi_Host *host, struct scsi_cmnd *cmd) 637void scsi_cmd_get_serial(struct Scsi_Host *host, struct scsi_cmnd *cmd)
638{ 638{
639 cmd->serial_number = host->cmd_serial_number++; 639 cmd->serial_number = host->cmd_serial_number++;
640 if (cmd->serial_number == 0) 640 if (cmd->serial_number == 0)
641 cmd->serial_number = host->cmd_serial_number++; 641 cmd->serial_number = host->cmd_serial_number++;
642} 642}
643EXPORT_SYMBOL(scsi_cmd_get_serial);
643 644
644/** 645/**
645 * scsi_dispatch_command - Dispatch a command to the low-level driver. 646 * scsi_dispatch_command - Dispatch a command to the low-level driver.
@@ -651,7 +652,6 @@ static inline void scsi_cmd_get_serial(struct Scsi_Host *host, struct scsi_cmnd
651int scsi_dispatch_cmd(struct scsi_cmnd *cmd) 652int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
652{ 653{
653 struct Scsi_Host *host = cmd->device->host; 654 struct Scsi_Host *host = cmd->device->host;
654 unsigned long flags = 0;
655 unsigned long timeout; 655 unsigned long timeout;
656 int rtn = 0; 656 int rtn = 0;
657 657
@@ -737,23 +737,15 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
737 goto out; 737 goto out;
738 } 738 }
739 739
740 spin_lock_irqsave(host->host_lock, flags);
741 /*
742 * AK: unlikely race here: for some reason the timer could
743 * expire before the serial number is set up below.
744 *
745 * TODO: kill serial or move to blk layer
746 */
747 scsi_cmd_get_serial(host, cmd);
748
749 if (unlikely(host->shost_state == SHOST_DEL)) { 740 if (unlikely(host->shost_state == SHOST_DEL)) {
750 cmd->result = (DID_NO_CONNECT << 16); 741 cmd->result = (DID_NO_CONNECT << 16);
751 scsi_done(cmd); 742 scsi_done(cmd);
752 } else { 743 } else {
753 trace_scsi_dispatch_cmd_start(cmd); 744 trace_scsi_dispatch_cmd_start(cmd);
754 rtn = host->hostt->queuecommand(cmd, scsi_done); 745 cmd->scsi_done = scsi_done;
746 rtn = host->hostt->queuecommand(host, cmd);
755 } 747 }
756 spin_unlock_irqrestore(host->host_lock, flags); 748
757 if (rtn) { 749 if (rtn) {
758 trace_scsi_dispatch_cmd_error(cmd, rtn); 750 trace_scsi_dispatch_cmd_error(cmd, rtn);
759 if (rtn != SCSI_MLQUEUE_DEVICE_BUSY && 751 if (rtn != SCSI_MLQUEUE_DEVICE_BUSY &&
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 2c36bae3bd4b..2f1f9b079b10 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3538,7 +3538,7 @@ static void sdebug_remove_adapter(void)
3538} 3538}
3539 3539
3540static 3540static
3541int scsi_debug_queuecommand(struct scsi_cmnd *SCpnt, done_funct_t done) 3541int scsi_debug_queuecommand_lck(struct scsi_cmnd *SCpnt, done_funct_t done)
3542{ 3542{
3543 unsigned char *cmd = (unsigned char *) SCpnt->cmnd; 3543 unsigned char *cmd = (unsigned char *) SCpnt->cmnd;
3544 int len, k; 3544 int len, k;
@@ -3884,6 +3884,8 @@ write:
3884 (delay_override ? 0 : scsi_debug_delay)); 3884 (delay_override ? 0 : scsi_debug_delay));
3885} 3885}
3886 3886
3887static DEF_SCSI_QCMD(scsi_debug_queuecommand)
3888
3887static struct scsi_host_template sdebug_driver_template = { 3889static struct scsi_host_template sdebug_driver_template = {
3888 .proc_info = scsi_debug_proc_info, 3890 .proc_info = scsi_debug_proc_info,
3889 .proc_name = sdebug_proc_name, 3891 .proc_name = sdebug_proc_name,
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index f3cf924a2cd9..824b8fc03ce5 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -773,17 +773,15 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
773 struct Scsi_Host *shost = sdev->host; 773 struct Scsi_Host *shost = sdev->host;
774 DECLARE_COMPLETION_ONSTACK(done); 774 DECLARE_COMPLETION_ONSTACK(done);
775 unsigned long timeleft; 775 unsigned long timeleft;
776 unsigned long flags;
777 struct scsi_eh_save ses; 776 struct scsi_eh_save ses;
778 int rtn; 777 int rtn;
779 778
780 scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes); 779 scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes);
781 shost->eh_action = &done; 780 shost->eh_action = &done;
782 781
783 spin_lock_irqsave(shost->host_lock, flags);
784 scsi_log_send(scmd); 782 scsi_log_send(scmd);
785 shost->hostt->queuecommand(scmd, scsi_eh_done); 783 scmd->scsi_done = scsi_eh_done;
786 spin_unlock_irqrestore(shost->host_lock, flags); 784 shost->hostt->queuecommand(shost, scmd);
787 785
788 timeleft = wait_for_completion_timeout(&done, timeout); 786 timeleft = wait_for_completion_timeout(&done, timeout);
789 787
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 9c73dbda3bbb..606215e54b88 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -572,7 +572,7 @@ stex_slave_destroy(struct scsi_device *sdev)
572} 572}
573 573
574static int 574static int
575stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) 575stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
576{ 576{
577 struct st_hba *hba; 577 struct st_hba *hba;
578 struct Scsi_Host *host; 578 struct Scsi_Host *host;
@@ -698,6 +698,8 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
698 return 0; 698 return 0;
699} 699}
700 700
701static DEF_SCSI_QCMD(stex_queuecommand)
702
701static void stex_scsi_done(struct st_ccb *ccb) 703static void stex_scsi_done(struct st_ccb *ccb)
702{ 704{
703 struct scsi_cmnd *cmd = ccb->cmd; 705 struct scsi_cmnd *cmd = ccb->cmd;
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c
index 713620ed70d9..4f0e5485ffde 100644
--- a/drivers/scsi/sun3_NCR5380.c
+++ b/drivers/scsi/sun3_NCR5380.c
@@ -908,7 +908,7 @@ static int NCR5380_init (struct Scsi_Host *instance, int flags)
908 */ 908 */
909 909
910/* Only make static if a wrapper function is used */ 910/* Only make static if a wrapper function is used */
911static int NCR5380_queue_command(struct scsi_cmnd *cmd, 911static int NCR5380_queue_command_lck(struct scsi_cmnd *cmd,
912 void (*done)(struct scsi_cmnd *)) 912 void (*done)(struct scsi_cmnd *))
913{ 913{
914 SETUP_HOSTDATA(cmd->device->host); 914 SETUP_HOSTDATA(cmd->device->host);
@@ -1019,6 +1019,8 @@ static int NCR5380_queue_command(struct scsi_cmnd *cmd,
1019 return 0; 1019 return 0;
1020} 1020}
1021 1021
1022static DEF_SCSI_QCMD(NCR5380_queue_command)
1023
1022/* 1024/*
1023 * Function : NCR5380_main (void) 1025 * Function : NCR5380_main (void)
1024 * 1026 *
diff --git a/drivers/scsi/sun3_scsi.h b/drivers/scsi/sun3_scsi.h
index b29a9d661ca4..bcefd8458e65 100644
--- a/drivers/scsi/sun3_scsi.h
+++ b/drivers/scsi/sun3_scsi.h
@@ -51,8 +51,7 @@ static int sun3scsi_abort(struct scsi_cmnd *);
51static int sun3scsi_detect (struct scsi_host_template *); 51static int sun3scsi_detect (struct scsi_host_template *);
52static const char *sun3scsi_info (struct Scsi_Host *); 52static const char *sun3scsi_info (struct Scsi_Host *);
53static int sun3scsi_bus_reset(struct scsi_cmnd *); 53static int sun3scsi_bus_reset(struct scsi_cmnd *);
54static int sun3scsi_queue_command(struct scsi_cmnd *, 54static int sun3scsi_queue_command(struct Scsi_Host *, struct scsi_cmnd *);
55 void (*done)(struct scsi_cmnd *));
56static int sun3scsi_release (struct Scsi_Host *); 55static int sun3scsi_release (struct Scsi_Host *);
57 56
58#ifndef CMD_PER_LUN 57#ifndef CMD_PER_LUN
diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c
index e5c369bb568f..190107ae120b 100644
--- a/drivers/scsi/sym53c416.c
+++ b/drivers/scsi/sym53c416.c
@@ -734,7 +734,7 @@ const char *sym53c416_info(struct Scsi_Host *SChost)
734 return info; 734 return info;
735} 735}
736 736
737int sym53c416_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) 737static int sym53c416_queuecommand_lck(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
738{ 738{
739 int base; 739 int base;
740 unsigned long flags = 0; 740 unsigned long flags = 0;
@@ -761,6 +761,8 @@ int sym53c416_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
761 return 0; 761 return 0;
762} 762}
763 763
764DEF_SCSI_QCMD(sym53c416_queuecommand)
765
764static int sym53c416_host_reset(Scsi_Cmnd *SCpnt) 766static int sym53c416_host_reset(Scsi_Cmnd *SCpnt)
765{ 767{
766 int base; 768 int base;
diff --git a/drivers/scsi/sym53c416.h b/drivers/scsi/sym53c416.h
index 77860d0748ff..387de5d80a70 100644
--- a/drivers/scsi/sym53c416.h
+++ b/drivers/scsi/sym53c416.h
@@ -25,7 +25,7 @@
25static int sym53c416_detect(struct scsi_host_template *); 25static int sym53c416_detect(struct scsi_host_template *);
26static const char *sym53c416_info(struct Scsi_Host *); 26static const char *sym53c416_info(struct Scsi_Host *);
27static int sym53c416_release(struct Scsi_Host *); 27static int sym53c416_release(struct Scsi_Host *);
28static int sym53c416_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); 28static int sym53c416_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
29static int sym53c416_host_reset(Scsi_Cmnd *); 29static int sym53c416_host_reset(Scsi_Cmnd *);
30static int sym53c416_bios_param(struct scsi_device *, struct block_device *, 30static int sym53c416_bios_param(struct scsi_device *, struct block_device *,
31 sector_t, int *); 31 sector_t, int *);
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 8b955b534a36..6b97ded9d45d 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -505,7 +505,7 @@ void sym_log_bus_error(struct Scsi_Host *shost)
505 * queuecommand method. Entered with the host adapter lock held and 505 * queuecommand method. Entered with the host adapter lock held and
506 * interrupts disabled. 506 * interrupts disabled.
507 */ 507 */
508static int sym53c8xx_queue_command(struct scsi_cmnd *cmd, 508static int sym53c8xx_queue_command_lck(struct scsi_cmnd *cmd,
509 void (*done)(struct scsi_cmnd *)) 509 void (*done)(struct scsi_cmnd *))
510{ 510{
511 struct sym_hcb *np = SYM_SOFTC_PTR(cmd); 511 struct sym_hcb *np = SYM_SOFTC_PTR(cmd);
@@ -536,6 +536,8 @@ static int sym53c8xx_queue_command(struct scsi_cmnd *cmd,
536 return 0; 536 return 0;
537} 537}
538 538
539static DEF_SCSI_QCMD(sym53c8xx_queue_command)
540
539/* 541/*
540 * Linux entry point of the interrupt handler. 542 * Linux entry point of the interrupt handler.
541 */ 543 */
diff --git a/drivers/scsi/t128.h b/drivers/scsi/t128.h
index 76a069b7ac0b..ada1115079c9 100644
--- a/drivers/scsi/t128.h
+++ b/drivers/scsi/t128.h
@@ -96,8 +96,7 @@ static int t128_abort(struct scsi_cmnd *);
96static int t128_biosparam(struct scsi_device *, struct block_device *, 96static int t128_biosparam(struct scsi_device *, struct block_device *,
97 sector_t, int*); 97 sector_t, int*);
98static int t128_detect(struct scsi_host_template *); 98static int t128_detect(struct scsi_host_template *);
99static int t128_queue_command(struct scsi_cmnd *, 99static int t128_queue_command(struct Scsi_Host *, struct scsi_cmnd *);
100 void (*done)(struct scsi_cmnd *));
101static int t128_bus_reset(struct scsi_cmnd *); 100static int t128_bus_reset(struct scsi_cmnd *);
102 101
103#ifndef CMD_PER_LUN 102#ifndef CMD_PER_LUN
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index 27866b0adfeb..a124a28f2ccb 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -1883,7 +1883,7 @@ dc390_ScsiRstDetect( struct dc390_acb* pACB )
1883 return; 1883 return;
1884} 1884}
1885 1885
1886static int DC390_queuecommand(struct scsi_cmnd *cmd, 1886static int DC390_queuecommand_lck(struct scsi_cmnd *cmd,
1887 void (*done)(struct scsi_cmnd *)) 1887 void (*done)(struct scsi_cmnd *))
1888{ 1888{
1889 struct scsi_device *sdev = cmd->device; 1889 struct scsi_device *sdev = cmd->device;
@@ -1944,6 +1944,8 @@ static int DC390_queuecommand(struct scsi_cmnd *cmd,
1944 return SCSI_MLQUEUE_DEVICE_BUSY; 1944 return SCSI_MLQUEUE_DEVICE_BUSY;
1945} 1945}
1946 1946
1947static DEF_SCSI_QCMD(DC390_queuecommand)
1948
1947static void dc390_dumpinfo (struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB) 1949static void dc390_dumpinfo (struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB)
1948{ 1950{
1949 struct pci_dev *pdev; 1951 struct pci_dev *pdev;
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index 5d9fdeeb2315..edfc5da8be4c 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -433,7 +433,7 @@
433 433
434static int u14_34f_detect(struct scsi_host_template *); 434static int u14_34f_detect(struct scsi_host_template *);
435static int u14_34f_release(struct Scsi_Host *); 435static int u14_34f_release(struct Scsi_Host *);
436static int u14_34f_queuecommand(struct scsi_cmnd *, void (*done)(struct scsi_cmnd *)); 436static int u14_34f_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
437static int u14_34f_eh_abort(struct scsi_cmnd *); 437static int u14_34f_eh_abort(struct scsi_cmnd *);
438static int u14_34f_eh_host_reset(struct scsi_cmnd *); 438static int u14_34f_eh_host_reset(struct scsi_cmnd *);
439static int u14_34f_bios_param(struct scsi_device *, struct block_device *, 439static int u14_34f_bios_param(struct scsi_device *, struct block_device *,
@@ -1248,7 +1248,7 @@ static void scsi_to_dev_dir(unsigned int i, unsigned int j) {
1248 1248
1249} 1249}
1250 1250
1251static int u14_34f_queuecommand(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) { 1251static int u14_34f_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) {
1252 unsigned int i, j, k; 1252 unsigned int i, j, k;
1253 struct mscp *cpp; 1253 struct mscp *cpp;
1254 1254
@@ -1329,6 +1329,8 @@ static int u14_34f_queuecommand(struct scsi_cmnd *SCpnt, void (*done)(struct scs
1329 return 0; 1329 return 0;
1330} 1330}
1331 1331
1332static DEF_SCSI_QCMD(u14_34f_queuecommand)
1333
1332static int u14_34f_eh_abort(struct scsi_cmnd *SCarg) { 1334static int u14_34f_eh_abort(struct scsi_cmnd *SCarg) {
1333 unsigned int i, j; 1335 unsigned int i, j;
1334 1336
diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c
index 27aa40f3980e..0571ef9639cb 100644
--- a/drivers/scsi/ultrastor.c
+++ b/drivers/scsi/ultrastor.c
@@ -700,7 +700,7 @@ static inline void build_sg_list(struct mscp *mscp, struct scsi_cmnd *SCpnt)
700 mscp->transfer_data_length = transfer_length; 700 mscp->transfer_data_length = transfer_length;
701} 701}
702 702
703static int ultrastor_queuecommand(struct scsi_cmnd *SCpnt, 703static int ultrastor_queuecommand_lck(struct scsi_cmnd *SCpnt,
704 void (*done) (struct scsi_cmnd *)) 704 void (*done) (struct scsi_cmnd *))
705{ 705{
706 struct mscp *my_mscp; 706 struct mscp *my_mscp;
@@ -825,6 +825,8 @@ retry:
825 return 0; 825 return 0;
826} 826}
827 827
828static DEF_SCSI_QCMD(ultrastor_queuecommand)
829
828/* This code must deal with 2 cases: 830/* This code must deal with 2 cases:
829 831
830 1. The command has not been written to the OGM. In this case, set 832 1. The command has not been written to the OGM. In this case, set
diff --git a/drivers/scsi/ultrastor.h b/drivers/scsi/ultrastor.h
index a692905f95f7..165c18b5cf5f 100644
--- a/drivers/scsi/ultrastor.h
+++ b/drivers/scsi/ultrastor.h
@@ -15,8 +15,7 @@
15 15
16static int ultrastor_detect(struct scsi_host_template *); 16static int ultrastor_detect(struct scsi_host_template *);
17static const char *ultrastor_info(struct Scsi_Host *shpnt); 17static const char *ultrastor_info(struct Scsi_Host *shpnt);
18static int ultrastor_queuecommand(struct scsi_cmnd *, 18static int ultrastor_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
19 void (*done)(struct scsi_cmnd *));
20static int ultrastor_abort(struct scsi_cmnd *); 19static int ultrastor_abort(struct scsi_cmnd *);
21static int ultrastor_host_reset(struct scsi_cmnd *); 20static int ultrastor_host_reset(struct scsi_cmnd *);
22static int ultrastor_biosparam(struct scsi_device *, struct block_device *, 21static int ultrastor_biosparam(struct scsi_device *, struct block_device *,
diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index 26894459c37f..a18996d24466 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -690,7 +690,7 @@ static int pvscsi_queue_ring(struct pvscsi_adapter *adapter,
690 return 0; 690 return 0;
691} 691}
692 692
693static int pvscsi_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) 693static int pvscsi_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
694{ 694{
695 struct Scsi_Host *host = cmd->device->host; 695 struct Scsi_Host *host = cmd->device->host;
696 struct pvscsi_adapter *adapter = shost_priv(host); 696 struct pvscsi_adapter *adapter = shost_priv(host);
@@ -719,6 +719,8 @@ static int pvscsi_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
719 return 0; 719 return 0;
720} 720}
721 721
722static DEF_SCSI_QCMD(pvscsi_queue)
723
722static int pvscsi_abort(struct scsi_cmnd *cmd) 724static int pvscsi_abort(struct scsi_cmnd *cmd)
723{ 725{
724 struct pvscsi_adapter *adapter = shost_priv(cmd->device->host); 726 struct pvscsi_adapter *adapter = shost_priv(cmd->device->host);
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
index b701bf2cc187..5f697e0bd009 100644
--- a/drivers/scsi/wd33c93.c
+++ b/drivers/scsi/wd33c93.c
@@ -371,8 +371,8 @@ calc_sync_msg(unsigned int period, unsigned int offset, unsigned int fast,
371 msg[1] = offset; 371 msg[1] = offset;
372} 372}
373 373
374int 374static int
375wd33c93_queuecommand(struct scsi_cmnd *cmd, 375wd33c93_queuecommand_lck(struct scsi_cmnd *cmd,
376 void (*done)(struct scsi_cmnd *)) 376 void (*done)(struct scsi_cmnd *))
377{ 377{
378 struct WD33C93_hostdata *hostdata; 378 struct WD33C93_hostdata *hostdata;
@@ -468,6 +468,8 @@ wd33c93_queuecommand(struct scsi_cmnd *cmd,
468 return 0; 468 return 0;
469} 469}
470 470
471DEF_SCSI_QCMD(wd33c93_queuecommand)
472
471/* 473/*
472 * This routine attempts to start a scsi command. If the host_card is 474 * This routine attempts to start a scsi command. If the host_card is
473 * already connected, we give up immediately. Otherwise, look through 475 * already connected, we give up immediately. Otherwise, look through
diff --git a/drivers/scsi/wd33c93.h b/drivers/scsi/wd33c93.h
index 1ed5f3bf388e..3b463d7304dc 100644
--- a/drivers/scsi/wd33c93.h
+++ b/drivers/scsi/wd33c93.h
@@ -343,8 +343,7 @@ struct WD33C93_hostdata {
343void wd33c93_init (struct Scsi_Host *instance, const wd33c93_regs regs, 343void wd33c93_init (struct Scsi_Host *instance, const wd33c93_regs regs,
344 dma_setup_t setup, dma_stop_t stop, int clock_freq); 344 dma_setup_t setup, dma_stop_t stop, int clock_freq);
345int wd33c93_abort (struct scsi_cmnd *cmd); 345int wd33c93_abort (struct scsi_cmnd *cmd);
346int wd33c93_queuecommand (struct scsi_cmnd *cmd, 346int wd33c93_queuecommand (struct Scsi_Host *h, struct scsi_cmnd *cmd);
347 void (*done)(struct scsi_cmnd *));
348void wd33c93_intr (struct Scsi_Host *instance); 347void wd33c93_intr (struct Scsi_Host *instance);
349int wd33c93_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); 348int wd33c93_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
350int wd33c93_host_reset (struct scsi_cmnd *); 349int wd33c93_host_reset (struct scsi_cmnd *);
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
index 333580bf37c5..db451ae0a368 100644
--- a/drivers/scsi/wd7000.c
+++ b/drivers/scsi/wd7000.c
@@ -1082,7 +1082,7 @@ static irqreturn_t wd7000_intr(int irq, void *dev_id)
1082 return IRQ_HANDLED; 1082 return IRQ_HANDLED;
1083} 1083}
1084 1084
1085static int wd7000_queuecommand(struct scsi_cmnd *SCpnt, 1085static int wd7000_queuecommand_lck(struct scsi_cmnd *SCpnt,
1086 void (*done)(struct scsi_cmnd *)) 1086 void (*done)(struct scsi_cmnd *))
1087{ 1087{
1088 Scb *scb; 1088 Scb *scb;
@@ -1139,6 +1139,8 @@ static int wd7000_queuecommand(struct scsi_cmnd *SCpnt,
1139 return 0; 1139 return 0;
1140} 1140}
1141 1141
1142static DEF_SCSI_QCMD(wd7000_queuecommand)
1143
1142static int wd7000_diagnostics(Adapter * host, int code) 1144static int wd7000_diagnostics(Adapter * host, int code)
1143{ 1145{
1144 static IcbDiag icb = { ICB_OP_DIAGNOSTICS }; 1146 static IcbDiag icb = { ICB_OP_DIAGNOSTICS };
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 41d9acf4cd61..6f8d67d0d64f 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -72,8 +72,7 @@ struct storvsc_driver_context {
72 72
73/* Static decl */ 73/* Static decl */
74static int storvsc_probe(struct device *dev); 74static int storvsc_probe(struct device *dev);
75static int storvsc_queuecommand(struct scsi_cmnd *scmnd, 75static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
76 void (*done)(struct scsi_cmnd *));
77static int storvsc_device_alloc(struct scsi_device *); 76static int storvsc_device_alloc(struct scsi_device *);
78static int storvsc_device_configure(struct scsi_device *); 77static int storvsc_device_configure(struct scsi_device *);
79static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd); 78static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd);
@@ -595,7 +594,7 @@ static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl,
595/* 594/*
596 * storvsc_queuecommand - Initiate command processing 595 * storvsc_queuecommand - Initiate command processing
597 */ 596 */
598static int storvsc_queuecommand(struct scsi_cmnd *scmnd, 597static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
599 void (*done)(struct scsi_cmnd *)) 598 void (*done)(struct scsi_cmnd *))
600{ 599{
601 int ret; 600 int ret;
@@ -783,6 +782,8 @@ retry_request:
783 return ret; 782 return ret;
784} 783}
785 784
785static DEF_SCSI_QCMD(storvsc_queuecommand)
786
786static int storvsc_merge_bvec(struct request_queue *q, 787static int storvsc_merge_bvec(struct request_queue *q,
787 struct bvec_merge_data *bmd, struct bio_vec *bvec) 788 struct bvec_merge_data *bmd, struct bio_vec *bvec)
788{ 789{
diff --git a/drivers/staging/keucr/scsiglue.c b/drivers/staging/keucr/scsiglue.c
index a2671404f7ac..da4f42af3838 100644
--- a/drivers/staging/keucr/scsiglue.c
+++ b/drivers/staging/keucr/scsiglue.c
@@ -87,7 +87,7 @@ static int slave_configure(struct scsi_device *sdev)
87 87
88/* This is always called with scsi_lock(host) held */ 88/* This is always called with scsi_lock(host) held */
89//----- queuecommand() --------------------- 89//----- queuecommand() ---------------------
90static int queuecommand(struct scsi_cmnd *srb, void (*done)(struct scsi_cmnd *)) 90static int queuecommand_lck(struct scsi_cmnd *srb, void (*done)(struct scsi_cmnd *))
91{ 91{
92 struct us_data *us = host_to_us(srb->device->host); 92 struct us_data *us = host_to_us(srb->device->host);
93 93
@@ -117,6 +117,8 @@ static int queuecommand(struct scsi_cmnd *srb, void (*done)(struct scsi_cmnd *))
117 return 0; 117 return 0;
118} 118}
119 119
120static DEF_SCSI_QCMD(queuecommand)
121
120/*********************************************************************** 122/***********************************************************************
121 * Error handling functions 123 * Error handling functions
122 ***********************************************************************/ 124 ***********************************************************************/
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index 5a47805d9580..c90c89dc0003 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -364,7 +364,7 @@ static int mts_scsi_host_reset(struct scsi_cmnd *srb)
364} 364}
365 365
366static int 366static int
367mts_scsi_queuecommand(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback); 367mts_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *srb);
368 368
369static void mts_transfer_cleanup( struct urb *transfer ); 369static void mts_transfer_cleanup( struct urb *transfer );
370static void mts_do_sg(struct urb * transfer); 370static void mts_do_sg(struct urb * transfer);
@@ -573,7 +573,7 @@ mts_build_transfer_context(struct scsi_cmnd *srb, struct mts_desc* desc)
573 573
574 574
575static int 575static int
576mts_scsi_queuecommand(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback) 576mts_scsi_queuecommand_lck(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback)
577{ 577{
578 struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]); 578 struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]);
579 int err = 0; 579 int err = 0;
@@ -626,6 +626,8 @@ out:
626 return err; 626 return err;
627} 627}
628 628
629static DEF_SCSI_QCMD(mts_scsi_queuecommand)
630
629static struct scsi_host_template mts_scsi_host_template = { 631static struct scsi_host_template mts_scsi_host_template = {
630 .module = THIS_MODULE, 632 .module = THIS_MODULE,
631 .name = "microtekX6", 633 .name = "microtekX6",
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index a688b1e686ea..689ee1fb702a 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -285,7 +285,7 @@ static int slave_configure(struct scsi_device *sdev)
285 285
286/* queue a command */ 286/* queue a command */
287/* This is always called with scsi_lock(host) held */ 287/* This is always called with scsi_lock(host) held */
288static int queuecommand(struct scsi_cmnd *srb, 288static int queuecommand_lck(struct scsi_cmnd *srb,
289 void (*done)(struct scsi_cmnd *)) 289 void (*done)(struct scsi_cmnd *))
290{ 290{
291 struct us_data *us = host_to_us(srb->device->host); 291 struct us_data *us = host_to_us(srb->device->host);
@@ -315,6 +315,8 @@ static int queuecommand(struct scsi_cmnd *srb,
315 return 0; 315 return 0;
316} 316}
317 317
318static DEF_SCSI_QCMD(queuecommand)
319
318/*********************************************************************** 320/***********************************************************************
319 * Error handling functions 321 * Error handling functions
320 ***********************************************************************/ 322 ***********************************************************************/
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index d1268191acbd..339fac3949df 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -430,7 +430,7 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd,
430 return 0; 430 return 0;
431} 431}
432 432
433static int uas_queuecommand(struct scsi_cmnd *cmnd, 433static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
434 void (*done)(struct scsi_cmnd *)) 434 void (*done)(struct scsi_cmnd *))
435{ 435{
436 struct scsi_device *sdev = cmnd->device; 436 struct scsi_device *sdev = cmnd->device;
@@ -488,6 +488,8 @@ static int uas_queuecommand(struct scsi_cmnd *cmnd,
488 return 0; 488 return 0;
489} 489}
490 490
491static DEF_SCSI_QCMD(uas_queuecommand)
492
491static int uas_eh_abort_handler(struct scsi_cmnd *cmnd) 493static int uas_eh_abort_handler(struct scsi_cmnd *cmnd)
492{ 494{
493 struct scsi_device *sdev = cmnd->device; 495 struct scsi_device *sdev = cmnd->device;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 15b77b8dc7e1..d947b1231662 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -986,7 +986,7 @@ extern void ata_host_init(struct ata_host *, struct device *,
986 unsigned long, struct ata_port_operations *); 986 unsigned long, struct ata_port_operations *);
987extern int ata_scsi_detect(struct scsi_host_template *sht); 987extern int ata_scsi_detect(struct scsi_host_template *sht);
988extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 988extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
989extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)); 989extern int ata_scsi_queuecmd(struct Scsi_Host *h, struct scsi_cmnd *cmd);
990extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev, 990extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev,
991 int cmd, void __user *arg); 991 int cmd, void __user *arg);
992extern void ata_sas_port_destroy(struct ata_port *); 992extern void ata_sas_port_destroy(struct ata_port *);
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index f986ab7ffe6f..5c4c1678f7be 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -1006,8 +1006,7 @@ void fc_fcp_destroy(struct fc_lport *);
1006/* 1006/*
1007 * SCSI INTERACTION LAYER 1007 * SCSI INTERACTION LAYER
1008 *****************************/ 1008 *****************************/
1009int fc_queuecommand(struct scsi_cmnd *, 1009int fc_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
1010 void (*done)(struct scsi_cmnd *));
1011int fc_eh_abort(struct scsi_cmnd *); 1010int fc_eh_abort(struct scsi_cmnd *);
1012int fc_eh_device_reset(struct scsi_cmnd *); 1011int fc_eh_device_reset(struct scsi_cmnd *);
1013int fc_eh_host_reset(struct scsi_cmnd *); 1012int fc_eh_host_reset(struct scsi_cmnd *);
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index ae5196aae1a5..b81d969ddc67 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -341,8 +341,7 @@ extern int iscsi_eh_abort(struct scsi_cmnd *sc);
341extern int iscsi_eh_recover_target(struct scsi_cmnd *sc); 341extern int iscsi_eh_recover_target(struct scsi_cmnd *sc);
342extern int iscsi_eh_session_reset(struct scsi_cmnd *sc); 342extern int iscsi_eh_session_reset(struct scsi_cmnd *sc);
343extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); 343extern int iscsi_eh_device_reset(struct scsi_cmnd *sc);
344extern int iscsi_queuecommand(struct scsi_cmnd *sc, 344extern int iscsi_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *sc);
345 void (*done)(struct scsi_cmnd *));
346 345
347/* 346/*
348 * iSCSI host helpers. 347 * iSCSI host helpers.
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 3dec1949f69c..90ce527ecf3d 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -621,8 +621,7 @@ int sas_set_phy_speed(struct sas_phy *phy,
621int sas_phy_enable(struct sas_phy *phy, int enabled); 621int sas_phy_enable(struct sas_phy *phy, int enabled);
622int sas_phy_reset(struct sas_phy *phy, int hard_reset); 622int sas_phy_reset(struct sas_phy *phy, int hard_reset);
623int sas_queue_up(struct sas_task *task); 623int sas_queue_up(struct sas_task *task);
624extern int sas_queuecommand(struct scsi_cmnd *, 624extern int sas_queuecommand(struct Scsi_Host * ,struct scsi_cmnd *);
625 void (*scsi_done)(struct scsi_cmnd *));
626extern int sas_target_alloc(struct scsi_target *); 625extern int sas_target_alloc(struct scsi_target *);
627extern int sas_slave_alloc(struct scsi_device *); 626extern int sas_slave_alloc(struct scsi_device *);
628extern int sas_slave_configure(struct scsi_device *); 627extern int sas_slave_configure(struct scsi_device *);
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index d0a6a845f204..e7e385842a38 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -127,8 +127,7 @@ struct scsi_host_template {
127 * 127 *
128 * STATUS: REQUIRED 128 * STATUS: REQUIRED
129 */ 129 */
130 int (* queuecommand)(struct scsi_cmnd *, 130 int (* queuecommand)(struct Scsi_Host *, struct scsi_cmnd *);
131 void (*done)(struct scsi_cmnd *));
132 131
133 /* 132 /*
134 * The transfer functions are used to queue a scsi command to 133 * The transfer functions are used to queue a scsi command to
@@ -505,6 +504,25 @@ struct scsi_host_template {
505}; 504};
506 505
507/* 506/*
507 * Temporary #define for host lock push down. Can be removed when all
508 * drivers have been updated to take advantage of unlocked
509 * queuecommand.
510 *
511 */
512#define DEF_SCSI_QCMD(func_name) \
513 int func_name(struct Scsi_Host *shost, struct scsi_cmnd *cmd) \
514 { \
515 unsigned long irq_flags; \
516 int rc; \
517 spin_lock_irqsave(shost->host_lock, irq_flags); \
518 scsi_cmd_get_serial(shost, cmd); \
519 rc = func_name##_lck (cmd, cmd->scsi_done); \
520 spin_unlock_irqrestore(shost->host_lock, irq_flags); \
521 return rc; \
522 }
523
524
525/*
508 * shost state: If you alter this, you also need to alter scsi_sysfs.c 526 * shost state: If you alter this, you also need to alter scsi_sysfs.c
509 * (for the ascii descriptions) and the state model enforcer: 527 * (for the ascii descriptions) and the state model enforcer:
510 * scsi_host_set_state() 528 * scsi_host_set_state()
@@ -752,6 +770,7 @@ extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *);
752extern void scsi_host_put(struct Scsi_Host *t); 770extern void scsi_host_put(struct Scsi_Host *t);
753extern struct Scsi_Host *scsi_host_lookup(unsigned short); 771extern struct Scsi_Host *scsi_host_lookup(unsigned short);
754extern const char *scsi_host_state_name(enum scsi_host_state); 772extern const char *scsi_host_state_name(enum scsi_host_state);
773extern void scsi_cmd_get_serial(struct Scsi_Host *, struct scsi_cmnd *);
755 774
756extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); 775extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);
757 776