summaryrefslogtreecommitdiff
path: root/drivers/ufs
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2023-12-18 14:52:14 -0800
committerMartin K. Petersen <martin.petersen@oracle.com>2024-01-03 23:03:04 -0500
commitdaf7795406bf307997366f694888bd317ae5b5fa (patch)
treec20a9d1f7504539f23c8b38685473ca17c880c99 /drivers/ufs
parent45a2c87f28ad0ee8c286bb6dd5686bc54f5b7160 (diff)
downloadlwn-daf7795406bf307997366f694888bd317ae5b5fa.tar.gz
lwn-daf7795406bf307997366f694888bd317ae5b5fa.zip
scsi: ufs: core: Simplify power management during async scan
ufshcd_init() calls pm_runtime_get_sync() before it calls async_schedule(). ufshcd_async_scan() calls pm_runtime_put_sync() directly or indirectly from ufshcd_add_lus(). Simplify ufshcd_async_scan() by always calling pm_runtime_put_sync() from ufshcd_async_scan(). Cc: <stable@vger.kernel.org> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20231218225229.2542156-2-bvanassche@acm.org Reviewed-by: Can Guo <quic_cang@quicinc.com> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/ufs')
-rw-r--r--drivers/ufs/core/ufshcd.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index d6ae5d17892c..0ad8bde39cd1 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -8711,7 +8711,6 @@ static int ufshcd_add_lus(struct ufs_hba *hba)
ufs_bsg_probe(hba);
scsi_scan_host(hba->host);
- pm_runtime_put_sync(hba->dev);
out:
return ret;
@@ -8980,15 +8979,15 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
/* Probe and add UFS logical units */
ret = ufshcd_add_lus(hba);
+
out:
+ pm_runtime_put_sync(hba->dev);
/*
* If we failed to initialize the device or the device is not
* present, turn off the power/clocks etc.
*/
- if (ret) {
- pm_runtime_put_sync(hba->dev);
+ if (ret)
ufshcd_hba_exit(hba);
- }
}
static enum scsi_timeout_action ufshcd_eh_timed_out(struct scsi_cmnd *scmd)