scsi: drop reason argument from ->change_queue_depth
[firefly-linux-kernel-4.4.55.git] / drivers / scsi / ufs / ufshcd.c
index 497c38a4a86615178e367e40666937e2d969b41f..0c4f98ee6047cb36dd28ec388652bd785e78567b 100644 (file)
@@ -2695,7 +2695,7 @@ static void ufshcd_set_queue_depth(struct scsi_device *sdev)
 
        dev_dbg(hba->dev, "%s: activate tcq with queue depth %d\n",
                        __func__, lun_qdepth);
-       scsi_activate_tcq(sdev, lun_qdepth);
+       scsi_change_queue_depth(sdev, lun_qdepth);
 }
 
 /*
@@ -2765,11 +2765,9 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev)
        struct ufs_hba *hba;
 
        hba = shost_priv(sdev->host);
-       sdev->tagged_supported = 1;
 
        /* Mode sense(6) is not supported by UFS, so use Mode sense(10) */
        sdev->use_10_for_ms = 1;
-       scsi_set_tag_type(sdev, MSG_SIMPLE_TAG);
 
        /* allow SCSI layer to restart the device in case of errors */
        sdev->allow_restart = 1;
@@ -2789,34 +2787,16 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev)
  * ufshcd_change_queue_depth - change queue depth
  * @sdev: pointer to SCSI device
  * @depth: required depth to set
- * @reason: reason for changing the depth
  *
- * Change queue depth according to the reason and make sure
- * the max. limits are not crossed.
+ * Change queue depth and make sure the max. limits are not crossed.
  */
-static int ufshcd_change_queue_depth(struct scsi_device *sdev,
-               int depth, int reason)
+static int ufshcd_change_queue_depth(struct scsi_device *sdev, int depth)
 {
        struct ufs_hba *hba = shost_priv(sdev->host);
 
        if (depth > hba->nutrs)
                depth = hba->nutrs;
-
-       switch (reason) {
-       case SCSI_QDEPTH_DEFAULT:
-       case SCSI_QDEPTH_RAMP_UP:
-               if (!sdev->tagged_supported)
-                       depth = 1;
-               scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
-               break;
-       case SCSI_QDEPTH_QFULL:
-               scsi_track_queue_full(sdev, depth);
-               break;
-       default:
-               return -EOPNOTSUPP;
-       }
-
-       return depth;
+       return scsi_change_queue_depth(sdev, depth);
 }
 
 /**
@@ -2842,7 +2822,6 @@ static void ufshcd_slave_destroy(struct scsi_device *sdev)
        struct ufs_hba *hba;
 
        hba = shost_priv(sdev->host);
-       scsi_deactivate_tcq(sdev, hba->nutrs);
        /* Drop the reference as it won't be needed anymore */
        if (ufshcd_scsi_to_upiu_lun(sdev->lun) == UFS_UPIU_UFS_DEVICE_WLUN)
                hba->sdev_ufs_device = NULL;
@@ -4235,6 +4214,8 @@ static struct scsi_host_template ufshcd_driver_template = {
        .cmd_per_lun            = UFSHCD_CMD_PER_LUN,
        .can_queue              = UFSHCD_CAN_QUEUE,
        .max_host_blocked       = 1,
+       .use_blk_tags           = 1,
+       .track_queue_depth      = 1,
 };
 
 static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,
@@ -4707,11 +4688,11 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
                                     START_STOP_TIMEOUT, 0, NULL, REQ_PM);
        if (ret) {
                sdev_printk(KERN_WARNING, sdp,
-                         "START_STOP failed for power mode: %d\n", pwr_mode);
-               scsi_show_result(ret);
+                           "START_STOP failed for power mode: %d, result %x\n",
+                           pwr_mode, ret);
                if (driver_byte(ret) & DRIVER_SENSE) {
-                       scsi_show_sense_hdr(&sshdr);
-                       scsi_show_extd_sense(sshdr.asc, sshdr.ascq);
+                       scsi_show_sense_hdr(sdp, NULL, &sshdr);
+                       scsi_show_extd_sense(sdp, NULL, sshdr.asc, sshdr.ascq);
                }
        }