spi: mt65xx: Convert to platform remove callback
Merge series from Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
Hello,
compared to (implicit) v1 sent in March with Message-Id:
<20230309094704.2568531-1-u.kleine-koenig@pengutronix.de>, I reworked
patch 1 on feedback by AngeloGioacchino Del Regno. Patches 2 and 3 got
his Reviewed-by.
Best regards
Uwe
Uwe Kleine-König (3):
spi: mt65xx: Properly handle failures in .remove()
spi: mt65xx: Convert to platform remove callback returning void
spi: mt65xx: Don't disguise a "return 0" as "return ret"
drivers/spi/spi-mt65xx.c | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
base-commit: ac9a78681b
--
2.39.2
This commit is contained in:
commit
0bbb363f86
|
@ -1270,27 +1270,31 @@ static int mtk_spi_probe(struct platform_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mtk_spi_remove(struct platform_device *pdev)
|
static void mtk_spi_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct spi_master *master = platform_get_drvdata(pdev);
|
struct spi_master *master = platform_get_drvdata(pdev);
|
||||||
struct mtk_spi *mdata = spi_master_get_devdata(master);
|
struct mtk_spi *mdata = spi_master_get_devdata(master);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = pm_runtime_resume_and_get(&pdev->dev);
|
ret = pm_runtime_get_sync(&pdev->dev);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
return ret;
|
dev_warn(&pdev->dev, "Failed to resume hardware (%pe)\n", ERR_PTR(ret));
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* If pm runtime resume failed, clks are disabled and
|
||||||
|
* unprepared. So don't access the hardware and skip clk
|
||||||
|
* unpreparing.
|
||||||
|
*/
|
||||||
|
mtk_spi_reset(mdata);
|
||||||
|
|
||||||
mtk_spi_reset(mdata);
|
if (mdata->dev_comp->no_need_unprepare) {
|
||||||
|
clk_unprepare(mdata->spi_clk);
|
||||||
if (mdata->dev_comp->no_need_unprepare) {
|
clk_unprepare(mdata->spi_hclk);
|
||||||
clk_unprepare(mdata->spi_clk);
|
}
|
||||||
clk_unprepare(mdata->spi_hclk);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pm_runtime_put_noidle(&pdev->dev);
|
pm_runtime_put_noidle(&pdev->dev);
|
||||||
pm_runtime_disable(&pdev->dev);
|
pm_runtime_disable(&pdev->dev);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
#ifdef CONFIG_PM_SLEEP
|
||||||
|
@ -1309,7 +1313,7 @@ static int mtk_spi_suspend(struct device *dev)
|
||||||
clk_disable_unprepare(mdata->spi_hclk);
|
clk_disable_unprepare(mdata->spi_hclk);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mtk_spi_resume(struct device *dev)
|
static int mtk_spi_resume(struct device *dev)
|
||||||
|
@ -1410,7 +1414,7 @@ static struct platform_driver mtk_spi_driver = {
|
||||||
.of_match_table = mtk_spi_of_match,
|
.of_match_table = mtk_spi_of_match,
|
||||||
},
|
},
|
||||||
.probe = mtk_spi_probe,
|
.probe = mtk_spi_probe,
|
||||||
.remove = mtk_spi_remove,
|
.remove_new = mtk_spi_remove,
|
||||||
};
|
};
|
||||||
|
|
||||||
module_platform_driver(mtk_spi_driver);
|
module_platform_driver(mtk_spi_driver);
|
||||||
|
|
Loading…
Reference in New Issue