scsi: drop reason argument from ->change_queue_depth
[firefly-linux-kernel-4.4.55.git] / drivers / scsi / scsi_debug.c
index 238e06f13b8a1c977146699d95f1783bbef571e7..ce71b6d4393c0f5d53c810267d08742faa1e5b74 100644 (file)
@@ -2701,10 +2701,6 @@ static int scsi_debug_slave_configure(struct scsi_device *sdp)
        if (NULL == devip)
                return 1;       /* no resources, will be marked offline */
        sdp->hostdata = devip;
-       sdp->tagged_supported = 1;
-       if (sdp->host->cmd_per_lun)
-               scsi_adjust_queue_depth(sdp, DEF_TAGGED_QUEUING,
-                                       DEF_CMD_PER_LUN);
        blk_queue_max_segment_size(sdp->request_queue, -1U);
        if (scsi_debug_no_uld)
                sdp->no_uld_attach = 1;
@@ -4473,10 +4469,9 @@ sdebug_queuecommand_lock_or_not(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
 }
 
 static int
-sdebug_change_qdepth(struct scsi_device *sdev, int qdepth, int reason)
+sdebug_change_qdepth(struct scsi_device *sdev, int qdepth)
 {
        int num_in_q = 0;
-       int bad = 0;
        unsigned long iflags;
        struct sdebug_dev_info *devip;
 
@@ -4488,43 +4483,18 @@ sdebug_change_qdepth(struct scsi_device *sdev, int qdepth, int reason)
        }
        num_in_q = atomic_read(&devip->num_in_q);
        spin_unlock_irqrestore(&queued_arr_lock, iflags);
-       if (reason == SCSI_QDEPTH_DEFAULT || reason == SCSI_QDEPTH_RAMP_UP) {
-               if (qdepth < 1)
-                       qdepth = 1;
-               /* allow to exceed max host queued_arr elements for testing */
-               if (qdepth > SCSI_DEBUG_CANQUEUE + 10)
-                       qdepth = SCSI_DEBUG_CANQUEUE + 10;
-               scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
-       } else if (reason == SCSI_QDEPTH_QFULL)
-               scsi_track_queue_full(sdev, qdepth);
-       else
-               bad = 1;
-       if (bad)
-               sdev_printk(KERN_WARNING, sdev,
-                           "%s: unknown reason=0x%x\n", __func__, reason);
+
+       if (qdepth < 1)
+               qdepth = 1;
+       /* allow to exceed max host queued_arr elements for testing */
+       if (qdepth > SCSI_DEBUG_CANQUEUE + 10)
+               qdepth = SCSI_DEBUG_CANQUEUE + 10;
+       scsi_change_queue_depth(sdev, qdepth);
+
        if (SCSI_DEBUG_OPT_Q_NOISE & scsi_debug_opts) {
-               if (SCSI_QDEPTH_QFULL == reason)
-                       sdev_printk(KERN_INFO, sdev,
-                           "%s: -> %d, num_in_q=%d, reason: queue full\n",
-                                   __func__, qdepth, num_in_q);
-               else {
-                       const char *cp;
-
-                       switch (reason) {
-                       case SCSI_QDEPTH_DEFAULT:
-                               cp = "default (sysfs ?)";
-                               break;
-                       case SCSI_QDEPTH_RAMP_UP:
-                               cp = "ramp up";
-                               break;
-                       default:
-                               cp = "unknown";
-                               break;
-                       }
-                       sdev_printk(KERN_INFO, sdev,
-                                   "%s: qdepth=%d, num_in_q=%d, reason: %s\n",
-                                   __func__, qdepth, num_in_q, cp);
-               }
+               sdev_printk(KERN_INFO, sdev,
+                           "%s: qdepth=%d, num_in_q=%d\n",
+                           __func__, qdepth, num_in_q);
        }
        return sdev->queue_depth;
 }
@@ -4532,14 +4502,7 @@ sdebug_change_qdepth(struct scsi_device *sdev, int qdepth, int reason)
 static int
 sdebug_change_qtype(struct scsi_device *sdev, int qtype)
 {
-       if (sdev->tagged_supported) {
-               scsi_set_tag_type(sdev, qtype);
-               if (qtype)
-                       scsi_activate_tcq(sdev, sdev->queue_depth);
-               else
-                       scsi_deactivate_tcq(sdev, sdev->queue_depth);
-       } else
-               qtype = 0;
+       qtype = scsi_change_queue_type(sdev, qtype);
        if (SCSI_DEBUG_OPT_Q_NOISE & scsi_debug_opts) {
                const char *cp;
 
@@ -4587,6 +4550,7 @@ static struct scsi_host_template sdebug_driver_template = {
        .max_sectors =          -1U,
        .use_clustering =       DISABLE_CLUSTERING,
        .module =               THIS_MODULE,
+       .track_queue_depth =    1,
 };
 
 static int sdebug_driver_probe(struct device * dev)
@@ -4603,7 +4567,7 @@ static int sdebug_driver_probe(struct device * dev)
                sdebug_driver_template.use_clustering = ENABLE_CLUSTERING;
        hpnt = scsi_host_alloc(&sdebug_driver_template, sizeof(sdbg_host));
        if (NULL == hpnt) {
-               printk(KERN_ERR "%s: scsi_register failed\n", __func__);
+               pr_err("%s: scsi_host_alloc failed\n", __func__);
                error = -ENODEV;
                return error;
        }