drm/rockchip: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 7 May 2023 16:26:01 +0000 (18:26 +0200)
committerDouglas Anderson <dianders@chromium.org>
Thu, 8 Jun 2023 16:04:12 +0000 (09:04 -0700)
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 rockchip drm drivers from always returning zero in the
remove callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230507162616.1368908-39-u.kleine-koenig@pengutronix.de
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
drivers/gpu/drm/rockchip/cdn-dp-core.c
drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
drivers/gpu/drm/rockchip/inno_hdmi.c
drivers/gpu/drm/rockchip/rk3066_hdmi.c
drivers/gpu/drm/rockchip/rockchip_drm_drv.c
drivers/gpu/drm/rockchip/rockchip_lvds.c
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
drivers/gpu/drm/rockchip/rockchip_vop_reg.c

index ad2d3ae..c497382 100644 (file)
@@ -419,14 +419,12 @@ err_dp_remove:
        return ret;
 }
 
-static int rockchip_dp_remove(struct platform_device *pdev)
+static void rockchip_dp_remove(struct platform_device *pdev)
 {
        struct rockchip_dp_device *dp = platform_get_drvdata(pdev);
 
        component_del(&pdev->dev, &rockchip_dp_component_ops);
        analogix_dp_remove(dp->adp);
-
-       return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -481,7 +479,7 @@ MODULE_DEVICE_TABLE(of, rockchip_dp_dt_ids);
 
 struct platform_driver rockchip_dp_driver = {
        .probe = rockchip_dp_probe,
-       .remove = rockchip_dp_remove,
+       .remove_new = rockchip_dp_remove,
        .driver = {
                   .name = "rockchip-dp",
                   .pm = &rockchip_dp_pm_ops,
index b6afe37..a29fbaf 100644 (file)
@@ -1222,15 +1222,13 @@ static int cdn_dp_probe(struct platform_device *pdev)
        return component_add(dev, &cdn_dp_component_ops);
 }
 
-static int cdn_dp_remove(struct platform_device *pdev)
+static void cdn_dp_remove(struct platform_device *pdev)
 {
        struct cdn_dp_device *dp = platform_get_drvdata(pdev);
 
        platform_device_unregister(dp->audio_pdev);
        cdn_dp_suspend(dp->dev);
        component_del(&pdev->dev, &cdn_dp_component_ops);
-
-       return 0;
 }
 
 static void cdn_dp_shutdown(struct platform_device *pdev)
@@ -1247,7 +1245,7 @@ static const struct dev_pm_ops cdn_dp_pm_ops = {
 
 struct platform_driver cdn_dp_driver = {
        .probe = cdn_dp_probe,
-       .remove = cdn_dp_remove,
+       .remove_new = cdn_dp_remove,
        .shutdown = cdn_dp_shutdown,
        .driver = {
                   .name = "cdn-dp",
index 917e799..3e2b1a2 100644 (file)
@@ -1463,13 +1463,11 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int dw_mipi_dsi_rockchip_remove(struct platform_device *pdev)
+static void dw_mipi_dsi_rockchip_remove(struct platform_device *pdev)
 {
        struct dw_mipi_dsi_rockchip *dsi = platform_get_drvdata(pdev);
 
        dw_mipi_dsi_remove(dsi->dmd);
-
-       return 0;
 }
 
 static const struct rockchip_dw_dsi_chip_data px30_chip_data[] = {
@@ -1671,7 +1669,7 @@ MODULE_DEVICE_TABLE(of, dw_mipi_dsi_rockchip_dt_ids);
 
 struct platform_driver dw_mipi_dsi_rockchip_driver = {
        .probe          = dw_mipi_dsi_rockchip_probe,
-       .remove         = dw_mipi_dsi_rockchip_remove,
+       .remove_new     = dw_mipi_dsi_rockchip_remove,
        .driver         = {
                .of_match_table = dw_mipi_dsi_rockchip_dt_ids,
                .pm     = &dw_mipi_dsi_rockchip_pm_ops,
index 1126999..3415501 100644 (file)
@@ -684,11 +684,9 @@ static int dw_hdmi_rockchip_probe(struct platform_device *pdev)
        return component_add(&pdev->dev, &dw_hdmi_rockchip_ops);
 }
 
-static int dw_hdmi_rockchip_remove(struct platform_device *pdev)
+static void dw_hdmi_rockchip_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &dw_hdmi_rockchip_ops);
-
-       return 0;
 }
 
 static int __maybe_unused dw_hdmi_rockchip_resume(struct device *dev)
@@ -706,7 +704,7 @@ static const struct dev_pm_ops dw_hdmi_rockchip_pm = {
 
 struct platform_driver dw_hdmi_rockchip_pltfm_driver = {
        .probe  = dw_hdmi_rockchip_probe,
-       .remove = dw_hdmi_rockchip_remove,
+       .remove_new = dw_hdmi_rockchip_remove,
        .driver = {
                .name = "dwhdmi-rockchip",
                .pm = &dw_hdmi_rockchip_pm,
index f517748..6a63952 100644 (file)
@@ -919,11 +919,9 @@ static int inno_hdmi_probe(struct platform_device *pdev)
        return component_add(&pdev->dev, &inno_hdmi_ops);
 }
 
-static int inno_hdmi_remove(struct platform_device *pdev)
+static void inno_hdmi_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &inno_hdmi_ops);
-
-       return 0;
 }
 
 static const struct of_device_id inno_hdmi_dt_ids[] = {
@@ -935,7 +933,7 @@ MODULE_DEVICE_TABLE(of, inno_hdmi_dt_ids);
 
 struct platform_driver inno_hdmi_driver = {
        .probe  = inno_hdmi_probe,
-       .remove = inno_hdmi_remove,
+       .remove_new = inno_hdmi_remove,
        .driver = {
                .name = "innohdmi-rockchip",
                .of_match_table = inno_hdmi_dt_ids,
index 90145ad..5e6ac27 100644 (file)
@@ -858,11 +858,9 @@ static int rk3066_hdmi_probe(struct platform_device *pdev)
        return component_add(&pdev->dev, &rk3066_hdmi_ops);
 }
 
-static int rk3066_hdmi_remove(struct platform_device *pdev)
+static void rk3066_hdmi_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &rk3066_hdmi_ops);
-
-       return 0;
 }
 
 static const struct of_device_id rk3066_hdmi_dt_ids[] = {
@@ -873,7 +871,7 @@ MODULE_DEVICE_TABLE(of, rk3066_hdmi_dt_ids);
 
 struct platform_driver rk3066_hdmi_driver = {
        .probe  = rk3066_hdmi_probe,
-       .remove = rk3066_hdmi_remove,
+       .remove_new = rk3066_hdmi_remove,
        .driver = {
                .name = "rockchip-rk3066-hdmi",
                .of_match_table = rk3066_hdmi_dt_ids,
index d97f2ed..c0ebfdf 100644 (file)
@@ -450,13 +450,11 @@ static int rockchip_drm_platform_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int rockchip_drm_platform_remove(struct platform_device *pdev)
+static void rockchip_drm_platform_remove(struct platform_device *pdev)
 {
        component_master_del(&pdev->dev, &rockchip_drm_ops);
 
        rockchip_drm_match_remove(&pdev->dev);
-
-       return 0;
 }
 
 static void rockchip_drm_platform_shutdown(struct platform_device *pdev)
@@ -475,7 +473,7 @@ MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids);
 
 static struct platform_driver rockchip_drm_platform_driver = {
        .probe = rockchip_drm_platform_probe,
-       .remove = rockchip_drm_platform_remove,
+       .remove_new = rockchip_drm_platform_remove,
        .shutdown = rockchip_drm_platform_shutdown,
        .driver = {
                .name = "rockchip-drm",
index 68f6ebb..5828593 100644 (file)
@@ -739,19 +739,17 @@ static int rockchip_lvds_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int rockchip_lvds_remove(struct platform_device *pdev)
+static void rockchip_lvds_remove(struct platform_device *pdev)
 {
        struct rockchip_lvds *lvds = platform_get_drvdata(pdev);
 
        component_del(&pdev->dev, &rockchip_lvds_component_ops);
        clk_unprepare(lvds->pclk);
-
-       return 0;
 }
 
 struct platform_driver rockchip_lvds_driver = {
        .probe = rockchip_lvds_probe,
-       .remove = rockchip_lvds_remove,
+       .remove_new = rockchip_lvds_remove,
        .driver = {
                   .name = "rockchip-lvds",
                   .of_match_table = of_match_ptr(rockchip_lvds_dt_ids),
index 9d30aa7..62b573f 100644 (file)
@@ -264,16 +264,14 @@ static int vop2_probe(struct platform_device *pdev)
        return component_add(dev, &vop2_component_ops);
 }
 
-static int vop2_remove(struct platform_device *pdev)
+static void vop2_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &vop2_component_ops);
-
-       return 0;
 }
 
 struct platform_driver vop2_platform_driver = {
        .probe = vop2_probe,
-       .remove = vop2_remove,
+       .remove_new = vop2_remove,
        .driver = {
                .name = "rockchip-vop2",
                .of_match_table = of_match_ptr(vop2_dt_match),
index 20ac781..7b28050 100644 (file)
@@ -1163,16 +1163,14 @@ static int vop_probe(struct platform_device *pdev)
        return component_add(dev, &vop_component_ops);
 }
 
-static int vop_remove(struct platform_device *pdev)
+static void vop_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &vop_component_ops);
-
-       return 0;
 }
 
 struct platform_driver vop_platform_driver = {
        .probe = vop_probe,
-       .remove = vop_remove,
+       .remove_new = vop_remove,
        .driver = {
                .name = "rockchip-vop",
                .of_match_table = vop_driver_dt_match,