[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fa8a4c1a-e583-496b-a0a2-bd86f86af508@acm.org>
Date: Mon, 23 Sep 2024 10:41:28 -0700
From: Bart Van Assche <bvanassche@....org>
To: Seunghwan Baek <sh8267.baek@...sung.com>, linux-kernel@...r.kernel.org,
linux-scsi@...r.kernel.org, martin.petersen@...cle.com,
James.Bottomley@...senPartnership.com, avri.altman@....com,
alim.akhtar@...sung.com
Cc: grant.jung@...sung.com, jt77.jang@...sung.com, junwoo80.lee@...sung.com,
dh0421.hwang@...sung.com, jangsub.yi@...sung.com, sh043.lee@...sung.com,
cw9316.lee@...sung.com, wkon.kim@...sung.com, stable@...r.kernel.org
Subject: Re: [PATCH v1 1/1] ufs: core: set SDEV_OFFLINE when ufs shutdown.
On 8/29/24 2:39 AM, Seunghwan Baek wrote:
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index a6f818cdef0e..4ac1492787c2 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -10215,7 +10215,9 @@ static void ufshcd_wl_shutdown(struct device *dev)
> shost_for_each_device(sdev, hba->host) {
> if (sdev == hba->ufs_device_wlun)
> continue;
> - scsi_device_quiesce(sdev);
> + mutex_lock(&sdev->state_mutex);
> + scsi_device_set_state(sdev, SDEV_OFFLINE);
> + mutex_unlock(&sdev->state_mutex);
> }
> __ufshcd_wl_suspend(hba, UFS_SHUTDOWN_PM);
Why to keep one scsi_device_quiesce() call and convert the other call?
Please consider something like this change:
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index e808350c6774..914770dff18f 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -10134,11 +10134,10 @@ static void ufshcd_wl_shutdown(struct device *dev)
/* Turn on everything while shutting down */
ufshcd_rpm_get_sync(hba);
- scsi_device_quiesce(sdev);
shost_for_each_device(sdev, hba->host) {
- if (sdev == hba->ufs_device_wlun)
- continue;
- scsi_device_quiesce(sdev);
+ mutex_lock(&sdev->state_mutex);
+ scsi_device_set_state(sdev, SDEV_OFFLINE);
+ mutex_unlock(&sdev->state_mutex);
}
__ufshcd_wl_suspend(hba, UFS_SHUTDOWN_PM);
Thanks,
Bart.
Powered by blists - more mailing lists