]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
scsi: ufs: core: Use scsi_device_busy()
authorBart Van Assche <bvanassche@acm.org>
Thu, 13 Nov 2025 23:52:43 +0000 (15:52 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 19 Nov 2025 17:06:00 +0000 (12:06 -0500)
Use scsi_device_busy() instead of open-coding it. This patch prepares
for skipping the SCSI device budget map initialization in certain cases.

Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20251113235252.2015185-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c

index ca17165f6f0eddfe268cc5b1357e195dd171e731..8d41f17f7796e80c3885c907d8a8ae7b87464d03 100644 (file)
@@ -1290,13 +1290,13 @@ static bool ufshcd_is_devfreq_scaling_required(struct ufs_hba *hba,
  */
 static u32 ufshcd_pending_cmds(struct ufs_hba *hba)
 {
-       const struct scsi_device *sdev;
+       struct scsi_device *sdev;
        unsigned long flags;
        u32 pending = 0;
 
        spin_lock_irqsave(hba->host->host_lock, flags);
        __shost_for_each_device(sdev, hba->host)
-               pending += sbitmap_weight(&sdev->budget_map);
+               pending += scsi_device_busy(sdev);
        spin_unlock_irqrestore(hba->host->host_lock, flags);
 
        return pending;