UPSTREAM: scsi: ufs: Rework ufshcd_change_queue_depth()

Prepare for making sdev->host->can_queue less than hba->nutrs. This patch
does not change any functionality.

Link: https://lore.kernel.org/r/20211203231950.193369-9-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Bug: 234653003
(cherry picked from commit fc21da8a84)
Change-Id: I35b283ce6d1c36364b08cfcb9659699fb14be964
Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
Bart Van Assche
2021-12-03 15:19:41 -08:00
committed by Bart Van Assche
parent bda51ed6ae
commit 8be982b2bf

View File

@@ -5001,11 +5001,7 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev)
*/
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;
return scsi_change_queue_depth(sdev, depth);
return scsi_change_queue_depth(sdev, min(depth, sdev->host->can_queue));
}
static void ufshcd_hpb_destroy(struct ufs_hba *hba, struct scsi_device *sdev)