Commit b3af12a0 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Chun-Kuang Hu

drm/mediatek: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert the mediatek drm drivers from always returning zero in
the remove callback to the void returning variant.
Reviewed-by: default avatarMatthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJyri Sarha <jyri.sarha@iki.fi>
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20230801110239.831099-8-u.kleine-koenig@pengutronix.de/Signed-off-by: default avatarChun-Kuang Hu <chunkuang.hu@kernel.org>
parent 61a97dec
...@@ -235,13 +235,12 @@ static int mtk_cec_probe(struct platform_device *pdev) ...@@ -235,13 +235,12 @@ static int mtk_cec_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int mtk_cec_remove(struct platform_device *pdev) static void mtk_cec_remove(struct platform_device *pdev)
{ {
struct mtk_cec *cec = platform_get_drvdata(pdev); struct mtk_cec *cec = platform_get_drvdata(pdev);
mtk_cec_htplg_irq_disable(cec); mtk_cec_htplg_irq_disable(cec);
clk_disable_unprepare(cec->clk); clk_disable_unprepare(cec->clk);
return 0;
} }
static const struct of_device_id mtk_cec_of_ids[] = { static const struct of_device_id mtk_cec_of_ids[] = {
...@@ -252,7 +251,7 @@ MODULE_DEVICE_TABLE(of, mtk_cec_of_ids); ...@@ -252,7 +251,7 @@ MODULE_DEVICE_TABLE(of, mtk_cec_of_ids);
struct platform_driver mtk_cec_driver = { struct platform_driver mtk_cec_driver = {
.probe = mtk_cec_probe, .probe = mtk_cec_probe,
.remove = mtk_cec_remove, .remove_new = mtk_cec_remove,
.driver = { .driver = {
.name = "mediatek-cec", .name = "mediatek-cec",
.of_match_table = mtk_cec_of_ids, .of_match_table = mtk_cec_of_ids,
......
...@@ -140,11 +140,9 @@ static int mtk_disp_aal_probe(struct platform_device *pdev) ...@@ -140,11 +140,9 @@ static int mtk_disp_aal_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int mtk_disp_aal_remove(struct platform_device *pdev) static void mtk_disp_aal_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &mtk_disp_aal_component_ops); component_del(&pdev->dev, &mtk_disp_aal_component_ops);
return 0;
} }
static const struct mtk_disp_aal_data mt8173_aal_driver_data = { static const struct mtk_disp_aal_data mt8173_aal_driver_data = {
...@@ -161,7 +159,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_aal_driver_dt_match); ...@@ -161,7 +159,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_aal_driver_dt_match);
struct platform_driver mtk_disp_aal_driver = { struct platform_driver mtk_disp_aal_driver = {
.probe = mtk_disp_aal_probe, .probe = mtk_disp_aal_probe,
.remove = mtk_disp_aal_remove, .remove_new = mtk_disp_aal_remove,
.driver = { .driver = {
.name = "mediatek-disp-aal", .name = "mediatek-disp-aal",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -195,11 +195,9 @@ static int mtk_disp_ccorr_probe(struct platform_device *pdev) ...@@ -195,11 +195,9 @@ static int mtk_disp_ccorr_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int mtk_disp_ccorr_remove(struct platform_device *pdev) static void mtk_disp_ccorr_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &mtk_disp_ccorr_component_ops); component_del(&pdev->dev, &mtk_disp_ccorr_component_ops);
return 0;
} }
static const struct mtk_disp_ccorr_data mt8183_ccorr_driver_data = { static const struct mtk_disp_ccorr_data mt8183_ccorr_driver_data = {
...@@ -221,7 +219,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_ccorr_driver_dt_match); ...@@ -221,7 +219,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_ccorr_driver_dt_match);
struct platform_driver mtk_disp_ccorr_driver = { struct platform_driver mtk_disp_ccorr_driver = {
.probe = mtk_disp_ccorr_probe, .probe = mtk_disp_ccorr_probe,
.remove = mtk_disp_ccorr_remove, .remove_new = mtk_disp_ccorr_remove,
.driver = { .driver = {
.name = "mediatek-disp-ccorr", .name = "mediatek-disp-ccorr",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -132,11 +132,9 @@ static int mtk_disp_color_probe(struct platform_device *pdev) ...@@ -132,11 +132,9 @@ static int mtk_disp_color_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int mtk_disp_color_remove(struct platform_device *pdev) static void mtk_disp_color_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &mtk_disp_color_component_ops); component_del(&pdev->dev, &mtk_disp_color_component_ops);
return 0;
} }
static const struct mtk_disp_color_data mt2701_color_driver_data = { static const struct mtk_disp_color_data mt2701_color_driver_data = {
...@@ -164,7 +162,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_color_driver_dt_match); ...@@ -164,7 +162,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_color_driver_dt_match);
struct platform_driver mtk_disp_color_driver = { struct platform_driver mtk_disp_color_driver = {
.probe = mtk_disp_color_probe, .probe = mtk_disp_color_probe,
.remove = mtk_disp_color_remove, .remove_new = mtk_disp_color_remove,
.driver = { .driver = {
.name = "mediatek-disp-color", .name = "mediatek-disp-color",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -183,11 +183,9 @@ static int mtk_disp_gamma_probe(struct platform_device *pdev) ...@@ -183,11 +183,9 @@ static int mtk_disp_gamma_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int mtk_disp_gamma_remove(struct platform_device *pdev) static void mtk_disp_gamma_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &mtk_disp_gamma_component_ops); component_del(&pdev->dev, &mtk_disp_gamma_component_ops);
return 0;
} }
static const struct mtk_disp_gamma_data mt8173_gamma_driver_data = { static const struct mtk_disp_gamma_data mt8173_gamma_driver_data = {
...@@ -209,7 +207,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_gamma_driver_dt_match); ...@@ -209,7 +207,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_gamma_driver_dt_match);
struct platform_driver mtk_disp_gamma_driver = { struct platform_driver mtk_disp_gamma_driver = {
.probe = mtk_disp_gamma_probe, .probe = mtk_disp_gamma_probe,
.remove = mtk_disp_gamma_remove, .remove_new = mtk_disp_gamma_remove,
.driver = { .driver = {
.name = "mediatek-disp-gamma", .name = "mediatek-disp-gamma",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -295,11 +295,9 @@ static int mtk_disp_merge_probe(struct platform_device *pdev) ...@@ -295,11 +295,9 @@ static int mtk_disp_merge_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int mtk_disp_merge_remove(struct platform_device *pdev) static void mtk_disp_merge_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &mtk_disp_merge_component_ops); component_del(&pdev->dev, &mtk_disp_merge_component_ops);
return 0;
} }
static const struct of_device_id mtk_disp_merge_driver_dt_match[] = { static const struct of_device_id mtk_disp_merge_driver_dt_match[] = {
...@@ -311,7 +309,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_merge_driver_dt_match); ...@@ -311,7 +309,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_merge_driver_dt_match);
struct platform_driver mtk_disp_merge_driver = { struct platform_driver mtk_disp_merge_driver = {
.probe = mtk_disp_merge_probe, .probe = mtk_disp_merge_probe,
.remove = mtk_disp_merge_remove, .remove_new = mtk_disp_merge_remove,
.driver = { .driver = {
.name = "mediatek-disp-merge", .name = "mediatek-disp-merge",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -562,12 +562,10 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev) ...@@ -562,12 +562,10 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int mtk_disp_ovl_remove(struct platform_device *pdev) static void mtk_disp_ovl_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &mtk_disp_ovl_component_ops); component_del(&pdev->dev, &mtk_disp_ovl_component_ops);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
return 0;
} }
static const struct mtk_disp_ovl_data mt2701_ovl_driver_data = { static const struct mtk_disp_ovl_data mt2701_ovl_driver_data = {
...@@ -659,7 +657,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_ovl_driver_dt_match); ...@@ -659,7 +657,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_ovl_driver_dt_match);
struct platform_driver mtk_disp_ovl_driver = { struct platform_driver mtk_disp_ovl_driver = {
.probe = mtk_disp_ovl_probe, .probe = mtk_disp_ovl_probe,
.remove = mtk_disp_ovl_remove, .remove_new = mtk_disp_ovl_remove,
.driver = { .driver = {
.name = "mediatek-disp-ovl", .name = "mediatek-disp-ovl",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -380,13 +380,11 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev) ...@@ -380,13 +380,11 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int mtk_disp_rdma_remove(struct platform_device *pdev) static void mtk_disp_rdma_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &mtk_disp_rdma_component_ops); component_del(&pdev->dev, &mtk_disp_rdma_component_ops);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
return 0;
} }
static const struct mtk_disp_rdma_data mt2701_rdma_driver_data = { static const struct mtk_disp_rdma_data mt2701_rdma_driver_data = {
...@@ -428,7 +426,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_rdma_driver_dt_match); ...@@ -428,7 +426,7 @@ MODULE_DEVICE_TABLE(of, mtk_disp_rdma_driver_dt_match);
struct platform_driver mtk_disp_rdma_driver = { struct platform_driver mtk_disp_rdma_driver = {
.probe = mtk_disp_rdma_probe, .probe = mtk_disp_rdma_probe,
.remove = mtk_disp_rdma_remove, .remove_new = mtk_disp_rdma_remove,
.driver = { .driver = {
.name = "mediatek-disp-rdma", .name = "mediatek-disp-rdma",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -2694,7 +2694,7 @@ static int mtk_dp_probe(struct platform_device *pdev) ...@@ -2694,7 +2694,7 @@ static int mtk_dp_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int mtk_dp_remove(struct platform_device *pdev) static void mtk_dp_remove(struct platform_device *pdev)
{ {
struct mtk_dp *mtk_dp = platform_get_drvdata(pdev); struct mtk_dp *mtk_dp = platform_get_drvdata(pdev);
...@@ -2705,8 +2705,6 @@ static int mtk_dp_remove(struct platform_device *pdev) ...@@ -2705,8 +2705,6 @@ static int mtk_dp_remove(struct platform_device *pdev)
platform_device_unregister(mtk_dp->phy_dev); platform_device_unregister(mtk_dp->phy_dev);
if (mtk_dp->audio_pdev) if (mtk_dp->audio_pdev)
platform_device_unregister(mtk_dp->audio_pdev); platform_device_unregister(mtk_dp->audio_pdev);
return 0;
} }
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
...@@ -2767,7 +2765,7 @@ MODULE_DEVICE_TABLE(of, mtk_dp_of_match); ...@@ -2767,7 +2765,7 @@ MODULE_DEVICE_TABLE(of, mtk_dp_of_match);
static struct platform_driver mtk_dp_driver = { static struct platform_driver mtk_dp_driver = {
.probe = mtk_dp_probe, .probe = mtk_dp_probe,
.remove = mtk_dp_remove, .remove_new = mtk_dp_remove,
.driver = { .driver = {
.name = "mediatek-drm-dp", .name = "mediatek-drm-dp",
.of_match_table = mtk_dp_of_match, .of_match_table = mtk_dp_of_match,
......
...@@ -909,7 +909,7 @@ static int mtk_drm_probe(struct platform_device *pdev) ...@@ -909,7 +909,7 @@ static int mtk_drm_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int mtk_drm_remove(struct platform_device *pdev) static void mtk_drm_remove(struct platform_device *pdev)
{ {
struct mtk_drm_private *private = platform_get_drvdata(pdev); struct mtk_drm_private *private = platform_get_drvdata(pdev);
int i; int i;
...@@ -919,8 +919,6 @@ static int mtk_drm_remove(struct platform_device *pdev) ...@@ -919,8 +919,6 @@ static int mtk_drm_remove(struct platform_device *pdev)
of_node_put(private->mutex_node); of_node_put(private->mutex_node);
for (i = 0; i < DDP_COMPONENT_DRM_ID_MAX; i++) for (i = 0; i < DDP_COMPONENT_DRM_ID_MAX; i++)
of_node_put(private->comp_node[i]); of_node_put(private->comp_node[i]);
return 0;
} }
static int mtk_drm_sys_prepare(struct device *dev) static int mtk_drm_sys_prepare(struct device *dev)
...@@ -953,7 +951,7 @@ static const struct dev_pm_ops mtk_drm_pm_ops = { ...@@ -953,7 +951,7 @@ static const struct dev_pm_ops mtk_drm_pm_ops = {
static struct platform_driver mtk_drm_platform_driver = { static struct platform_driver mtk_drm_platform_driver = {
.probe = mtk_drm_probe, .probe = mtk_drm_probe,
.remove = mtk_drm_remove, .remove_new = mtk_drm_remove,
.driver = { .driver = {
.name = "mediatek-drm", .name = "mediatek-drm",
.pm = &mtk_drm_pm_ops, .pm = &mtk_drm_pm_ops,
......
...@@ -1178,14 +1178,12 @@ static int mtk_dsi_probe(struct platform_device *pdev) ...@@ -1178,14 +1178,12 @@ static int mtk_dsi_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int mtk_dsi_remove(struct platform_device *pdev) static void mtk_dsi_remove(struct platform_device *pdev)
{ {
struct mtk_dsi *dsi = platform_get_drvdata(pdev); struct mtk_dsi *dsi = platform_get_drvdata(pdev);
mtk_output_dsi_disable(dsi); mtk_output_dsi_disable(dsi);
mipi_dsi_host_unregister(&dsi->host); mipi_dsi_host_unregister(&dsi->host);
return 0;
} }
static const struct mtk_dsi_driver_data mt8173_dsi_driver_data = { static const struct mtk_dsi_driver_data mt8173_dsi_driver_data = {
...@@ -1223,7 +1221,7 @@ MODULE_DEVICE_TABLE(of, mtk_dsi_of_match); ...@@ -1223,7 +1221,7 @@ MODULE_DEVICE_TABLE(of, mtk_dsi_of_match);
struct platform_driver mtk_dsi_driver = { struct platform_driver mtk_dsi_driver = {
.probe = mtk_dsi_probe, .probe = mtk_dsi_probe,
.remove = mtk_dsi_remove, .remove_new = mtk_dsi_remove,
.driver = { .driver = {
.name = "mtk-dsi", .name = "mtk-dsi",
.of_match_table = mtk_dsi_of_match, .of_match_table = mtk_dsi_of_match,
......
...@@ -1746,13 +1746,12 @@ static int mtk_drm_hdmi_probe(struct platform_device *pdev) ...@@ -1746,13 +1746,12 @@ static int mtk_drm_hdmi_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int mtk_drm_hdmi_remove(struct platform_device *pdev) static void mtk_drm_hdmi_remove(struct platform_device *pdev)
{ {
struct mtk_hdmi *hdmi = platform_get_drvdata(pdev); struct mtk_hdmi *hdmi = platform_get_drvdata(pdev);
drm_bridge_remove(&hdmi->bridge); drm_bridge_remove(&hdmi->bridge);
mtk_hdmi_clk_disable_audio(hdmi); mtk_hdmi_clk_disable_audio(hdmi);
return 0;
} }
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
...@@ -1806,7 +1805,7 @@ MODULE_DEVICE_TABLE(of, mtk_drm_hdmi_of_ids); ...@@ -1806,7 +1805,7 @@ MODULE_DEVICE_TABLE(of, mtk_drm_hdmi_of_ids);
static struct platform_driver mtk_hdmi_driver = { static struct platform_driver mtk_hdmi_driver = {
.probe = mtk_drm_hdmi_probe, .probe = mtk_drm_hdmi_probe,
.remove = mtk_drm_hdmi_remove, .remove_new = mtk_drm_hdmi_remove,
.driver = { .driver = {
.name = "mediatek-drm-hdmi", .name = "mediatek-drm-hdmi",
.of_match_table = mtk_drm_hdmi_of_ids, .of_match_table = mtk_drm_hdmi_of_ids,
......
...@@ -324,14 +324,12 @@ static int mtk_hdmi_ddc_probe(struct platform_device *pdev) ...@@ -324,14 +324,12 @@ static int mtk_hdmi_ddc_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int mtk_hdmi_ddc_remove(struct platform_device *pdev) static void mtk_hdmi_ddc_remove(struct platform_device *pdev)
{ {
struct mtk_hdmi_ddc *ddc = platform_get_drvdata(pdev); struct mtk_hdmi_ddc *ddc = platform_get_drvdata(pdev);
i2c_del_adapter(&ddc->adap); i2c_del_adapter(&ddc->adap);
clk_disable_unprepare(ddc->clk); clk_disable_unprepare(ddc->clk);
return 0;
} }
static const struct of_device_id mtk_hdmi_ddc_match[] = { static const struct of_device_id mtk_hdmi_ddc_match[] = {
...@@ -342,7 +340,7 @@ MODULE_DEVICE_TABLE(of, mtk_hdmi_ddc_match); ...@@ -342,7 +340,7 @@ MODULE_DEVICE_TABLE(of, mtk_hdmi_ddc_match);
struct platform_driver mtk_hdmi_ddc_driver = { struct platform_driver mtk_hdmi_ddc_driver = {
.probe = mtk_hdmi_ddc_probe, .probe = mtk_hdmi_ddc_probe,
.remove = mtk_hdmi_ddc_remove, .remove_new = mtk_hdmi_ddc_remove,
.driver = { .driver = {
.name = "mediatek-hdmi-ddc", .name = "mediatek-hdmi-ddc",
.of_match_table = mtk_hdmi_ddc_match, .of_match_table = mtk_hdmi_ddc_match,
......
...@@ -315,11 +315,10 @@ static int mtk_mdp_rdma_probe(struct platform_device *pdev) ...@@ -315,11 +315,10 @@ static int mtk_mdp_rdma_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int mtk_mdp_rdma_remove(struct platform_device *pdev) static void mtk_mdp_rdma_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &mtk_mdp_rdma_component_ops); component_del(&pdev->dev, &mtk_mdp_rdma_component_ops);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
return 0;
} }
static const struct of_device_id mtk_mdp_rdma_driver_dt_match[] = { static const struct of_device_id mtk_mdp_rdma_driver_dt_match[] = {
...@@ -330,7 +329,7 @@ MODULE_DEVICE_TABLE(of, mtk_mdp_rdma_driver_dt_match); ...@@ -330,7 +329,7 @@ MODULE_DEVICE_TABLE(of, mtk_mdp_rdma_driver_dt_match);
struct platform_driver mtk_mdp_rdma_driver = { struct platform_driver mtk_mdp_rdma_driver = {
.probe = mtk_mdp_rdma_probe, .probe = mtk_mdp_rdma_probe,
.remove = mtk_mdp_rdma_remove, .remove_new = mtk_mdp_rdma_remove,
.driver = { .driver = {
.name = "mediatek-mdp-rdma", .name = "mediatek-mdp-rdma",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment