Skip to content

Commit 019880c

Browse files
Merge patch series "scsi: ufs: Bug fixes for ufs core and platform drivers"
Manivannan Sadhasivam <[email protected]> says: Hi, This series has several bug fixes that I encountered when the ufs-qcom driver was removed and inserted back. But the fixes are applicable to other platform glue drivers as well. This series is tested on Qcom RB5 development board based on SM8250 SoC. Signed-off-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2 parents 60b4dd1 + 897df60 commit 019880c

File tree

11 files changed

+29
-26
lines changed

11 files changed

+29
-26
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10231,6 +10231,7 @@ void ufshcd_remove(struct ufs_hba *hba)
1023110231
ufs_hwmon_remove(hba);
1023210232
ufs_bsg_remove(hba);
1023310233
ufs_sysfs_remove_nodes(hba->dev);
10234+
cancel_delayed_work_sync(&hba->ufs_rtc_update_work);
1023410235
blk_mq_destroy_queue(hba->tmf_queue);
1023510236
blk_put_queue(hba->tmf_queue);
1023610237
blk_mq_free_tag_set(&hba->tmf_tag_set);

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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@ 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-
81-
pm_runtime_get_sync(&(pdev)->dev);
82-
ufshcd_remove(hba);
79+
ufshcd_pltfrm_remove(pdev);
8380
}
8481

8582
static const struct dev_pm_ops tc_dwc_g210_pltfm_pm_ops = {

drivers/ufs/host/ufs-exynos.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,8 +1992,7 @@ static void exynos_ufs_remove(struct platform_device *pdev)
19921992
struct ufs_hba *hba = platform_get_drvdata(pdev);
19931993
struct exynos_ufs *ufs = ufshcd_get_variant(hba);
19941994

1995-
pm_runtime_get_sync(&(pdev)->dev);
1996-
ufshcd_remove(hba);
1995+
ufshcd_pltfrm_remove(pdev);
19971996

19981997
phy_power_off(ufs->phy);
19991998
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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,10 +1879,7 @@ 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-
1884-
pm_runtime_get_sync(&(pdev)->dev);
1885-
ufshcd_remove(hba);
1882+
ufshcd_pltfrm_remove(pdev);
18861883
}
18871884

18881885
#ifdef CONFIG_PM_SLEEP

drivers/ufs/host/ufs-qcom.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,10 +1861,11 @@ static int ufs_qcom_probe(struct platform_device *pdev)
18611861
static void ufs_qcom_remove(struct platform_device *pdev)
18621862
{
18631863
struct ufs_hba *hba = platform_get_drvdata(pdev);
1864+
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
18641865

1865-
pm_runtime_get_sync(&(pdev)->dev);
1866-
ufshcd_remove(hba);
1867-
platform_device_msi_free_irqs_all(hba->dev);
1866+
ufshcd_pltfrm_remove(pdev);
1867+
if (host->esi_enabled)
1868+
platform_device_msi_free_irqs_all(hba->dev);
18681869
}
18691870

18701871
static const struct of_device_id ufs_qcom_of_match[] __maybe_unused = {

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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,7 @@ 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-
432-
pm_runtime_get_sync(&(pdev)->dev);
433-
ufshcd_remove(hba);
430+
ufshcd_pltfrm_remove(pdev);
434431
}
435432

436433
static const struct dev_pm_ops ufs_sprd_pm_ops = {

drivers/ufs/host/ufshcd-pltfrm.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,22 @@ 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+
pm_runtime_get_sync(&pdev->dev);
536+
ufshcd_remove(hba);
537+
ufshcd_dealloc_host(hba);
538+
pm_runtime_disable(&pdev->dev);
539+
pm_runtime_put_noidle(&pdev->dev);
540+
}
541+
EXPORT_SYMBOL_GPL(ufshcd_pltfrm_remove);
542+
527543
MODULE_AUTHOR("Santosh Yaragnavi <[email protected]>");
528544
MODULE_AUTHOR("Vinayak Holikatti <[email protected]>");
529545
MODULE_DESCRIPTION("UFS host controller Platform bus based glue driver");

0 commit comments

Comments
 (0)