Skip to content

Commit 5a3c74c

Browse files
Mani-SadhasivamSasha Levin
authored andcommitted
scsi: ufs: pltfrm: Drop PM runtime reference count after ufshcd_remove()
commit 1745dcd upstream. During the remove stage of glue drivers, some of them are incrementing the reference count using pm_runtime_get_sync(), before removing the ufshcd using ufshcd_remove(). But they are not dropping that reference count after ufshcd_remove() to balance the refcount. So drop the reference count by calling pm_runtime_put_noidle() after ufshcd_remove(). Since the behavior is applicable to all glue drivers, move the PM handling to ufshcd_pltfrm_remove(). Cc: stable@vger.kernel.org # 3.12 Fixes: 6269473 ("[SCSI] ufs: Add runtime PM support for UFS host controller driver") Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/20241111-ufs_bug_fix-v1-4-45ad8b62f02e@linaro.org Reviewed-by: Peter Wang <peter.wang@mediatek.com> Reviewed-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 869d896 commit 5a3c74c

File tree

6 files changed

+2
-5
lines changed

6 files changed

+2
-5
lines changed

drivers/ufs/host/tc-dwc-g210-pltfrm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ static int tc_dwc_g210_pltfm_probe(struct platform_device *pdev)
7676
*/
7777
static void tc_dwc_g210_pltfm_remove(struct platform_device *pdev)
7878
{
79-
pm_runtime_get_sync(&(pdev)->dev);
8079
ufshcd_pltfrm_remove(pdev);
8180
}
8281

drivers/ufs/host/ufs-exynos.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1963,7 +1963,6 @@ static void exynos_ufs_remove(struct platform_device *pdev)
19631963
struct ufs_hba *hba = platform_get_drvdata(pdev);
19641964
struct exynos_ufs *ufs = ufshcd_get_variant(hba);
19651965

1966-
pm_runtime_get_sync(&(pdev)->dev);
19671966
ufshcd_pltfrm_remove(pdev);
19681967

19691968
phy_power_off(ufs->phy);

drivers/ufs/host/ufs-mediatek.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,6 @@ static int ufs_mtk_probe(struct platform_device *pdev)
18691869
*/
18701870
static void ufs_mtk_remove(struct platform_device *pdev)
18711871
{
1872-
pm_runtime_get_sync(&(pdev)->dev);
18731872
ufshcd_pltfrm_remove(pdev);
18741873
}
18751874

drivers/ufs/host/ufs-qcom.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,6 @@ static void ufs_qcom_remove(struct platform_device *pdev)
18451845
struct ufs_hba *hba = platform_get_drvdata(pdev);
18461846
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
18471847

1848-
pm_runtime_get_sync(&(pdev)->dev);
18491848
ufshcd_pltfrm_remove(pdev);
18501849
if (host->esi_enabled)
18511850
platform_device_msi_free_irqs_all(hba->dev);

drivers/ufs/host/ufs-sprd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ static int ufs_sprd_probe(struct platform_device *pdev)
427427

428428
static void ufs_sprd_remove(struct platform_device *pdev)
429429
{
430-
pm_runtime_get_sync(&(pdev)->dev);
431430
ufshcd_pltfrm_remove(pdev);
432431
}
433432

drivers/ufs/host/ufshcd-pltfrm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,10 @@ void ufshcd_pltfrm_remove(struct platform_device *pdev)
532532
{
533533
struct ufs_hba *hba = platform_get_drvdata(pdev);
534534

535+
pm_runtime_get_sync(&pdev->dev);
535536
ufshcd_remove(hba);
536537
pm_runtime_disable(&pdev->dev);
538+
pm_runtime_put_noidle(&pdev->dev);
537539
}
538540
EXPORT_SYMBOL_GPL(ufshcd_pltfrm_remove);
539541

0 commit comments

Comments
 (0)