aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/image/microtek.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2010-11-16 02:10:29 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-11-16 16:33:23 -0500
commitf281233d3eba15fb225d21ae2e228fd4553d824a (patch)
tree51134454ba8acb558735f90be5540f7d756483e3 /drivers/usb/image/microtek.c
parentbdbd01ac444bffb3c9aefed3059d12554059b320 (diff)
SCSI host lock push-down
Move the mid-layer's ->queuecommand() invocation from being locked with the host lock to being unlocked to facilitate speeding up the critical path for drivers who don't need this lock taken anyway. The patch below presents a simple SCSI host lock push-down as an equivalent transformation. No locking or other behavior should change with this patch. All existing bugs and locking orders are preserved. Additionally, add one parameter to queuecommand, struct Scsi_Host * and remove one parameter from queuecommand, void (*done)(struct scsi_cmnd *) Scsi_Host* is a convenient pointer that most host drivers need anyway, and 'done' is redundant to struct scsi_cmnd->scsi_done. Minimal code disturbance was attempted with this change. Most drivers needed only two one-line modifications for their host lock push-down. Signed-off-by: Jeff Garzik <jgarzik@redhat.com> Acked-by: James Bottomley <James.Bottomley@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb/image/microtek.c')
-rw-r--r--drivers/usb/image/microtek.c6
1 files changed, 4 insertions, 2 deletions
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",