Skip to content

Commit 782d04c

Browse files
Mani-Sadhasivammehmetb0
authored andcommitted
scsi: ufs: pltfrm: Drop PM runtime reference count after ufshcd_remove()
BugLink: https://bugs.launchpad.net/bugs/2096827 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: [email protected] # 3.12 Fixes: 6269473 ("[SCSI] ufs: Add runtime PM support for UFS host controller driver") Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Peter Wang <[email protected]> Reviewed-by: Bean Huo <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Koichiro Den <[email protected]>
1 parent 785a77c commit 782d04c

File tree

6 files changed

+2
-5
lines changed

6 files changed

+2
-5
lines changed

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

-1
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

-1
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

-1
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

-1
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

-1
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

+2
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,10 @@ void ufshcd_pltfrm_remove(struct platform_device *pdev)
536536
{
537537
struct ufs_hba *hba = platform_get_drvdata(pdev);
538538

539+
pm_runtime_get_sync(&pdev->dev);
539540
ufshcd_remove(hba);
540541
pm_runtime_disable(&pdev->dev);
542+
pm_runtime_put_noidle(&pdev->dev);
541543
}
542544
EXPORT_SYMBOL_GPL(ufshcd_pltfrm_remove);
543545

0 commit comments

Comments
 (0)