Skip to content

Commit

Permalink
scsi: ufs: pltfrm: Drop PM runtime reference count after ufshcd_remove()
Browse files Browse the repository at this point in the history
BugLink: https://bugs.launchpad.net/bugs/2096827

commit 1745dcdb7227102e16248a324c600b9121c8f6df 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]>
  • Loading branch information
Mani-Sadhasivam authored and mehmetb0 committed Feb 14, 2025
1 parent 785a77c commit 782d04c
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion drivers/ufs/host/tc-dwc-g210-pltfrm.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ static int tc_dwc_g210_pltfm_probe(struct platform_device *pdev)
*/
static void tc_dwc_g210_pltfm_remove(struct platform_device *pdev)
{
pm_runtime_get_sync(&(pdev)->dev);
ufshcd_pltfrm_remove(pdev);
}

Expand Down
1 change: 0 additions & 1 deletion drivers/ufs/host/ufs-exynos.c
Original file line number Diff line number Diff line change
Expand Up @@ -1963,7 +1963,6 @@ static void exynos_ufs_remove(struct platform_device *pdev)
struct ufs_hba *hba = platform_get_drvdata(pdev);
struct exynos_ufs *ufs = ufshcd_get_variant(hba);

pm_runtime_get_sync(&(pdev)->dev);
ufshcd_pltfrm_remove(pdev);

phy_power_off(ufs->phy);
Expand Down
1 change: 0 additions & 1 deletion drivers/ufs/host/ufs-mediatek.c
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,6 @@ static int ufs_mtk_probe(struct platform_device *pdev)
*/
static void ufs_mtk_remove(struct platform_device *pdev)
{
pm_runtime_get_sync(&(pdev)->dev);
ufshcd_pltfrm_remove(pdev);
}

Expand Down
1 change: 0 additions & 1 deletion drivers/ufs/host/ufs-qcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,6 @@ static void ufs_qcom_remove(struct platform_device *pdev)
struct ufs_hba *hba = platform_get_drvdata(pdev);
struct ufs_qcom_host *host = ufshcd_get_variant(hba);

pm_runtime_get_sync(&(pdev)->dev);
ufshcd_pltfrm_remove(pdev);
if (host->esi_enabled)
platform_device_msi_free_irqs_all(hba->dev);
Expand Down
1 change: 0 additions & 1 deletion drivers/ufs/host/ufs-sprd.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ static int ufs_sprd_probe(struct platform_device *pdev)

static void ufs_sprd_remove(struct platform_device *pdev)
{
pm_runtime_get_sync(&(pdev)->dev);
ufshcd_pltfrm_remove(pdev);
}

Expand Down
2 changes: 2 additions & 0 deletions drivers/ufs/host/ufshcd-pltfrm.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,10 @@ void ufshcd_pltfrm_remove(struct platform_device *pdev)
{
struct ufs_hba *hba = platform_get_drvdata(pdev);

pm_runtime_get_sync(&pdev->dev);
ufshcd_remove(hba);
pm_runtime_disable(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
}
EXPORT_SYMBOL_GPL(ufshcd_pltfrm_remove);

Expand Down

0 comments on commit 782d04c

Please sign in to comment.