Skip to content

Commit d3326e6

Browse files
Mani-Sadhasivammartinkpetersen
authored andcommitted
scsi: ufs: pltfrm: Disable runtime PM during removal of glue drivers
When the UFSHCD platform glue drivers are removed, runtime PM should be disabled using pm_runtime_disable() to balance the enablement done in ufshcd_pltfrm_init(). This is also reported by PM core when the glue driver is removed and inserted again: ufshcd-qcom 1d84000.ufshc: Unbalanced pm_runtime_enable! So disable runtime PM using a new helper API ufshcd_pltfrm_remove(), that also takes care of removing ufshcd. This helper should be called during the remove() stage of glue drivers. 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]>
1 parent 64506b3 commit d3326e6

File tree

10 files changed

+22
-20
lines changed

10 files changed

+22
-20
lines changed

drivers/ufs/host/cdns-pltfrm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,7 @@ static int cdns_ufs_pltfrm_probe(struct platform_device *pdev)
307307
*/
308308
static void cdns_ufs_pltfrm_remove(struct platform_device *pdev)
309309
{
310-
struct ufs_hba *hba = platform_get_drvdata(pdev);
311-
312-
ufshcd_remove(hba);
310+
ufshcd_pltfrm_remove(pdev);
313311
}
314312

315313
static const struct dev_pm_ops cdns_ufs_dev_pm_ops = {

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,8 @@ 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-
struct ufs_hba *hba = platform_get_drvdata(pdev);
80-
8179
pm_runtime_get_sync(&(pdev)->dev);
82-
ufshcd_remove(hba);
80+
ufshcd_pltfrm_remove(pdev);
8381
}
8482

8583
static const struct dev_pm_ops tc_dwc_g210_pltfm_pm_ops = {

drivers/ufs/host/ufs-exynos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1993,7 +1993,7 @@ static void exynos_ufs_remove(struct platform_device *pdev)
19931993
struct exynos_ufs *ufs = ufshcd_get_variant(hba);
19941994

19951995
pm_runtime_get_sync(&(pdev)->dev);
1996-
ufshcd_remove(hba);
1996+
ufshcd_pltfrm_remove(pdev);
19971997

19981998
phy_power_off(ufs->phy);
19991999
phy_exit(ufs->phy);

drivers/ufs/host/ufs-hisi.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,9 +576,7 @@ static int ufs_hisi_probe(struct platform_device *pdev)
576576

577577
static void ufs_hisi_remove(struct platform_device *pdev)
578578
{
579-
struct ufs_hba *hba = platform_get_drvdata(pdev);
580-
581-
ufshcd_remove(hba);
579+
ufshcd_pltfrm_remove(pdev);
582580
}
583581

584582
static const struct dev_pm_ops ufs_hisi_pm_ops = {

drivers/ufs/host/ufs-mediatek.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,10 +1879,8 @@ static int ufs_mtk_probe(struct platform_device *pdev)
18791879
*/
18801880
static void ufs_mtk_remove(struct platform_device *pdev)
18811881
{
1882-
struct ufs_hba *hba = platform_get_drvdata(pdev);
1883-
18841882
pm_runtime_get_sync(&(pdev)->dev);
1885-
ufshcd_remove(hba);
1883+
ufshcd_pltfrm_remove(pdev);
18861884
}
18871885

18881886
#ifdef CONFIG_PM_SLEEP

drivers/ufs/host/ufs-qcom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,7 @@ static void ufs_qcom_remove(struct platform_device *pdev)
18641864
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
18651865

18661866
pm_runtime_get_sync(&(pdev)->dev);
1867-
ufshcd_remove(hba);
1867+
ufshcd_pltfrm_remove(pdev);
18681868
if (host->esi_enabled)
18691869
platform_device_msi_free_irqs_all(hba->dev);
18701870
}

drivers/ufs/host/ufs-renesas.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,7 @@ static int ufs_renesas_probe(struct platform_device *pdev)
397397

398398
static void ufs_renesas_remove(struct platform_device *pdev)
399399
{
400-
struct ufs_hba *hba = platform_get_drvdata(pdev);
401-
402-
ufshcd_remove(hba);
400+
ufshcd_pltfrm_remove(pdev);
403401
}
404402

405403
static struct platform_driver ufs_renesas_platform = {

drivers/ufs/host/ufs-sprd.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,8 @@ static int ufs_sprd_probe(struct platform_device *pdev)
427427

428428
static void ufs_sprd_remove(struct platform_device *pdev)
429429
{
430-
struct ufs_hba *hba = platform_get_drvdata(pdev);
431-
432430
pm_runtime_get_sync(&(pdev)->dev);
433-
ufshcd_remove(hba);
431+
ufshcd_pltfrm_remove(pdev);
434432
}
435433

436434
static const struct dev_pm_ops ufs_sprd_pm_ops = {

drivers/ufs/host/ufshcd-pltfrm.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,19 @@ int ufshcd_pltfrm_init(struct platform_device *pdev,
524524
}
525525
EXPORT_SYMBOL_GPL(ufshcd_pltfrm_init);
526526

527+
/**
528+
* ufshcd_pltfrm_remove - Remove ufshcd platform
529+
* @pdev: pointer to Platform device handle
530+
*/
531+
void ufshcd_pltfrm_remove(struct platform_device *pdev)
532+
{
533+
struct ufs_hba *hba = platform_get_drvdata(pdev);
534+
535+
ufshcd_remove(hba);
536+
pm_runtime_disable(&pdev->dev);
537+
}
538+
EXPORT_SYMBOL_GPL(ufshcd_pltfrm_remove);
539+
527540
MODULE_AUTHOR("Santosh Yaragnavi <[email protected]>");
528541
MODULE_AUTHOR("Vinayak Holikatti <[email protected]>");
529542
MODULE_DESCRIPTION("UFS host controller Platform bus based glue driver");

drivers/ufs/host/ufshcd-pltfrm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ int ufshcd_negotiate_pwr_params(const struct ufs_host_params *host_params,
3131
void ufshcd_init_host_params(struct ufs_host_params *host_params);
3232
int ufshcd_pltfrm_init(struct platform_device *pdev,
3333
const struct ufs_hba_variant_ops *vops);
34+
void ufshcd_pltfrm_remove(struct platform_device *pdev);
3435
int ufshcd_populate_vreg(struct device *dev, const char *name,
3536
struct ufs_vreg **out_vreg, bool skip_current);
3637

0 commit comments

Comments
 (0)