aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-11-13 09:08:42 -0500
committerChristoph Hellwig <hch@lst.de>2014-11-24 08:45:27 -0500
commitdb5ed4dfd5dd0142ec36ff7b335e0ec3b836b3e6 (patch)
tree6cae824b5c9e5a7fd9d213e3f9c2b1c7dc8b7b8a /drivers/scsi
parent1e6f2416044c062a56091ebf8d76760956dd5872 (diff)
scsi: drop reason argument from ->change_queue_depth
Drop the now unused reason argument from the ->change_queue_depth method. Also add a return value to scsi_adjust_queue_depth, and rename it to scsi_change_queue_depth now that it can be used as the default ->change_queue_depth implementation. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Reviewed-by: Hannes Reinecke <hare@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/3w-9xxx.c13
-rw-r--r--drivers/scsi/3w-sas.c13
-rw-r--r--drivers/scsi/3w-xxxx.c13
-rw-r--r--drivers/scsi/53c700.c19
-rw-r--r--drivers/scsi/BusLogic.c4
-rw-r--r--drivers/scsi/aacraid/linit.c18
-rw-r--r--drivers/scsi/advansys.c8
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c4
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c4
-rw-r--r--drivers/scsi/arcmsr/arcmsr_hba.c9
-rw-r--r--drivers/scsi/be2iscsi/be_main.c2
-rw-r--r--drivers/scsi/bfa/bfad_im.c4
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c2
-rw-r--r--drivers/scsi/bnx2i/bnx2i_iscsi.c2
-rw-r--r--drivers/scsi/csiostor/csio_scsi.c2
-rw-r--r--drivers/scsi/cxgbi/cxgb3i/cxgb3i.c2
-rw-r--r--drivers/scsi/cxgbi/cxgb4i/cxgb4i.c2
-rw-r--r--drivers/scsi/dpt_i2o.c2
-rw-r--r--drivers/scsi/eata.c6
-rw-r--r--drivers/scsi/esas2r/esas2r.h1
-rw-r--r--drivers/scsi/esas2r/esas2r_main.c11
-rw-r--r--drivers/scsi/esp_scsi.c2
-rw-r--r--drivers/scsi/fcoe/fcoe.c2
-rw-r--r--drivers/scsi/fnic/fnic_main.c4
-rw-r--r--drivers/scsi/hpsa.c16
-rw-r--r--drivers/scsi/hptiop.c8
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c9
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c10
-rw-r--r--drivers/scsi/ipr.c10
-rw-r--r--drivers/scsi/ips.c2
-rw-r--r--drivers/scsi/iscsi_tcp.c2
-rw-r--r--drivers/scsi/libfc/fc_fcp.c15
-rw-r--r--drivers/scsi/libiscsi.c7
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c12
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c26
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c21
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_base.c13
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c10
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_scsih.c10
-rw-r--r--drivers/scsi/ncr53c8xx.c2
-rw-r--r--drivers/scsi/pmcraid.c12
-rw-r--r--drivers/scsi/qla1280.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c12
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c4
-rw-r--r--drivers/scsi/scsi.c41
-rw-r--r--drivers/scsi/scsi_debug.c4
-rw-r--r--drivers/scsi/scsi_error.c2
-rw-r--r--drivers/scsi/scsi_scan.c2
-rw-r--r--drivers/scsi/scsi_sysfs.c3
-rw-r--r--drivers/scsi/storvsc_drv.c2
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c2
-rw-r--r--drivers/scsi/tmscsim.c2
-rw-r--r--drivers/scsi/u14-34f.c10
-rw-r--r--drivers/scsi/ufs/ufshcd.c13
-rw-r--r--drivers/scsi/virtio_scsi.c8
-rw-r--r--drivers/scsi/vmw_pvscsi.c12
-rw-r--r--drivers/scsi/wd7000.c1
57 files changed, 122 insertions, 334 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 1cf37032290a..cd4129ff7ae4 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -189,17 +189,6 @@ static ssize_t twa_show_stats(struct device *dev,
189 return len; 189 return len;
190} /* End twa_show_stats() */ 190} /* End twa_show_stats() */
191 191
192/* This function will set a devices queue depth */
193static int twa_change_queue_depth(struct scsi_device *sdev, int queue_depth,
194 int reason)
195{
196 if (reason != SCSI_QDEPTH_DEFAULT)
197 return -EOPNOTSUPP;
198
199 scsi_adjust_queue_depth(sdev, queue_depth);
200 return queue_depth;
201} /* End twa_change_queue_depth() */
202
203/* Create sysfs 'stats' entry */ 192/* Create sysfs 'stats' entry */
204static struct device_attribute twa_host_stats_attr = { 193static struct device_attribute twa_host_stats_attr = {
205 .attr = { 194 .attr = {
@@ -2014,7 +2003,7 @@ static struct scsi_host_template driver_template = {
2014 .queuecommand = twa_scsi_queue, 2003 .queuecommand = twa_scsi_queue,
2015 .eh_host_reset_handler = twa_scsi_eh_reset, 2004 .eh_host_reset_handler = twa_scsi_eh_reset,
2016 .bios_param = twa_scsi_biosparam, 2005 .bios_param = twa_scsi_biosparam,
2017 .change_queue_depth = twa_change_queue_depth, 2006 .change_queue_depth = scsi_change_queue_depth,
2018 .can_queue = TW_Q_LENGTH-2, 2007 .can_queue = TW_Q_LENGTH-2,
2019 .slave_configure = twa_slave_configure, 2008 .slave_configure = twa_slave_configure,
2020 .this_id = -1, 2009 .this_id = -1,
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index 547756b7d5bf..2361772d5909 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -191,17 +191,6 @@ static ssize_t twl_show_stats(struct device *dev,
191 return len; 191 return len;
192} /* End twl_show_stats() */ 192} /* End twl_show_stats() */
193 193
194/* This function will set a devices queue depth */
195static int twl_change_queue_depth(struct scsi_device *sdev, int queue_depth,
196 int reason)
197{
198 if (reason != SCSI_QDEPTH_DEFAULT)
199 return -EOPNOTSUPP;
200
201 scsi_adjust_queue_depth(sdev, queue_depth);
202 return queue_depth;
203} /* End twl_change_queue_depth() */
204
205/* stats sysfs attribute initializer */ 194/* stats sysfs attribute initializer */
206static struct device_attribute twl_host_stats_attr = { 195static struct device_attribute twl_host_stats_attr = {
207 .attr = { 196 .attr = {
@@ -1588,7 +1577,7 @@ static struct scsi_host_template driver_template = {
1588 .queuecommand = twl_scsi_queue, 1577 .queuecommand = twl_scsi_queue,
1589 .eh_host_reset_handler = twl_scsi_eh_reset, 1578 .eh_host_reset_handler = twl_scsi_eh_reset,
1590 .bios_param = twl_scsi_biosparam, 1579 .bios_param = twl_scsi_biosparam,
1591 .change_queue_depth = twl_change_queue_depth, 1580 .change_queue_depth = scsi_change_queue_depth,
1592 .can_queue = TW_Q_LENGTH-2, 1581 .can_queue = TW_Q_LENGTH-2,
1593 .slave_configure = twl_slave_configure, 1582 .slave_configure = twl_slave_configure,
1594 .this_id = -1, 1583 .this_id = -1,
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index 261a4c1da962..c75f2048319f 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -523,17 +523,6 @@ static ssize_t tw_show_stats(struct device *dev, struct device_attribute *attr,
523 return len; 523 return len;
524} /* End tw_show_stats() */ 524} /* End tw_show_stats() */
525 525
526/* This function will set a devices queue depth */
527static int tw_change_queue_depth(struct scsi_device *sdev, int queue_depth,
528 int reason)
529{
530 if (reason != SCSI_QDEPTH_DEFAULT)
531 return -EOPNOTSUPP;
532
533 scsi_adjust_queue_depth(sdev, queue_depth);
534 return queue_depth;
535} /* End tw_change_queue_depth() */
536
537/* Create sysfs 'stats' entry */ 526/* Create sysfs 'stats' entry */
538static struct device_attribute tw_host_stats_attr = { 527static struct device_attribute tw_host_stats_attr = {
539 .attr = { 528 .attr = {
@@ -2268,7 +2257,7 @@ static struct scsi_host_template driver_template = {
2268 .queuecommand = tw_scsi_queue, 2257 .queuecommand = tw_scsi_queue,
2269 .eh_host_reset_handler = tw_scsi_eh_reset, 2258 .eh_host_reset_handler = tw_scsi_eh_reset,
2270 .bios_param = tw_scsi_biosparam, 2259 .bios_param = tw_scsi_biosparam,
2271 .change_queue_depth = tw_change_queue_depth, 2260 .change_queue_depth = scsi_change_queue_depth,
2272 .can_queue = TW_Q_LENGTH-2, 2261 .can_queue = TW_Q_LENGTH-2,
2273 .slave_configure = tw_slave_configure, 2262 .slave_configure = tw_slave_configure,
2274 .this_id = -1, 2263 .this_id = -1,
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index d7557b932113..aa915da2a5e5 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -175,7 +175,7 @@ STATIC void NCR_700_chip_reset(struct Scsi_Host *host);
175STATIC int NCR_700_slave_alloc(struct scsi_device *SDpnt); 175STATIC int NCR_700_slave_alloc(struct scsi_device *SDpnt);
176STATIC int NCR_700_slave_configure(struct scsi_device *SDpnt); 176STATIC int NCR_700_slave_configure(struct scsi_device *SDpnt);
177STATIC void NCR_700_slave_destroy(struct scsi_device *SDpnt); 177STATIC void NCR_700_slave_destroy(struct scsi_device *SDpnt);
178static int NCR_700_change_queue_depth(struct scsi_device *SDpnt, int depth, int reason); 178static int NCR_700_change_queue_depth(struct scsi_device *SDpnt, int depth);
179static int NCR_700_change_queue_type(struct scsi_device *SDpnt, int depth); 179static int NCR_700_change_queue_type(struct scsi_device *SDpnt, int depth);
180 180
181STATIC struct device_attribute *NCR_700_dev_attrs[]; 181STATIC struct device_attribute *NCR_700_dev_attrs[];
@@ -904,7 +904,7 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata
904 hostdata->tag_negotiated &= ~(1<<scmd_id(SCp)); 904 hostdata->tag_negotiated &= ~(1<<scmd_id(SCp));
905 905
906 SCp->device->tagged_supported = 0; 906 SCp->device->tagged_supported = 0;
907 scsi_adjust_queue_depth(SCp->device, host->cmd_per_lun); 907 scsi_change_queue_depth(SCp->device, host->cmd_per_lun);
908 scsi_set_tag_type(SCp->device, 0); 908 scsi_set_tag_type(SCp->device, 0);
909 } else { 909 } else {
910 shost_printk(KERN_WARNING, host, 910 shost_printk(KERN_WARNING, host,
@@ -2052,7 +2052,7 @@ NCR_700_slave_configure(struct scsi_device *SDp)
2052 2052
2053 /* to do here: allocate memory; build a queue_full list */ 2053 /* to do here: allocate memory; build a queue_full list */
2054 if(SDp->tagged_supported) { 2054 if(SDp->tagged_supported) {
2055 scsi_adjust_queue_depth(SDp, NCR_700_DEFAULT_TAGS); 2055 scsi_change_queue_depth(SDp, NCR_700_DEFAULT_TAGS);
2056 NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION); 2056 NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION);
2057 } 2057 }
2058 2058
@@ -2075,16 +2075,11 @@ NCR_700_slave_destroy(struct scsi_device *SDp)
2075} 2075}
2076 2076
2077static int 2077static int
2078NCR_700_change_queue_depth(struct scsi_device *SDp, int depth, int reason) 2078NCR_700_change_queue_depth(struct scsi_device *SDp, int depth)
2079{ 2079{
2080 if (reason != SCSI_QDEPTH_DEFAULT)
2081 return -EOPNOTSUPP;
2082
2083 if (depth > NCR_700_MAX_TAGS) 2080 if (depth > NCR_700_MAX_TAGS)
2084 depth = NCR_700_MAX_TAGS; 2081 depth = NCR_700_MAX_TAGS;
2085 2082 return scsi_change_queue_depth(SDp, depth);
2086 scsi_adjust_queue_depth(SDp, depth);
2087 return depth;
2088} 2083}
2089 2084
2090static int NCR_700_change_queue_type(struct scsi_device *SDp, int tag_type) 2085static int NCR_700_change_queue_type(struct scsi_device *SDp, int tag_type)
@@ -2105,12 +2100,12 @@ static int NCR_700_change_queue_type(struct scsi_device *SDp, int tag_type)
2105 if (!tag_type) { 2100 if (!tag_type) {
2106 /* shift back to the default unqueued number of commands 2101 /* shift back to the default unqueued number of commands
2107 * (the user can still raise this) */ 2102 * (the user can still raise this) */
2108 scsi_adjust_queue_depth(SDp, SDp->host->cmd_per_lun); 2103 scsi_change_queue_depth(SDp, SDp->host->cmd_per_lun);
2109 hostdata->tag_negotiated &= ~(1 << sdev_id(SDp)); 2104 hostdata->tag_negotiated &= ~(1 << sdev_id(SDp));
2110 } else { 2105 } else {
2111 /* Here, we cleared the negotiation flag above, so this 2106 /* Here, we cleared the negotiation flag above, so this
2112 * will force the driver to renegotiate */ 2107 * will force the driver to renegotiate */
2113 scsi_adjust_queue_depth(SDp, SDp->queue_depth); 2108 scsi_change_queue_depth(SDp, SDp->queue_depth);
2114 if (change_tag) 2109 if (change_tag)
2115 NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION); 2110 NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION);
2116 } 2111 }
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 5aa476b6b8a8..8d66a6469e29 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -2327,12 +2327,12 @@ static int blogic_slaveconfig(struct scsi_device *dev)
2327 if (qdepth == 0) 2327 if (qdepth == 0)
2328 qdepth = BLOGIC_MAX_AUTO_TAG_DEPTH; 2328 qdepth = BLOGIC_MAX_AUTO_TAG_DEPTH;
2329 adapter->qdepth[tgt_id] = qdepth; 2329 adapter->qdepth[tgt_id] = qdepth;
2330 scsi_adjust_queue_depth(dev, qdepth); 2330 scsi_change_queue_depth(dev, qdepth);
2331 } else { 2331 } else {
2332 adapter->tagq_ok &= ~(1 << tgt_id); 2332 adapter->tagq_ok &= ~(1 << tgt_id);
2333 qdepth = adapter->untag_qdepth; 2333 qdepth = adapter->untag_qdepth;
2334 adapter->qdepth[tgt_id] = qdepth; 2334 adapter->qdepth[tgt_id] = qdepth;
2335 scsi_adjust_queue_depth(dev, qdepth); 2335 scsi_change_queue_depth(dev, qdepth);
2336 } 2336 }
2337 qdepth = 0; 2337 qdepth = 0;
2338 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) 2338 for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 41b9c68bca67..d11c23aad046 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -462,9 +462,9 @@ static int aac_slave_configure(struct scsi_device *sdev)
462 depth = 256; 462 depth = 256;
463 else if (depth < 2) 463 else if (depth < 2)
464 depth = 2; 464 depth = 2;
465 scsi_adjust_queue_depth(sdev, depth); 465 scsi_change_queue_depth(sdev, depth);
466 } else 466 } else
467 scsi_adjust_queue_depth(sdev, 1); 467 scsi_change_queue_depth(sdev, 1);
468 468
469 return 0; 469 return 0;
470} 470}
@@ -478,12 +478,8 @@ static int aac_slave_configure(struct scsi_device *sdev)
478 * total capacity and the queue depth supported by the target device. 478 * total capacity and the queue depth supported by the target device.
479 */ 479 */
480 480
481static int aac_change_queue_depth(struct scsi_device *sdev, int depth, 481static int aac_change_queue_depth(struct scsi_device *sdev, int depth)
482 int reason)
483{ 482{
484 if (reason != SCSI_QDEPTH_DEFAULT)
485 return -EOPNOTSUPP;
486
487 if (sdev->tagged_supported && (sdev->type == TYPE_DISK) && 483 if (sdev->tagged_supported && (sdev->type == TYPE_DISK) &&
488 (sdev_channel(sdev) == CONTAINER_CHANNEL)) { 484 (sdev_channel(sdev) == CONTAINER_CHANNEL)) {
489 struct scsi_device * dev; 485 struct scsi_device * dev;
@@ -504,10 +500,10 @@ static int aac_change_queue_depth(struct scsi_device *sdev, int depth,
504 depth = 256; 500 depth = 256;
505 else if (depth < 2) 501 else if (depth < 2)
506 depth = 2; 502 depth = 2;
507 scsi_adjust_queue_depth(sdev, depth); 503 return scsi_change_queue_depth(sdev, depth);
508 } else 504 }
509 scsi_adjust_queue_depth(sdev, 1); 505
510 return sdev->queue_depth; 506 return scsi_change_queue_depth(sdev, 1);
511} 507}
512 508
513static ssize_t aac_show_raid_level(struct device *dev, struct device_attribute *attr, char *buf) 509static ssize_t aac_show_raid_level(struct device *dev, struct device_attribute *attr, char *buf)
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index ae4840e4c1c5..6719a3390ebd 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -7706,7 +7706,7 @@ advansys_narrow_slave_configure(struct scsi_device *sdev, ASC_DVC_VAR *asc_dvc)
7706 asc_dvc->cfg->can_tagged_qng |= tid_bit; 7706 asc_dvc->cfg->can_tagged_qng |= tid_bit;
7707 asc_dvc->use_tagged_qng |= tid_bit; 7707 asc_dvc->use_tagged_qng |= tid_bit;
7708 } 7708 }
7709 scsi_adjust_queue_depth(sdev, 7709 scsi_change_queue_depth(sdev,
7710 asc_dvc->max_dvc_qng[sdev->id]); 7710 asc_dvc->max_dvc_qng[sdev->id]);
7711 } 7711 }
7712 } else { 7712 } else {
@@ -7847,10 +7847,8 @@ advansys_wide_slave_configure(struct scsi_device *sdev, ADV_DVC_VAR *adv_dvc)
7847 } 7847 }
7848 } 7848 }
7849 7849
7850 if ((adv_dvc->tagqng_able & tidmask) && sdev->tagged_supported) { 7850 if ((adv_dvc->tagqng_able & tidmask) && sdev->tagged_supported)
7851 scsi_adjust_queue_depth(sdev, 7851 scsi_change_queue_depth(sdev, adv_dvc->max_dvc_qng);
7852 adv_dvc->max_dvc_qng);
7853 }
7854} 7852}
7855 7853
7856/* 7854/*
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 80cb4fd7caaa..d5c7b193d8d3 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1470,7 +1470,7 @@ ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
1470 switch ((dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED))) { 1470 switch ((dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED))) {
1471 case AHD_DEV_Q_BASIC: 1471 case AHD_DEV_Q_BASIC:
1472 case AHD_DEV_Q_TAGGED: 1472 case AHD_DEV_Q_TAGGED:
1473 scsi_adjust_queue_depth(sdev, 1473 scsi_change_queue_depth(sdev,
1474 dev->openings + dev->active); 1474 dev->openings + dev->active);
1475 break; 1475 break;
1476 default: 1476 default:
@@ -1480,7 +1480,7 @@ ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
1480 * serially on the controller/device. This should 1480 * serially on the controller/device. This should
1481 * remove some latency. 1481 * remove some latency.
1482 */ 1482 */
1483 scsi_adjust_queue_depth(sdev, 1); 1483 scsi_change_queue_depth(sdev, 1);
1484 break; 1484 break;
1485 } 1485 }
1486} 1486}
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index a6a27d5398dd..88360116dbcb 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1336,7 +1336,7 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
1336 switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) { 1336 switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) {
1337 case AHC_DEV_Q_BASIC: 1337 case AHC_DEV_Q_BASIC:
1338 case AHC_DEV_Q_TAGGED: 1338 case AHC_DEV_Q_TAGGED:
1339 scsi_adjust_queue_depth(sdev, 1339 scsi_change_queue_depth(sdev,
1340 dev->openings + dev->active); 1340 dev->openings + dev->active);
1341 default: 1341 default:
1342 /* 1342 /*
@@ -1345,7 +1345,7 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
1345 * serially on the controller/device. This should 1345 * serially on the controller/device. This should
1346 * remove some latency. 1346 * remove some latency.
1347 */ 1347 */
1348 scsi_adjust_queue_depth(sdev, 2); 1348 scsi_change_queue_depth(sdev, 2);
1349 break; 1349 break;
1350 } 1350 }
1351} 1351}
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 209f77162d06..914c39f9f388 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -114,16 +114,11 @@ static void arcmsr_hardware_reset(struct AdapterControlBlock *acb);
114static const char *arcmsr_info(struct Scsi_Host *); 114static const char *arcmsr_info(struct Scsi_Host *);
115static irqreturn_t arcmsr_interrupt(struct AdapterControlBlock *acb); 115static irqreturn_t arcmsr_interrupt(struct AdapterControlBlock *acb);
116static void arcmsr_free_irq(struct pci_dev *, struct AdapterControlBlock *); 116static void arcmsr_free_irq(struct pci_dev *, struct AdapterControlBlock *);
117static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev, 117static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev, int queue_depth)
118 int queue_depth, int reason)
119{ 118{
120 if (reason != SCSI_QDEPTH_DEFAULT)
121 return -EOPNOTSUPP;
122
123 if (queue_depth > ARCMSR_MAX_CMD_PERLUN) 119 if (queue_depth > ARCMSR_MAX_CMD_PERLUN)
124 queue_depth = ARCMSR_MAX_CMD_PERLUN; 120 queue_depth = ARCMSR_MAX_CMD_PERLUN;
125 scsi_adjust_queue_depth(sdev, queue_depth); 121 return scsi_change_queue_depth(sdev, queue_depth);
126 return queue_depth;
127} 122}
128 123
129static struct scsi_host_template arcmsr_scsi_host_template = { 124static struct scsi_host_template arcmsr_scsi_host_template = {
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index d9b999a3416f..f3193406776c 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -556,7 +556,7 @@ static struct scsi_host_template beiscsi_sht = {
556 .name = "Emulex 10Gbe open-iscsi Initiator Driver", 556 .name = "Emulex 10Gbe open-iscsi Initiator Driver",
557 .proc_name = DRV_NAME, 557 .proc_name = DRV_NAME,
558 .queuecommand = iscsi_queuecommand, 558 .queuecommand = iscsi_queuecommand,
559 .change_queue_depth = iscsi_change_queue_depth, 559 .change_queue_depth = scsi_change_queue_depth,
560 .slave_configure = beiscsi_slave_configure, 560 .slave_configure = beiscsi_slave_configure,
561 .target_alloc = iscsi_target_alloc, 561 .target_alloc = iscsi_target_alloc,
562 .eh_abort_handler = beiscsi_eh_abort, 562 .eh_abort_handler = beiscsi_eh_abort,
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 87b09cd232cc..7223b0006740 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -776,7 +776,7 @@ bfad_thread_workq(struct bfad_s *bfad)
776static int 776static int
777bfad_im_slave_configure(struct scsi_device *sdev) 777bfad_im_slave_configure(struct scsi_device *sdev)
778{ 778{
779 scsi_adjust_queue_depth(sdev, bfa_lun_queue_depth); 779 scsi_change_queue_depth(sdev, bfa_lun_queue_depth);
780 return 0; 780 return 0;
781} 781}
782 782
@@ -866,7 +866,7 @@ bfad_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
866 if (bfa_lun_queue_depth > tmp_sdev->queue_depth) { 866 if (bfa_lun_queue_depth > tmp_sdev->queue_depth) {
867 if (tmp_sdev->id != sdev->id) 867 if (tmp_sdev->id != sdev->id)
868 continue; 868 continue;
869 scsi_adjust_queue_depth(tmp_sdev, 869 scsi_change_queue_depth(tmp_sdev,
870 tmp_sdev->queue_depth + 1); 870 tmp_sdev->queue_depth + 1);
871 871
872 itnim->last_ramp_up_time = jiffies; 872 itnim->last_ramp_up_time = jiffies;
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index cc537972f3ea..386c2cfad306 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -2784,7 +2784,7 @@ static struct scsi_host_template bnx2fc_shost_template = {
2784 .eh_target_reset_handler = bnx2fc_eh_target_reset, /* tgt reset */ 2784 .eh_target_reset_handler = bnx2fc_eh_target_reset, /* tgt reset */
2785 .eh_host_reset_handler = fc_eh_host_reset, 2785 .eh_host_reset_handler = fc_eh_host_reset,
2786 .slave_alloc = fc_slave_alloc, 2786 .slave_alloc = fc_slave_alloc,
2787 .change_queue_depth = fc_change_queue_depth, 2787 .change_queue_depth = scsi_change_queue_depth,
2788 .change_queue_type = scsi_change_queue_type, 2788 .change_queue_type = scsi_change_queue_type,
2789 .this_id = -1, 2789 .this_id = -1,
2790 .cmd_per_lun = 3, 2790 .cmd_per_lun = 3,
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c
index 9de1c20bb0f8..e53078d03309 100644
--- a/drivers/scsi/bnx2i/bnx2i_iscsi.c
+++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c
@@ -2259,7 +2259,7 @@ static struct scsi_host_template bnx2i_host_template = {
2259 .eh_abort_handler = iscsi_eh_abort, 2259 .eh_abort_handler = iscsi_eh_abort,
2260 .eh_device_reset_handler = iscsi_eh_device_reset, 2260 .eh_device_reset_handler = iscsi_eh_device_reset,
2261 .eh_target_reset_handler = iscsi_eh_recover_target, 2261 .eh_target_reset_handler = iscsi_eh_recover_target,
2262 .change_queue_depth = iscsi_change_queue_depth, 2262 .change_queue_depth = scsi_change_queue_depth,
2263 .target_alloc = iscsi_target_alloc, 2263 .target_alloc = iscsi_target_alloc,
2264 .can_queue = 2048, 2264 .can_queue = 2048,
2265 .max_sectors = 127, 2265 .max_sectors = 127,
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index 44a8cc51428f..4d0b6ce55f20 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -2241,7 +2241,7 @@ csio_slave_alloc(struct scsi_device *sdev)
2241static int 2241static int
2242csio_slave_configure(struct scsi_device *sdev) 2242csio_slave_configure(struct scsi_device *sdev)
2243{ 2243{
2244 scsi_adjust_queue_depth(sdev, csio_lun_qdepth); 2244 scsi_change_queue_depth(sdev, csio_lun_qdepth);
2245 return 0; 2245 return 0;
2246} 2246}
2247 2247
diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
index 99ea67dcdd2a..3db4c63978c5 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -86,7 +86,7 @@ static struct scsi_host_template cxgb3i_host_template = {
86 .proc_name = DRV_MODULE_NAME, 86 .proc_name = DRV_MODULE_NAME,
87 .can_queue = CXGB3I_SCSI_HOST_QDEPTH, 87 .can_queue = CXGB3I_SCSI_HOST_QDEPTH,
88 .queuecommand = iscsi_queuecommand, 88 .queuecommand = iscsi_queuecommand,
89 .change_queue_depth = iscsi_change_queue_depth, 89 .change_queue_depth = scsi_change_queue_depth,
90 .sg_tablesize = SG_ALL, 90 .sg_tablesize = SG_ALL,
91 .max_sectors = 0xFFFF, 91 .max_sectors = 0xFFFF,
92 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN, 92 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN,
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index af86e8f57b84..efe42ef7d92b 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -89,7 +89,7 @@ static struct scsi_host_template cxgb4i_host_template = {
89 .proc_name = DRV_MODULE_NAME, 89 .proc_name = DRV_MODULE_NAME,
90 .can_queue = CXGB4I_SCSI_HOST_QDEPTH, 90 .can_queue = CXGB4I_SCSI_HOST_QDEPTH,
91 .queuecommand = iscsi_queuecommand, 91 .queuecommand = iscsi_queuecommand,
92 .change_queue_depth = iscsi_change_queue_depth, 92 .change_queue_depth = scsi_change_queue_depth,
93 .sg_tablesize = SG_ALL, 93 .sg_tablesize = SG_ALL,
94 .max_sectors = 0xFFFF, 94 .max_sectors = 0xFFFF,
95 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN, 95 .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN,
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 1af8d54bcded..0bf976936a10 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -415,7 +415,7 @@ static int adpt_slave_configure(struct scsi_device * device)
415 pHba = (adpt_hba *) host->hostdata[0]; 415 pHba = (adpt_hba *) host->hostdata[0];
416 416
417 if (host->can_queue && device->tagged_supported) { 417 if (host->can_queue && device->tagged_supported) {
418 scsi_adjust_queue_depth(device, 418 scsi_change_queue_depth(device,
419 host->can_queue - 1); 419 host->can_queue - 1);
420 } 420 }
421 return 0; 421 return 0;
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index bc0f918f1729..227dd2c2ec2f 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -952,12 +952,12 @@ static int eata2x_slave_configure(struct scsi_device *dev)
952 } else { 952 } else {
953 tag_suffix = ", no tags"; 953 tag_suffix = ", no tags";
954 } 954 }
955 scsi_adjust_queue_depth(dev, tqd); 955 scsi_change_queue_depth(dev, tqd);
956 } else if (TLDEV(dev->type) && linked_comm) { 956 } else if (TLDEV(dev->type) && linked_comm) {
957 scsi_adjust_queue_depth(dev, tqd); 957 scsi_change_queue_depth(dev, tqd);
958 tag_suffix = ", untagged"; 958 tag_suffix = ", untagged";
959 } else { 959 } else {
960 scsi_adjust_queue_depth(dev, utqd); 960 scsi_change_queue_depth(dev, utqd);
961 tag_suffix = ""; 961 tag_suffix = "";
962 } 962 }
963 963
diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h
index 1941d837f6f2..b6030e3edd01 100644
--- a/drivers/scsi/esas2r/esas2r.h
+++ b/drivers/scsi/esas2r/esas2r.h
@@ -972,7 +972,6 @@ u8 handle_hba_ioctl(struct esas2r_adapter *a,
972 struct atto_ioctl *ioctl_hba); 972 struct atto_ioctl *ioctl_hba);
973int esas2r_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd); 973int esas2r_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd);
974int esas2r_show_info(struct seq_file *m, struct Scsi_Host *sh); 974int esas2r_show_info(struct seq_file *m, struct Scsi_Host *sh);
975int esas2r_change_queue_depth(struct scsi_device *dev, int depth, int reason);
976long esas2r_proc_ioctl(struct file *fp, unsigned int cmd, unsigned long arg); 975long esas2r_proc_ioctl(struct file *fp, unsigned int cmd, unsigned long arg);
977 976
978/* SCSI error handler (eh) functions */ 977/* SCSI error handler (eh) functions */
diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
index 30fce64faf75..593ff8a63c70 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -254,7 +254,7 @@ static struct scsi_host_template driver_template = {
254 .use_clustering = ENABLE_CLUSTERING, 254 .use_clustering = ENABLE_CLUSTERING,
255 .emulated = 0, 255 .emulated = 0,
256 .proc_name = ESAS2R_DRVR_NAME, 256 .proc_name = ESAS2R_DRVR_NAME,
257 .change_queue_depth = esas2r_change_queue_depth, 257 .change_queue_depth = scsi_change_queue_depth,
258 .change_queue_type = scsi_change_queue_type, 258 .change_queue_type = scsi_change_queue_type,
259 .max_sectors = 0xFFFF, 259 .max_sectors = 0xFFFF,
260 .use_blk_tags = 1, 260 .use_blk_tags = 1,
@@ -1257,15 +1257,6 @@ int esas2r_target_reset(struct scsi_cmnd *cmd)
1257 return esas2r_dev_targ_reset(cmd, true); 1257 return esas2r_dev_targ_reset(cmd, true);
1258} 1258}
1259 1259
1260int esas2r_change_queue_depth(struct scsi_device *dev, int depth, int reason)
1261{
1262 esas2r_log(ESAS2R_LOG_INFO, "change_queue_depth %p, %d", dev, depth);
1263
1264 scsi_adjust_queue_depth(dev, depth);
1265
1266 return dev->queue_depth;
1267}
1268
1269void esas2r_log_request_failure(struct esas2r_adapter *a, 1260void esas2r_log_request_failure(struct esas2r_adapter *a,
1270 struct esas2r_request *rq) 1261 struct esas2r_request *rq)
1271{ 1262{
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 38c23e0b73af..7e7687f73deb 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2407,7 +2407,7 @@ static int esp_slave_configure(struct scsi_device *dev)
2407 /* XXX make this configurable somehow XXX */ 2407 /* XXX make this configurable somehow XXX */
2408 int goal_tags = min(ESP_DEFAULT_TAGS, ESP_MAX_TAG); 2408 int goal_tags = min(ESP_DEFAULT_TAGS, ESP_MAX_TAG);
2409 2409
2410 scsi_adjust_queue_depth(dev, goal_tags); 2410 scsi_change_queue_depth(dev, goal_tags);
2411 } 2411 }
2412 2412
2413 tp->flags |= ESP_TGT_DISCONNECT; 2413 tp->flags |= ESP_TGT_DISCONNECT;
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 97229860398f..308a016fdaea 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -280,7 +280,7 @@ static struct scsi_host_template fcoe_shost_template = {
280 .eh_device_reset_handler = fc_eh_device_reset, 280 .eh_device_reset_handler = fc_eh_device_reset,
281 .eh_host_reset_handler = fc_eh_host_reset, 281 .eh_host_reset_handler = fc_eh_host_reset,
282 .slave_alloc = fc_slave_alloc, 282 .slave_alloc = fc_slave_alloc,
283 .change_queue_depth = fc_change_queue_depth, 283 .change_queue_depth = scsi_change_queue_depth,
284 .change_queue_type = scsi_change_queue_type, 284 .change_queue_type = scsi_change_queue_type,
285 .this_id = -1, 285 .this_id = -1,
286 .cmd_per_lun = 3, 286 .cmd_per_lun = 3,
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 86b496c8633d..0c1f8177b5b7 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -98,7 +98,7 @@ static int fnic_slave_alloc(struct scsi_device *sdev)
98 if (!rport || fc_remote_port_chkready(rport)) 98 if (!rport || fc_remote_port_chkready(rport))
99 return -ENXIO; 99 return -ENXIO;
100 100
101 scsi_adjust_queue_depth(sdev, fnic_max_qdepth); 101 scsi_change_queue_depth(sdev, fnic_max_qdepth);
102 return 0; 102 return 0;
103} 103}
104 104
@@ -110,7 +110,7 @@ static struct scsi_host_template fnic_host_template = {
110 .eh_device_reset_handler = fnic_device_reset, 110 .eh_device_reset_handler = fnic_device_reset,
111 .eh_host_reset_handler = fnic_host_reset, 111 .eh_host_reset_handler = fnic_host_reset,
112 .slave_alloc = fnic_slave_alloc, 112 .slave_alloc = fnic_slave_alloc,
113 .change_queue_depth = fc_change_queue_depth, 113 .change_queue_depth = scsi_change_queue_depth,
114 .change_queue_type = scsi_change_queue_type, 114 .change_queue_type = scsi_change_queue_type,
115 .this_id = -1, 115 .this_id = -1,
116 .cmd_per_lun = 3, 116 .cmd_per_lun = 3,
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 617f218e2a16..6bb4611b238a 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -216,8 +216,6 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd);
216static void hpsa_scan_start(struct Scsi_Host *); 216static void hpsa_scan_start(struct Scsi_Host *);
217static int hpsa_scan_finished(struct Scsi_Host *sh, 217static int hpsa_scan_finished(struct Scsi_Host *sh,
218 unsigned long elapsed_time); 218 unsigned long elapsed_time);
219static int hpsa_change_queue_depth(struct scsi_device *sdev,
220 int qdepth, int reason);
221 219
222static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd); 220static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd);
223static int hpsa_eh_abort_handler(struct scsi_cmnd *scsicmd); 221static int hpsa_eh_abort_handler(struct scsi_cmnd *scsicmd);
@@ -673,7 +671,7 @@ static struct scsi_host_template hpsa_driver_template = {
673 .queuecommand = hpsa_scsi_queue_command, 671 .queuecommand = hpsa_scsi_queue_command,
674 .scan_start = hpsa_scan_start, 672 .scan_start = hpsa_scan_start,
675 .scan_finished = hpsa_scan_finished, 673 .scan_finished = hpsa_scan_finished,
676 .change_queue_depth = hpsa_change_queue_depth, 674 .change_queue_depth = scsi_change_queue_depth,
677 .this_id = -1, 675 .this_id = -1,
678 .use_clustering = ENABLE_CLUSTERING, 676 .use_clustering = ENABLE_CLUSTERING,
679 .eh_abort_handler = hpsa_eh_abort_handler, 677 .eh_abort_handler = hpsa_eh_abort_handler,
@@ -4074,18 +4072,6 @@ static int hpsa_scan_finished(struct Scsi_Host *sh,
4074 return finished; 4072 return finished;
4075} 4073}
4076 4074
4077static int hpsa_change_queue_depth(struct scsi_device *sdev,
4078 int qdepth, int reason)
4079{
4080 struct ctlr_info *h = sdev_to_hba(sdev);
4081
4082 if (reason != SCSI_QDEPTH_DEFAULT)
4083 return -ENOTSUPP;
4084
4085 scsi_adjust_queue_depth(sdev, qdepth);
4086 return sdev->queue_depth;
4087}
4088
4089static void hpsa_unregister_scsi(struct ctlr_info *h) 4075static void hpsa_unregister_scsi(struct ctlr_info *h)
4090{ 4076{
4091 /* we are being forcibly unloaded, and may not refuse. */ 4077 /* we are being forcibly unloaded, and may not refuse. */
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 151893148abd..e995218476ed 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -1118,17 +1118,13 @@ static int hptiop_reset(struct scsi_cmnd *scp)
1118} 1118}
1119 1119
1120static int hptiop_adjust_disk_queue_depth(struct scsi_device *sdev, 1120static int hptiop_adjust_disk_queue_depth(struct scsi_device *sdev,
1121 int queue_depth, int reason) 1121 int queue_depth)
1122{ 1122{
1123 struct hptiop_hba *hba = (struct hptiop_hba *)sdev->host->hostdata; 1123 struct hptiop_hba *hba = (struct hptiop_hba *)sdev->host->hostdata;
1124 1124
1125 if (reason != SCSI_QDEPTH_DEFAULT)
1126 return -EOPNOTSUPP;
1127
1128 if (queue_depth > hba->max_requests) 1125 if (queue_depth > hba->max_requests)
1129 queue_depth = hba->max_requests; 1126 queue_depth = hba->max_requests;
1130 scsi_adjust_queue_depth(sdev, queue_depth); 1127 return scsi_change_queue_depth(sdev, queue_depth);
1131 return queue_depth;
1132} 1128}
1133 1129
1134static ssize_t hptiop_show_version(struct device *dev, 1130static ssize_t hptiop_show_version(struct device *dev,
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 381449d5be76..f58c6d8e0264 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -2900,17 +2900,12 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev)
2900 * Return value: 2900 * Return value:
2901 * actual depth set 2901 * actual depth set
2902 **/ 2902 **/
2903static int ibmvfc_change_queue_depth(struct scsi_device *sdev, int qdepth, 2903static int ibmvfc_change_queue_depth(struct scsi_device *sdev, int qdepth)
2904 int reason)
2905{ 2904{
2906 if (reason != SCSI_QDEPTH_DEFAULT)
2907 return -EOPNOTSUPP;
2908
2909 if (qdepth > IBMVFC_MAX_CMDS_PER_LUN) 2905 if (qdepth > IBMVFC_MAX_CMDS_PER_LUN)
2910 qdepth = IBMVFC_MAX_CMDS_PER_LUN; 2906 qdepth = IBMVFC_MAX_CMDS_PER_LUN;
2911 2907
2912 scsi_adjust_queue_depth(sdev, qdepth); 2908 return scsi_change_queue_depth(sdev, qdepth);
2913 return sdev->queue_depth;
2914} 2909}
2915 2910
2916static ssize_t ibmvfc_show_host_partition_name(struct device *dev, 2911static ssize_t ibmvfc_show_host_partition_name(struct device *dev,
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index e8c3cdf0d03b..acea5d6eebd0 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -1941,17 +1941,11 @@ static int ibmvscsi_slave_configure(struct scsi_device *sdev)
1941 * Return value: 1941 * Return value:
1942 * actual depth set 1942 * actual depth set
1943 **/ 1943 **/
1944static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth, 1944static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth)
1945 int reason)
1946{ 1945{
1947 if (reason != SCSI_QDEPTH_DEFAULT)
1948 return -EOPNOTSUPP;
1949
1950 if (qdepth > IBMVSCSI_MAX_CMDS_PER_LUN) 1946 if (qdepth > IBMVSCSI_MAX_CMDS_PER_LUN)
1951 qdepth = IBMVSCSI_MAX_CMDS_PER_LUN; 1947 qdepth = IBMVSCSI_MAX_CMDS_PER_LUN;
1952 1948 return scsi_change_queue_depth(sdev, qdepth);
1953 scsi_adjust_queue_depth(sdev, qdepth);
1954 return sdev->queue_depth;
1955} 1949}
1956 1950
1957/* ------------------------------------------------------------ 1951/* ------------------------------------------------------------
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index d8d16625a876..540294389355 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -4328,16 +4328,12 @@ static int ipr_free_dump(struct ipr_ioa_cfg *ioa_cfg) { return 0; };
4328 * Return value: 4328 * Return value:
4329 * actual depth set 4329 * actual depth set
4330 **/ 4330 **/
4331static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth, 4331static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth)
4332 int reason)
4333{ 4332{
4334 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata; 4333 struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)sdev->host->hostdata;
4335 struct ipr_resource_entry *res; 4334 struct ipr_resource_entry *res;
4336 unsigned long lock_flags = 0; 4335 unsigned long lock_flags = 0;
4337 4336
4338 if (reason != SCSI_QDEPTH_DEFAULT)
4339 return -EOPNOTSUPP;
4340
4341 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); 4337 spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
4342 res = (struct ipr_resource_entry *)sdev->hostdata; 4338 res = (struct ipr_resource_entry *)sdev->hostdata;
4343 4339
@@ -4345,7 +4341,7 @@ static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth,
4345 qdepth = IPR_MAX_CMD_PER_ATA_LUN; 4341 qdepth = IPR_MAX_CMD_PER_ATA_LUN;
4346 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 4342 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
4347 4343
4348 scsi_adjust_queue_depth(sdev, qdepth); 4344 scsi_change_queue_depth(sdev, qdepth);
4349 return sdev->queue_depth; 4345 return sdev->queue_depth;
4350} 4346}
4351 4347
@@ -4752,7 +4748,7 @@ static int ipr_slave_configure(struct scsi_device *sdev)
4752 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); 4748 spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
4753 4749
4754 if (ap) { 4750 if (ap) {
4755 scsi_adjust_queue_depth(sdev, IPR_MAX_CMD_PER_ATA_LUN); 4751 scsi_change_queue_depth(sdev, IPR_MAX_CMD_PER_ATA_LUN);
4756 ata_sas_slave_configure(sdev, ap); 4752 ata_sas_slave_configure(sdev, ap);
4757 } 4753 }
4758 4754
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 454741a8da45..e5c28435d768 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -1210,7 +1210,7 @@ ips_slave_configure(struct scsi_device * SDptr)
1210 min = ha->max_cmds / 2; 1210 min = ha->max_cmds / 2;
1211 if (ha->enq->ucLogDriveCount <= 2) 1211 if (ha->enq->ucLogDriveCount <= 2)
1212 min = ha->max_cmds - 1; 1212 min = ha->max_cmds - 1;
1213 scsi_adjust_queue_depth(SDptr, min); 1213 scsi_change_queue_depth(SDptr, min);
1214 } 1214 }
1215 1215
1216 SDptr->skip_ms_page_8 = 1; 1216 SDptr->skip_ms_page_8 = 1;
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index a575d845b667..0b8af186e707 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -952,7 +952,7 @@ static struct scsi_host_template iscsi_sw_tcp_sht = {
952 .module = THIS_MODULE, 952 .module = THIS_MODULE,
953 .name = "iSCSI Initiator over TCP/IP", 953 .name = "iSCSI Initiator over TCP/IP",
954 .queuecommand = iscsi_queuecommand, 954 .queuecommand = iscsi_queuecommand,
955 .change_queue_depth = iscsi_change_queue_depth, 955 .change_queue_depth = scsi_change_queue_depth,
956 .can_queue = ISCSI_DEF_XMIT_CMDS_MAX - 1, 956 .can_queue = ISCSI_DEF_XMIT_CMDS_MAX - 1,
957 .sg_tablesize = 4096, 957 .sg_tablesize = 4096,
958 .max_sectors = 0xFFFF, 958 .max_sectors = 0xFFFF,
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 0d2d024e77c5..c6795941b45d 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -2160,25 +2160,12 @@ int fc_slave_alloc(struct scsi_device *sdev)
2160 if (!rport || fc_remote_port_chkready(rport)) 2160 if (!rport || fc_remote_port_chkready(rport))
2161 return -ENXIO; 2161 return -ENXIO;
2162 2162
2163 scsi_adjust_queue_depth(sdev, FC_FCP_DFLT_QUEUE_DEPTH); 2163 scsi_change_queue_depth(sdev, FC_FCP_DFLT_QUEUE_DEPTH);
2164 return 0; 2164 return 0;
2165} 2165}
2166EXPORT_SYMBOL(fc_slave_alloc); 2166EXPORT_SYMBOL(fc_slave_alloc);
2167 2167
2168/** 2168/**
2169 * fc_change_queue_depth() - Change a device's queue depth
2170 * @sdev: The SCSI device whose queue depth is to change
2171 * @qdepth: The new queue depth
2172 * @reason: The resason for the change
2173 */
2174int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
2175{
2176 scsi_adjust_queue_depth(sdev, qdepth);
2177 return sdev->queue_depth;
2178}
2179EXPORT_SYMBOL(fc_change_queue_depth);
2180
2181/**
2182 * fc_fcp_destory() - Tear down the FCP layer for a given local port 2169 * fc_fcp_destory() - Tear down the FCP layer for a given local port
2183 * @lport: The local port that no longer needs the FCP layer 2170 * @lport: The local port that no longer needs the FCP layer
2184 */ 2171 */
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 79e977484ad5..8053f24f0349 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1771,13 +1771,6 @@ fault:
1771} 1771}
1772EXPORT_SYMBOL_GPL(iscsi_queuecommand); 1772EXPORT_SYMBOL_GPL(iscsi_queuecommand);
1773 1773
1774int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, int reason)
1775{
1776 scsi_adjust_queue_depth(sdev, depth);
1777 return sdev->queue_depth;
1778}
1779EXPORT_SYMBOL_GPL(iscsi_change_queue_depth);
1780
1781int iscsi_target_alloc(struct scsi_target *starget) 1774int iscsi_target_alloc(struct scsi_target *starget)
1782{ 1775{
1783 struct iscsi_cls_session *cls_session = starget_to_session(starget); 1776 struct iscsi_cls_session *cls_session = starget_to_session(starget);
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 914e41165137..b492293d51f2 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -940,12 +940,12 @@ int sas_slave_configure(struct scsi_device *scsi_dev)
940 sas_read_port_mode_page(scsi_dev); 940 sas_read_port_mode_page(scsi_dev);
941 941
942 if (scsi_dev->tagged_supported) { 942 if (scsi_dev->tagged_supported) {
943 scsi_adjust_queue_depth(scsi_dev, SAS_DEF_QD); 943 scsi_change_queue_depth(scsi_dev, SAS_DEF_QD);
944 } else { 944 } else {
945 SAS_DPRINTK("device %llx, LUN %llx doesn't support " 945 SAS_DPRINTK("device %llx, LUN %llx doesn't support "
946 "TCQ\n", SAS_ADDR(dev->sas_addr), 946 "TCQ\n", SAS_ADDR(dev->sas_addr),
947 scsi_dev->lun); 947 scsi_dev->lun);
948 scsi_adjust_queue_depth(scsi_dev, 1); 948 scsi_change_queue_depth(scsi_dev, 1);
949 } 949 }
950 950
951 scsi_dev->allow_restart = 1; 951 scsi_dev->allow_restart = 1;
@@ -953,18 +953,16 @@ int sas_slave_configure(struct scsi_device *scsi_dev)
953 return 0; 953 return 0;
954} 954}
955 955
956int sas_change_queue_depth(struct scsi_device *sdev, int depth, int reason) 956int sas_change_queue_depth(struct scsi_device *sdev, int depth)
957{ 957{
958 struct domain_device *dev = sdev_to_domain_dev(sdev); 958 struct domain_device *dev = sdev_to_domain_dev(sdev);
959 959
960 if (dev_is_sata(dev)) 960 if (dev_is_sata(dev))
961 return __ata_change_queue_depth(dev->sata_dev.ap, sdev, depth, 961 return __ata_change_queue_depth(dev->sata_dev.ap, sdev, depth);
962 reason);
963 962
964 if (!sdev->tagged_supported) 963 if (!sdev->tagged_supported)
965 depth = 1; 964 depth = 1;
966 scsi_adjust_queue_depth(sdev, depth); 965 return scsi_change_queue_depth(sdev, depth);
967 return depth;
968} 966}
969 967
970int sas_change_queue_type(struct scsi_device *scsi_dev, int type) 968int sas_change_queue_type(struct scsi_device *scsi_dev, int type)
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 522854920369..fd85952b621d 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -243,23 +243,6 @@ lpfc_update_stats(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
243} 243}
244 244
245/** 245/**
246 * lpfc_change_queue_depth - Alter scsi device queue depth
247 * @sdev: Pointer the scsi device on which to change the queue depth.
248 * @qdepth: New queue depth to set the sdev to.
249 * @reason: The reason for the queue depth change.
250 *
251 * This function is called by the midlayer and the LLD to alter the queue
252 * depth for a scsi device. This function sets the queue depth to the new
253 * value and sends an event out to log the queue depth change.
254 **/
255static int
256lpfc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
257{
258 scsi_adjust_queue_depth(sdev, qdepth);
259 return sdev->queue_depth;
260}
261
262/**
263 * lpfc_rampdown_queue_depth - Post RAMP_DOWN_QUEUE event to worker thread 246 * lpfc_rampdown_queue_depth - Post RAMP_DOWN_QUEUE event to worker thread
264 * @phba: The Hba for which this call is being executed. 247 * @phba: The Hba for which this call is being executed.
265 * 248 *
@@ -344,8 +327,7 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
344 else 327 else
345 new_queue_depth = sdev->queue_depth - 328 new_queue_depth = sdev->queue_depth -
346 new_queue_depth; 329 new_queue_depth;
347 lpfc_change_queue_depth(sdev, new_queue_depth, 330 scsi_change_queue_depth(sdev, new_queue_depth);
348 SCSI_QDEPTH_DEFAULT);
349 } 331 }
350 } 332 }
351 lpfc_destroy_vport_work_array(phba, vports); 333 lpfc_destroy_vport_work_array(phba, vports);
@@ -5513,7 +5495,7 @@ lpfc_slave_configure(struct scsi_device *sdev)
5513 struct lpfc_vport *vport = (struct lpfc_vport *) sdev->host->hostdata; 5495 struct lpfc_vport *vport = (struct lpfc_vport *) sdev->host->hostdata;
5514 struct lpfc_hba *phba = vport->phba; 5496 struct lpfc_hba *phba = vport->phba;
5515 5497
5516 scsi_adjust_queue_depth(sdev, vport->cfg_lun_queue_depth); 5498 scsi_change_queue_depth(sdev, vport->cfg_lun_queue_depth);
5517 5499
5518 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) { 5500 if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) {
5519 lpfc_sli_handle_fast_ring_event(phba, 5501 lpfc_sli_handle_fast_ring_event(phba,
@@ -5896,7 +5878,7 @@ struct scsi_host_template lpfc_template = {
5896 .shost_attrs = lpfc_hba_attrs, 5878 .shost_attrs = lpfc_hba_attrs,
5897 .max_sectors = 0xFFFF, 5879 .max_sectors = 0xFFFF,
5898 .vendor_id = LPFC_NL_VENDOR_ID, 5880 .vendor_id = LPFC_NL_VENDOR_ID,
5899 .change_queue_depth = lpfc_change_queue_depth, 5881 .change_queue_depth = scsi_change_queue_depth,
5900 .change_queue_type = scsi_change_queue_type, 5882 .change_queue_type = scsi_change_queue_type,
5901 .use_blk_tags = 1, 5883 .use_blk_tags = 1,
5902 .track_queue_depth = 1, 5884 .track_queue_depth = 1,
@@ -5921,7 +5903,7 @@ struct scsi_host_template lpfc_vport_template = {
5921 .use_clustering = ENABLE_CLUSTERING, 5903 .use_clustering = ENABLE_CLUSTERING,
5922 .shost_attrs = lpfc_vport_attrs, 5904 .shost_attrs = lpfc_vport_attrs,
5923 .max_sectors = 0xFFFF, 5905 .max_sectors = 0xFFFF,
5924 .change_queue_depth = lpfc_change_queue_depth, 5906 .change_queue_depth = scsi_change_queue_depth,
5925 .change_queue_type = scsi_change_queue_type, 5907 .change_queue_type = scsi_change_queue_type,
5926 .use_blk_tags = 1, 5908 .use_blk_tags = 1,
5927 .track_queue_depth = 1, 5909 .track_queue_depth = 1,
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index d56eb9d3d40c..f0987f22ea70 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -332,25 +332,6 @@ static struct device_attribute *megaraid_sdev_attrs[] = {
332 NULL, 332 NULL,
333}; 333};
334 334
335/**
336 * megaraid_change_queue_depth - Change the device's queue depth
337 * @sdev: scsi device struct
338 * @qdepth: depth to set
339 * @reason: calling context
340 *
341 * Return value:
342 * actual depth set
343 */
344static int megaraid_change_queue_depth(struct scsi_device *sdev, int qdepth,
345 int reason)
346{
347 if (reason != SCSI_QDEPTH_DEFAULT)
348 return -EOPNOTSUPP;
349
350 scsi_adjust_queue_depth(sdev, qdepth);
351 return sdev->queue_depth;
352}
353
354/* 335/*
355 * Scsi host template for megaraid unified driver 336 * Scsi host template for megaraid unified driver
356 */ 337 */
@@ -363,7 +344,7 @@ static struct scsi_host_template megaraid_template_g = {
363 .eh_device_reset_handler = megaraid_reset_handler, 344 .eh_device_reset_handler = megaraid_reset_handler,
364 .eh_bus_reset_handler = megaraid_reset_handler, 345 .eh_bus_reset_handler = megaraid_reset_handler,
365 .eh_host_reset_handler = megaraid_reset_handler, 346 .eh_host_reset_handler = megaraid_reset_handler,
366 .change_queue_depth = megaraid_change_queue_depth, 347 .change_queue_depth = scsi_change_queue_depth,
367 .use_clustering = ENABLE_CLUSTERING, 348 .use_clustering = ENABLE_CLUSTERING,
368 .no_write_same = 1, 349 .no_write_same = 1,
369 .sdev_attrs = megaraid_sdev_attrs, 350 .sdev_attrs = megaraid_sdev_attrs,
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 69a9dd6ae04c..f05580e693d0 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -2591,17 +2591,6 @@ megasas_service_aen(struct megasas_instance *instance, struct megasas_cmd *cmd)
2591 } 2591 }
2592} 2592}
2593 2593
2594static int megasas_change_queue_depth(struct scsi_device *sdev,
2595 int queue_depth, int reason)
2596{
2597 if (reason != SCSI_QDEPTH_DEFAULT)
2598 return -EOPNOTSUPP;
2599
2600 scsi_adjust_queue_depth(sdev, queue_depth);
2601
2602 return queue_depth;
2603}
2604
2605static ssize_t 2594static ssize_t
2606megasas_fw_crash_buffer_store(struct device *cdev, 2595megasas_fw_crash_buffer_store(struct device *cdev,
2607 struct device_attribute *attr, const char *buf, size_t count) 2596 struct device_attribute *attr, const char *buf, size_t count)
@@ -2766,7 +2755,7 @@ static struct scsi_host_template megasas_template = {
2766 .shost_attrs = megaraid_host_attrs, 2755 .shost_attrs = megaraid_host_attrs,
2767 .bios_param = megasas_bios_param, 2756 .bios_param = megasas_bios_param,
2768 .use_clustering = ENABLE_CLUSTERING, 2757 .use_clustering = ENABLE_CLUSTERING,
2769 .change_queue_depth = megasas_change_queue_depth, 2758 .change_queue_depth = scsi_change_queue_depth,
2770 .no_write_same = 1, 2759 .no_write_same = 1,
2771}; 2760};
2772 2761
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index b006e1e9fcb8..12229de433bf 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -1222,20 +1222,18 @@ _scsih_adjust_queue_depth(struct scsi_device *sdev, int qdepth)
1222 max_depth = 1; 1222 max_depth = 1;
1223 if (qdepth > max_depth) 1223 if (qdepth > max_depth)
1224 qdepth = max_depth; 1224 qdepth = max_depth;
1225 scsi_adjust_queue_depth(sdev, qdepth); 1225 scsi_change_queue_depth(sdev, qdepth);
1226} 1226}
1227 1227
1228/** 1228/**
1229 * _scsih_change_queue_depth - setting device queue depth 1229 * _scsih_change_queue_depth - setting device queue depth
1230 * @sdev: scsi device struct 1230 * @sdev: scsi device struct
1231 * @qdepth: requested queue depth 1231 * @qdepth: requested queue depth
1232 * @reason: SCSI_QDEPTH_DEFAULT
1233 * (see include/scsi/scsi_host.h for definition)
1234 * 1232 *
1235 * Returns queue depth. 1233 * Returns queue depth.
1236 */ 1234 */
1237static int 1235static int
1238_scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) 1236_scsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
1239{ 1237{
1240 _scsih_adjust_queue_depth(sdev, qdepth); 1238 _scsih_adjust_queue_depth(sdev, qdepth);
1241 1239
@@ -2077,7 +2075,7 @@ _scsih_slave_configure(struct scsi_device *sdev)
2077 r_level, raid_device->handle, 2075 r_level, raid_device->handle,
2078 (unsigned long long)raid_device->wwid, 2076 (unsigned long long)raid_device->wwid,
2079 raid_device->num_pds, ds); 2077 raid_device->num_pds, ds);
2080 _scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_DEFAULT); 2078 _scsih_change_queue_depth(sdev, qdepth);
2081 /* raid transport support */ 2079 /* raid transport support */
2082 if (!ioc->is_warpdrive) 2080 if (!ioc->is_warpdrive)
2083 _scsih_set_level(sdev, raid_device->volume_type); 2081 _scsih_set_level(sdev, raid_device->volume_type);
@@ -2142,7 +2140,7 @@ _scsih_slave_configure(struct scsi_device *sdev)
2142 _scsih_display_sata_capabilities(ioc, handle, sdev); 2140 _scsih_display_sata_capabilities(ioc, handle, sdev);
2143 2141
2144 2142
2145 _scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_DEFAULT); 2143 _scsih_change_queue_depth(sdev, qdepth);
2146 2144
2147 if (ssp_target) { 2145 if (ssp_target) {
2148 sas_read_port_mode_page(sdev); 2146 sas_read_port_mode_page(sdev);
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 568dcaed36cb..de175b9915e2 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -1090,20 +1090,18 @@ _scsih_adjust_queue_depth(struct scsi_device *sdev, int qdepth)
1090 max_depth = 1; 1090 max_depth = 1;
1091 if (qdepth > max_depth) 1091 if (qdepth > max_depth)
1092 qdepth = max_depth; 1092 qdepth = max_depth;
1093 scsi_adjust_queue_depth(sdev, qdepth); 1093 scsi_change_queue_depth(sdev, qdepth);
1094} 1094}
1095 1095
1096/** 1096/**
1097 * _scsih_change_queue_depth - setting device queue depth 1097 * _scsih_change_queue_depth - setting device queue depth
1098 * @sdev: scsi device struct 1098 * @sdev: scsi device struct
1099 * @qdepth: requested queue depth 1099 * @qdepth: requested queue depth
1100 * @reason: SCSI_QDEPTH_DEFAULT
1101 * (see include/scsi/scsi_host.h for definition)
1102 * 1100 *
1103 * Returns queue depth. 1101 * Returns queue depth.
1104 */ 1102 */
1105static int 1103static int
1106_scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) 1104_scsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
1107{ 1105{
1108 _scsih_adjust_queue_depth(sdev, qdepth); 1106 _scsih_adjust_queue_depth(sdev, qdepth);
1109 1107
@@ -1734,7 +1732,7 @@ _scsih_slave_configure(struct scsi_device *sdev)
1734 raid_device->num_pds, ds); 1732 raid_device->num_pds, ds);
1735 1733
1736 1734
1737 _scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_DEFAULT); 1735 _scsih_change_queue_depth(sdev, qdepth);
1738 1736
1739/* raid transport support */ 1737/* raid transport support */
1740 _scsih_set_level(sdev, raid_device->volume_type); 1738 _scsih_set_level(sdev, raid_device->volume_type);
@@ -1800,7 +1798,7 @@ _scsih_slave_configure(struct scsi_device *sdev)
1800 _scsih_display_sata_capabilities(ioc, handle, sdev); 1798 _scsih_display_sata_capabilities(ioc, handle, sdev);
1801 1799
1802 1800
1803 _scsih_change_queue_depth(sdev, qdepth, SCSI_QDEPTH_DEFAULT); 1801 _scsih_change_queue_depth(sdev, qdepth);
1804 1802
1805 if (ssp_target) { 1803 if (ssp_target) {
1806 sas_read_port_mode_page(sdev); 1804 sas_read_port_mode_page(sdev);
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index 9c331b7bfdcd..5b93ed810f6e 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -7997,7 +7997,7 @@ static int ncr53c8xx_slave_configure(struct scsi_device *device)
7997 if (depth_to_use > MAX_TAGS) 7997 if (depth_to_use > MAX_TAGS)
7998 depth_to_use = MAX_TAGS; 7998 depth_to_use = MAX_TAGS;
7999 7999
8000 scsi_adjust_queue_depth(device, depth_to_use); 8000 scsi_change_queue_depth(device, depth_to_use);
8001 8001
8002 /* 8002 /*
8003 ** Since the queue depth is not tunable under Linux, 8003 ** Since the queue depth is not tunable under Linux,
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index d8b9ba251fbd..b1b1f66b1ab7 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -285,23 +285,15 @@ static void pmcraid_slave_destroy(struct scsi_device *scsi_dev)
285 * pmcraid_change_queue_depth - Change the device's queue depth 285 * pmcraid_change_queue_depth - Change the device's queue depth
286 * @scsi_dev: scsi device struct 286 * @scsi_dev: scsi device struct
287 * @depth: depth to set 287 * @depth: depth to set
288 * @reason: calling context
289 * 288 *
290 * Return value 289 * Return value
291 * actual depth set 290 * actual depth set
292 */ 291 */
293static int pmcraid_change_queue_depth(struct scsi_device *scsi_dev, int depth, 292static int pmcraid_change_queue_depth(struct scsi_device *scsi_dev, int depth)
294 int reason)
295{ 293{
296 if (reason != SCSI_QDEPTH_DEFAULT)
297 return -EOPNOTSUPP;
298
299 if (depth > PMCRAID_MAX_CMD_PER_LUN) 294 if (depth > PMCRAID_MAX_CMD_PER_LUN)
300 depth = PMCRAID_MAX_CMD_PER_LUN; 295 depth = PMCRAID_MAX_CMD_PER_LUN;
301 296 return scsi_change_queue_depth(scsi_dev, depth);
302 scsi_adjust_queue_depth(scsi_dev, depth);
303
304 return scsi_dev->queue_depth;
305} 297}
306 298
307/** 299/**
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index adedb6ef8eec..c68a66e8cfc1 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -1224,9 +1224,9 @@ qla1280_slave_configure(struct scsi_device *device)
1224 1224
1225 if (device->tagged_supported && 1225 if (device->tagged_supported &&
1226 (ha->bus_settings[bus].qtag_enables & (BIT_0 << target))) { 1226 (ha->bus_settings[bus].qtag_enables & (BIT_0 << target))) {
1227 scsi_adjust_queue_depth(device, ha->bus_settings[bus].hiwat); 1227 scsi_change_queue_depth(device, ha->bus_settings[bus].hiwat);
1228 } else { 1228 } else {
1229 scsi_adjust_queue_depth(device, default_depth); 1229 scsi_change_queue_depth(device, default_depth);
1230 } 1230 }
1231 1231
1232 nv->bus[bus].target[target].parameter.enable_sync = device->sdtr; 1232 nv->bus[bus].target[target].parameter.enable_sync = device->sdtr;
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 20049b176b64..6b4d9235368a 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -236,7 +236,6 @@ static int qla2xxx_eh_target_reset(struct scsi_cmnd *);
236static int qla2xxx_eh_bus_reset(struct scsi_cmnd *); 236static int qla2xxx_eh_bus_reset(struct scsi_cmnd *);
237static int qla2xxx_eh_host_reset(struct scsi_cmnd *); 237static int qla2xxx_eh_host_reset(struct scsi_cmnd *);
238 238
239static int qla2x00_change_queue_depth(struct scsi_device *, int, int);
240static void qla2x00_clear_drv_active(struct qla_hw_data *); 239static void qla2x00_clear_drv_active(struct qla_hw_data *);
241static void qla2x00_free_device(scsi_qla_host_t *); 240static void qla2x00_free_device(scsi_qla_host_t *);
242static void qla83xx_disable_laser(scsi_qla_host_t *vha); 241static void qla83xx_disable_laser(scsi_qla_host_t *vha);
@@ -258,7 +257,7 @@ struct scsi_host_template qla2xxx_driver_template = {
258 .slave_destroy = qla2xxx_slave_destroy, 257 .slave_destroy = qla2xxx_slave_destroy,
259 .scan_finished = qla2xxx_scan_finished, 258 .scan_finished = qla2xxx_scan_finished,
260 .scan_start = qla2xxx_scan_start, 259 .scan_start = qla2xxx_scan_start,
261 .change_queue_depth = qla2x00_change_queue_depth, 260 .change_queue_depth = scsi_change_queue_depth,
262 .change_queue_type = scsi_change_queue_type, 261 .change_queue_type = scsi_change_queue_type,
263 .this_id = -1, 262 .this_id = -1,
264 .cmd_per_lun = 3, 263 .cmd_per_lun = 3,
@@ -1406,7 +1405,7 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
1406 if (IS_T10_PI_CAPABLE(vha->hw)) 1405 if (IS_T10_PI_CAPABLE(vha->hw))
1407 blk_queue_update_dma_alignment(sdev->request_queue, 0x7); 1406 blk_queue_update_dma_alignment(sdev->request_queue, 0x7);
1408 1407
1409 scsi_adjust_queue_depth(sdev, req->max_q_depth); 1408 scsi_change_queue_depth(sdev, req->max_q_depth);
1410 return 0; 1409 return 0;
1411} 1410}
1412 1411
@@ -1416,13 +1415,6 @@ qla2xxx_slave_destroy(struct scsi_device *sdev)
1416 sdev->hostdata = NULL; 1415 sdev->hostdata = NULL;
1417} 1416}
1418 1417
1419static int
1420qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
1421{
1422 scsi_adjust_queue_depth(sdev, qdepth);
1423 return sdev->queue_depth;
1424}
1425
1426/** 1418/**
1427 * qla2x00_config_dma_addressing() - Configure OS DMA addressing method. 1419 * qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
1428 * @ha: HA context 1420 * @ha: HA context
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 2bfde373ea2b..6d25879d87c8 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -201,7 +201,7 @@ static struct scsi_host_template qla4xxx_driver_template = {
201 .eh_timed_out = qla4xxx_eh_cmd_timed_out, 201 .eh_timed_out = qla4xxx_eh_cmd_timed_out,
202 202
203 .slave_alloc = qla4xxx_slave_alloc, 203 .slave_alloc = qla4xxx_slave_alloc,
204 .change_queue_depth = iscsi_change_queue_depth, 204 .change_queue_depth = scsi_change_queue_depth,
205 205
206 .this_id = -1, 206 .this_id = -1,
207 .cmd_per_lun = 3, 207 .cmd_per_lun = 3,
@@ -9059,7 +9059,7 @@ static int qla4xxx_slave_alloc(struct scsi_device *sdev)
9059 if (ql4xmaxqdepth != 0 && ql4xmaxqdepth <= 0xffffU) 9059 if (ql4xmaxqdepth != 0 && ql4xmaxqdepth <= 0xffffU)
9060 queue_depth = ql4xmaxqdepth; 9060 queue_depth = ql4xmaxqdepth;
9061 9061
9062 scsi_adjust_queue_depth(sdev, queue_depth); 9062 scsi_change_queue_depth(sdev, queue_depth);
9063 return 0; 9063 return 0;
9064} 9064}
9065 9065
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 106fa2f886d2..5ea15fc7d2fb 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -742,30 +742,18 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
742} 742}
743 743
744/** 744/**
745 * scsi_adjust_queue_depth - Let low level drivers change a device's queue depth 745 * scsi_change_queue_depth - change a device's queue depth
746 * @sdev: SCSI Device in question 746 * @sdev: SCSI Device in question
747 * @tags: Number of tags allowed if tagged queueing enabled, 747 * @depth: number of commands allowed to be queued to the driver
748 * or number of commands the low level driver can
749 * queue up in non-tagged mode (as per cmd_per_lun).
750 * 748 *
751 * Returns: Nothing 749 * Sets the device queue depth and returns the new value.
752 *
753 * Lock Status: None held on entry
754 *
755 * Notes: Low level drivers may call this at any time and we will do
756 * the right thing depending on whether or not the device is
757 * currently active and whether or not it even has the
758 * command blocks built yet.
759 */ 750 */
760void scsi_adjust_queue_depth(struct scsi_device *sdev, int tags) 751int scsi_change_queue_depth(struct scsi_device *sdev, int depth)
761{ 752{
762 unsigned long flags; 753 unsigned long flags;
763 754
764 /* 755 if (depth <= 0)
765 * refuse to set tagged depth to an unworkable size 756 goto out;
766 */
767 if (tags <= 0)
768 return;
769 757
770 spin_lock_irqsave(sdev->request_queue->queue_lock, flags); 758 spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
771 759
@@ -780,15 +768,17 @@ void scsi_adjust_queue_depth(struct scsi_device *sdev, int tags)
780 */ 768 */
781 if (!shost_use_blk_mq(sdev->host) && !sdev->host->bqt) { 769 if (!shost_use_blk_mq(sdev->host) && !sdev->host->bqt) {
782 if (blk_queue_tagged(sdev->request_queue) && 770 if (blk_queue_tagged(sdev->request_queue) &&
783 blk_queue_resize_tags(sdev->request_queue, tags) != 0) 771 blk_queue_resize_tags(sdev->request_queue, depth) != 0)
784 goto out; 772 goto out_unlock;
785 } 773 }
786 774
787 sdev->queue_depth = tags; 775 sdev->queue_depth = depth;
788 out: 776out_unlock:
789 spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); 777 spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
778out:
779 return sdev->queue_depth;
790} 780}
791EXPORT_SYMBOL(scsi_adjust_queue_depth); 781EXPORT_SYMBOL(scsi_change_queue_depth);
792 782
793/** 783/**
794 * scsi_track_queue_full - track QUEUE_FULL events to adjust queue depth 784 * scsi_track_queue_full - track QUEUE_FULL events to adjust queue depth
@@ -833,12 +823,11 @@ int scsi_track_queue_full(struct scsi_device *sdev, int depth)
833 if (sdev->last_queue_full_depth < 8) { 823 if (sdev->last_queue_full_depth < 8) {
834 /* Drop back to untagged */ 824 /* Drop back to untagged */
835 scsi_set_tag_type(sdev, 0); 825 scsi_set_tag_type(sdev, 0);
836 scsi_adjust_queue_depth(sdev, sdev->host->cmd_per_lun); 826 scsi_change_queue_depth(sdev, sdev->host->cmd_per_lun);
837 return -1; 827 return -1;
838 } 828 }
839 829
840 scsi_adjust_queue_depth(sdev, depth); 830 return scsi_change_queue_depth(sdev, depth);
841 return depth;
842} 831}
843EXPORT_SYMBOL(scsi_track_queue_full); 832EXPORT_SYMBOL(scsi_track_queue_full);
844 833
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 84cf82e0782d..ce71b6d4393c 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -4469,7 +4469,7 @@ sdebug_queuecommand_lock_or_not(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
4469} 4469}
4470 4470
4471static int 4471static int
4472sdebug_change_qdepth(struct scsi_device *sdev, int qdepth, int reason) 4472sdebug_change_qdepth(struct scsi_device *sdev, int qdepth)
4473{ 4473{
4474 int num_in_q = 0; 4474 int num_in_q = 0;
4475 unsigned long iflags; 4475 unsigned long iflags;
@@ -4489,7 +4489,7 @@ sdebug_change_qdepth(struct scsi_device *sdev, int qdepth, int reason)
4489 /* allow to exceed max host queued_arr elements for testing */ 4489 /* allow to exceed max host queued_arr elements for testing */
4490 if (qdepth > SCSI_DEBUG_CANQUEUE + 10) 4490 if (qdepth > SCSI_DEBUG_CANQUEUE + 10)
4491 qdepth = SCSI_DEBUG_CANQUEUE + 10; 4491 qdepth = SCSI_DEBUG_CANQUEUE + 10;
4492 scsi_adjust_queue_depth(sdev, qdepth); 4492 scsi_change_queue_depth(sdev, qdepth);
4493 4493
4494 if (SCSI_DEBUG_OPT_Q_NOISE & scsi_debug_opts) { 4494 if (SCSI_DEBUG_OPT_Q_NOISE & scsi_debug_opts) {
4495 sdev_printk(KERN_INFO, sdev, 4495 sdev_printk(KERN_INFO, sdev,
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 2d0f5155ee51..1f63559184b9 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -632,7 +632,7 @@ static void scsi_handle_queue_ramp_up(struct scsi_device *sdev)
632 tmp_sdev->queue_depth == sdev->max_queue_depth) 632 tmp_sdev->queue_depth == sdev->max_queue_depth)
633 continue; 633 continue;
634 634
635 scsi_adjust_queue_depth(tmp_sdev, tmp_sdev->queue_depth + 1); 635 scsi_change_queue_depth(tmp_sdev, tmp_sdev->queue_depth + 1);
636 sdev->last_queue_ramp_up = jiffies; 636 sdev->last_queue_ramp_up = jiffies;
637 } 637 }
638} 638}
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index d97597e6337e..0af713375db5 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -292,7 +292,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
292 blk_queue_init_tags(sdev->request_queue, 292 blk_queue_init_tags(sdev->request_queue,
293 sdev->host->cmd_per_lun, shost->bqt); 293 sdev->host->cmd_per_lun, shost->bqt);
294 } 294 }
295 scsi_adjust_queue_depth(sdev, sdev->host->cmd_per_lun); 295 scsi_change_queue_depth(sdev, sdev->host->cmd_per_lun);
296 296
297 scsi_sysfs_device_initialize(sdev); 297 scsi_sysfs_device_initialize(sdev);
298 298
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index bffd5abdcd1f..1cb64a8e18c9 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -880,8 +880,7 @@ sdev_store_queue_depth(struct device *dev, struct device_attribute *attr,
880 if (depth < 1 || depth > sht->can_queue) 880 if (depth < 1 || depth > sht->can_queue)
881 return -EINVAL; 881 return -EINVAL;
882 882
883 retval = sht->change_queue_depth(sdev, depth, 883 retval = sht->change_queue_depth(sdev, depth);
884 SCSI_QDEPTH_DEFAULT);
885 if (retval < 0) 884 if (retval < 0)
886 return retval; 885 return retval;
887 886
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index ff8befbdf17c..e3ba251fb6e7 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1429,7 +1429,7 @@ static void storvsc_device_destroy(struct scsi_device *sdevice)
1429 1429
1430static int storvsc_device_configure(struct scsi_device *sdevice) 1430static int storvsc_device_configure(struct scsi_device *sdevice)
1431{ 1431{
1432 scsi_adjust_queue_depth(sdevice, STORVSC_MAX_IO_REQUESTS); 1432 scsi_change_queue_depth(sdevice, STORVSC_MAX_IO_REQUESTS);
1433 1433
1434 blk_queue_max_segment_size(sdevice->request_queue, PAGE_SIZE); 1434 blk_queue_max_segment_size(sdevice->request_queue, PAGE_SIZE);
1435 1435
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 3557b385251a..5d00e514ff28 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -820,7 +820,7 @@ static int sym53c8xx_slave_configure(struct scsi_device *sdev)
820 if (reqtags > SYM_CONF_MAX_TAG) 820 if (reqtags > SYM_CONF_MAX_TAG)
821 reqtags = SYM_CONF_MAX_TAG; 821 reqtags = SYM_CONF_MAX_TAG;
822 depth_to_use = reqtags ? reqtags : 1; 822 depth_to_use = reqtags ? reqtags : 1;
823 scsi_adjust_queue_depth(sdev, depth_to_use); 823 scsi_change_queue_depth(sdev, depth_to_use);
824 lp->s.scdev_depth = depth_to_use; 824 lp->s.scdev_depth = depth_to_use;
825 sym_tune_dev_queuing(tp, sdev->lun, reqtags); 825 sym_tune_dev_queuing(tp, sdev->lun, reqtags);
826 826
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index 844c9a048c00..6c3c2cef3891 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -2194,7 +2194,7 @@ static int dc390_slave_configure(struct scsi_device *sdev)
2194 2194
2195 if (sdev->tagged_supported && (dcb->DevMode & TAG_QUEUEING_)) { 2195 if (sdev->tagged_supported && (dcb->DevMode & TAG_QUEUEING_)) {
2196 dcb->SyncMode |= EN_TAG_QUEUEING; 2196 dcb->SyncMode |= EN_TAG_QUEUEING;
2197 scsi_adjust_queue_depth(sdev, acb->TagMaxNum); 2197 scsi_change_queue_depth(sdev, acb->TagMaxNum);
2198 } 2198 }
2199 2199
2200 return 0; 2200 return 0;
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index aa0f4035afaf..14eb50b95a1e 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -696,25 +696,25 @@ static int u14_34f_slave_configure(struct scsi_device *dev) {
696 if (TLDEV(dev->type) && dev->tagged_supported) 696 if (TLDEV(dev->type) && dev->tagged_supported)
697 697
698 if (tag_mode == TAG_SIMPLE) { 698 if (tag_mode == TAG_SIMPLE) {
699 scsi_adjust_queue_depth(dev, tqd); 699 scsi_change_queue_depth(dev, tqd);
700 tag_suffix = ", simple tags"; 700 tag_suffix = ", simple tags";
701 } 701 }
702 else if (tag_mode == TAG_ORDERED) { 702 else if (tag_mode == TAG_ORDERED) {
703 scsi_adjust_queue_depth(dev, tqd); 703 scsi_change_queue_depth(dev, tqd);
704 tag_suffix = ", ordered tags"; 704 tag_suffix = ", ordered tags";
705 } 705 }
706 else { 706 else {
707 scsi_adjust_queue_depth(dev, tqd); 707 scsi_change_queue_depth(dev, tqd);
708 tag_suffix = ", no tags"; 708 tag_suffix = ", no tags";
709 } 709 }
710 710
711 else if (TLDEV(dev->type) && linked_comm) { 711 else if (TLDEV(dev->type) && linked_comm) {
712 scsi_adjust_queue_depth(dev, tqd); 712 scsi_change_queue_depth(dev, tqd);
713 tag_suffix = ", untagged"; 713 tag_suffix = ", untagged";
714 } 714 }
715 715
716 else { 716 else {
717 scsi_adjust_queue_depth(dev, utqd); 717 scsi_change_queue_depth(dev, utqd);
718 tag_suffix = ""; 718 tag_suffix = "";
719 } 719 }
720 720
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index e96ab253e3e5..0c4f98ee6047 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -2695,7 +2695,7 @@ static void ufshcd_set_queue_depth(struct scsi_device *sdev)
2695 2695
2696 dev_dbg(hba->dev, "%s: activate tcq with queue depth %d\n", 2696 dev_dbg(hba->dev, "%s: activate tcq with queue depth %d\n",
2697 __func__, lun_qdepth); 2697 __func__, lun_qdepth);
2698 scsi_adjust_queue_depth(sdev, lun_qdepth); 2698 scsi_change_queue_depth(sdev, lun_qdepth);
2699} 2699}
2700 2700
2701/* 2701/*
@@ -2787,21 +2787,16 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev)
2787 * ufshcd_change_queue_depth - change queue depth 2787 * ufshcd_change_queue_depth - change queue depth
2788 * @sdev: pointer to SCSI device 2788 * @sdev: pointer to SCSI device
2789 * @depth: required depth to set 2789 * @depth: required depth to set
2790 * @reason: reason for changing the depth
2791 * 2790 *
2792 * Change queue depth according to the reason and make sure 2791 * Change queue depth and make sure the max. limits are not crossed.
2793 * the max. limits are not crossed.
2794 */ 2792 */
2795static int ufshcd_change_queue_depth(struct scsi_device *sdev, 2793static int ufshcd_change_queue_depth(struct scsi_device *sdev, int depth)
2796 int depth, int reason)
2797{ 2794{
2798 struct ufs_hba *hba = shost_priv(sdev->host); 2795 struct ufs_hba *hba = shost_priv(sdev->host);
2799 2796
2800 if (depth > hba->nutrs) 2797 if (depth > hba->nutrs)
2801 depth = hba->nutrs; 2798 depth = hba->nutrs;
2802 2799 return scsi_change_queue_depth(sdev, depth);
2803 scsi_adjust_queue_depth(sdev, depth);
2804 return depth;
2805} 2800}
2806 2801
2807/** 2802/**
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 0f7e4c7ff8c2..22e70126425b 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -682,17 +682,13 @@ static int virtscsi_device_reset(struct scsi_cmnd *sc)
682 * virtscsi_change_queue_depth() - Change a virtscsi target's queue depth 682 * virtscsi_change_queue_depth() - Change a virtscsi target's queue depth
683 * @sdev: Virtscsi target whose queue depth to change 683 * @sdev: Virtscsi target whose queue depth to change
684 * @qdepth: New queue depth 684 * @qdepth: New queue depth
685 * @reason: Reason for the queue depth change.
686 */ 685 */
687static int virtscsi_change_queue_depth(struct scsi_device *sdev, 686static int virtscsi_change_queue_depth(struct scsi_device *sdev, int qdepth)
688 int qdepth,
689 int reason)
690{ 687{
691 struct Scsi_Host *shost = sdev->host; 688 struct Scsi_Host *shost = sdev->host;
692 int max_depth = shost->cmd_per_lun; 689 int max_depth = shost->cmd_per_lun;
693 690
694 scsi_adjust_queue_depth(sdev, min(max_depth, qdepth)); 691 return scsi_change_queue_depth(sdev, min(max_depth, qdepth));
695 return sdev->queue_depth;
696} 692}
697 693
698static int virtscsi_abort(struct scsi_cmnd *sc) 694static int virtscsi_abort(struct scsi_cmnd *sc)
diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index 03ad24be728e..ade1f1d013b1 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -504,19 +504,11 @@ static void pvscsi_setup_all_rings(const struct pvscsi_adapter *adapter)
504 } 504 }
505} 505}
506 506
507static int pvscsi_change_queue_depth(struct scsi_device *sdev, 507static int pvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth)
508 int qdepth,
509 int reason)
510{ 508{
511 if (reason != SCSI_QDEPTH_DEFAULT)
512 /*
513 * We support only changing default.
514 */
515 return -EOPNOTSUPP;
516
517 if (!sdev->tagged_supported) 509 if (!sdev->tagged_supported)
518 qdepth = 1; 510 qdepth = 1;
519 scsi_adjust_queue_depth(sdev, qdepth); 511 scsi_change_queue_depth(sdev, qdepth);
520 512
521 if (sdev->inquiry_len > 7) 513 if (sdev->inquiry_len > 7)
522 sdev_printk(KERN_INFO, sdev, 514 sdev_printk(KERN_INFO, sdev,
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
index 32674236fec7..f94d73611ab4 100644
--- a/drivers/scsi/wd7000.c
+++ b/drivers/scsi/wd7000.c
@@ -1653,7 +1653,6 @@ static struct scsi_host_template driver_template = {
1653 .can_queue = WD7000_Q, 1653 .can_queue = WD7000_Q,
1654 .this_id = 7, 1654 .this_id = 7,
1655 .sg_tablesize = WD7000_SG, 1655 .sg_tablesize = WD7000_SG,
1656 .cmd_per_lun = 1,
1657 .unchecked_isa_dma = 1, 1656 .unchecked_isa_dma = 1,
1658 .use_clustering = ENABLE_CLUSTERING, 1657 .use_clustering = ENABLE_CLUSTERING,
1659}; 1658};