Commit daf77954 authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

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: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20231218225229.2542156-2-bvanassche@acm.orgReviewed-by: default avatarCan Guo <quic_cang@quicinc.com>
Reviewed-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 45a2c87f
...@@ -8711,7 +8711,6 @@ static int ufshcd_add_lus(struct ufs_hba *hba) ...@@ -8711,7 +8711,6 @@ static int ufshcd_add_lus(struct ufs_hba *hba)
ufs_bsg_probe(hba); ufs_bsg_probe(hba);
scsi_scan_host(hba->host); scsi_scan_host(hba->host);
pm_runtime_put_sync(hba->dev);
out: out:
return ret; return ret;
...@@ -8980,15 +8979,15 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie) ...@@ -8980,15 +8979,15 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
/* Probe and add UFS logical units */ /* Probe and add UFS logical units */
ret = ufshcd_add_lus(hba); ret = ufshcd_add_lus(hba);
out: out:
pm_runtime_put_sync(hba->dev);
/* /*
* If we failed to initialize the device or the device is not * If we failed to initialize the device or the device is not
* present, turn off the power/clocks etc. * present, turn off the power/clocks etc.
*/ */
if (ret) { if (ret)
pm_runtime_put_sync(hba->dev);
ufshcd_hba_exit(hba); ufshcd_hba_exit(hba);
}
} }
static enum scsi_timeout_action ufshcd_eh_timed_out(struct scsi_cmnd *scmd) static enum scsi_timeout_action ufshcd_eh_timed_out(struct scsi_cmnd *scmd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment