drm/msm: Convert to platform remove callback returning void
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 7 May 2023 16:25:54 +0000 (18:25 +0200)
committerJavier Martinez Canillas <javierm@redhat.com>
Sat, 9 Sep 2023 14:12:58 +0000 (16:12 +0200)
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 msm 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>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230507162616.1368908-32-u.kleine-koenig@pengutronix.de
drivers/gpu/drm/msm/adreno/adreno_device.c
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
drivers/gpu/drm/msm/dp/dp_display.c
drivers/gpu/drm/msm/dsi/dsi.c
drivers/gpu/drm/msm/hdmi/hdmi.c
drivers/gpu/drm/msm/hdmi/hdmi_phy.c
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/msm/msm_mdss.c

index cb94cfd137a81808c91e5cacde0d659894f807d9..26a27cb039e9482fc3a641b70d0d7840307c0a5a 100644 (file)
@@ -647,10 +647,9 @@ static int adreno_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int adreno_remove(struct platform_device *pdev)
+static void adreno_remove(struct platform_device *pdev)
 {
        component_del(&pdev->dev, &a3xx_ops);
-       return 0;
 }
 
 static void adreno_shutdown(struct platform_device *pdev)
@@ -765,7 +764,7 @@ static const struct dev_pm_ops adreno_pm_ops = {
 
 static struct platform_driver adreno_driver = {
        .probe = adreno_probe,
-       .remove = adreno_remove,
+       .remove_new = adreno_remove,
        .shutdown = adreno_shutdown,
        .driver = {
                .name = "adreno",
index aa8499de1b9f3179027e96775f940794059fe181..a16ae7db6245cca23159a1e955531c8cfadc4563 100644 (file)
@@ -1239,11 +1239,9 @@ static int dpu_dev_probe(struct platform_device *pdev)
        return msm_drv_probe(&pdev->dev, dpu_kms_init);
 }
 
-static int dpu_dev_remove(struct platform_device *pdev)
+static void dpu_dev_remove(struct platform_device *pdev)
 {
        component_master_del(&pdev->dev, &msm_drm_ops);
-
-       return 0;
 }
 
 static int __maybe_unused dpu_runtime_suspend(struct device *dev)
@@ -1318,7 +1316,7 @@ MODULE_DEVICE_TABLE(of, dpu_dt_match);
 
 static struct platform_driver dpu_driver = {
        .probe = dpu_dev_probe,
-       .remove = dpu_dev_remove,
+       .remove_new = dpu_dev_remove,
        .shutdown = msm_drv_shutdown,
        .driver = {
                .name = "msm_dpu",
index 6e37072ed30228ad30b9c11b5513dd28c8f4799c..3c4258d1784ba34eadf15b781aa9baaa51861b4e 100644 (file)
@@ -561,11 +561,9 @@ static int mdp4_probe(struct platform_device *pdev)
        return msm_drv_probe(&pdev->dev, mdp4_kms_init);
 }
 
-static int mdp4_remove(struct platform_device *pdev)
+static void mdp4_remove(struct platform_device *pdev)
 {
        component_master_del(&pdev->dev, &msm_drm_ops);
-
-       return 0;
 }
 
 static const struct of_device_id mdp4_dt_match[] = {
@@ -576,7 +574,7 @@ MODULE_DEVICE_TABLE(of, mdp4_dt_match);
 
 static struct platform_driver mdp4_platform_driver = {
        .probe      = mdp4_probe,
-       .remove     = mdp4_remove,
+       .remove_new = mdp4_remove,
        .shutdown   = msm_drv_shutdown,
        .driver     = {
                .name   = "mdp4",
index 323079cfd698b3400908baa6fc6b54b84c355547..e8aebad5f20822dafc4f8b8e0eb3eb181afea9bd 100644 (file)
@@ -942,11 +942,10 @@ static int mdp5_dev_probe(struct platform_device *pdev)
        return msm_drv_probe(&pdev->dev, mdp5_kms_init);
 }
 
-static int mdp5_dev_remove(struct platform_device *pdev)
+static void mdp5_dev_remove(struct platform_device *pdev)
 {
        DBG("");
        component_master_del(&pdev->dev, &msm_drm_ops);
-       return 0;
 }
 
 static __maybe_unused int mdp5_runtime_suspend(struct device *dev)
@@ -987,7 +986,7 @@ MODULE_DEVICE_TABLE(of, mdp5_dt_match);
 
 static struct platform_driver mdp5_driver = {
        .probe = mdp5_dev_probe,
-       .remove = mdp5_dev_remove,
+       .remove_new = mdp5_dev_remove,
        .shutdown = msm_drv_shutdown,
        .driver = {
                .name = "msm_mdp",
index 76f13954015b18d3df297826ea0672b9a4f10064..01784e9e7127f0dce7779fa7cab64a52828f1b53 100644 (file)
@@ -1296,7 +1296,7 @@ static int dp_display_probe(struct platform_device *pdev)
        return rc;
 }
 
-static int dp_display_remove(struct platform_device *pdev)
+static void dp_display_remove(struct platform_device *pdev)
 {
        struct dp_display_private *dp = dev_get_dp_display_private(&pdev->dev);
 
@@ -1304,8 +1304,6 @@ static int dp_display_remove(struct platform_device *pdev)
        dp_display_deinit_sub_modules(dp);
 
        platform_set_drvdata(pdev, NULL);
-
-       return 0;
 }
 
 static int dp_pm_resume(struct device *dev)
@@ -1415,7 +1413,7 @@ static const struct dev_pm_ops dp_pm_ops = {
 
 static struct platform_driver dp_display_driver = {
        .probe  = dp_display_probe,
-       .remove = dp_display_remove,
+       .remove_new = dp_display_remove,
        .driver = {
                .name = "msm-dp-display",
                .of_match_table = dp_dt_match,
index baab79ab6e745efee6690a9cc7d6c5df5f9a6321..7a8208cd66491e8af1b1f95daf5f04374ef09150 100644 (file)
@@ -161,14 +161,12 @@ static int dsi_dev_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int dsi_dev_remove(struct platform_device *pdev)
+static void dsi_dev_remove(struct platform_device *pdev)
 {
        struct msm_dsi *msm_dsi = platform_get_drvdata(pdev);
 
        DBG("");
        dsi_destroy(msm_dsi);
-
-       return 0;
 }
 
 static const struct of_device_id dt_match[] = {
@@ -187,7 +185,7 @@ static const struct dev_pm_ops dsi_pm_ops = {
 
 static struct platform_driver dsi_driver = {
        .probe = dsi_dev_probe,
-       .remove = dsi_dev_remove,
+       .remove_new = dsi_dev_remove,
        .driver = {
                .name = "msm_dsi",
                .of_match_table = dt_match,
index 60509fb397100227e3c0585236c2fcad1784f7a4..b6bcb9f675fe4966eed3a8b7bfa00f1f745b2b3b 100644 (file)
@@ -551,15 +551,13 @@ err_put_phy:
        return ret;
 }
 
-static int msm_hdmi_dev_remove(struct platform_device *pdev)
+static void msm_hdmi_dev_remove(struct platform_device *pdev)
 {
        struct hdmi *hdmi = dev_get_drvdata(&pdev->dev);
 
        component_del(&pdev->dev, &msm_hdmi_ops);
 
        msm_hdmi_put_phy(hdmi);
-
-       return 0;
 }
 
 static const struct of_device_id msm_hdmi_dt_match[] = {
@@ -574,7 +572,7 @@ static const struct of_device_id msm_hdmi_dt_match[] = {
 
 static struct platform_driver msm_hdmi_driver = {
        .probe = msm_hdmi_dev_probe,
-       .remove = msm_hdmi_dev_remove,
+       .remove_new = msm_hdmi_dev_remove,
        .driver = {
                .name = "hdmi_msm",
                .of_match_table = msm_hdmi_dt_match,
index 3e00fb8190b2a12ce88d004d5e0a866f9cb855de..88a3423b7f24d581a46f0e5ba25ca274c241ca99 100644 (file)
@@ -177,11 +177,9 @@ static int msm_hdmi_phy_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int msm_hdmi_phy_remove(struct platform_device *pdev)
+static void msm_hdmi_phy_remove(struct platform_device *pdev)
 {
        pm_runtime_disable(&pdev->dev);
-
-       return 0;
 }
 
 static const struct of_device_id msm_hdmi_phy_dt_match[] = {
@@ -200,7 +198,7 @@ static const struct of_device_id msm_hdmi_phy_dt_match[] = {
 
 static struct platform_driver msm_hdmi_phy_platform_driver = {
        .probe      = msm_hdmi_phy_probe,
-       .remove     = msm_hdmi_phy_remove,
+       .remove_new = msm_hdmi_phy_remove,
        .driver     = {
                .name   = "msm_hdmi_phy",
                .of_match_table = msm_hdmi_phy_dt_match,
index 2a0e3529598b698456eb51762f3da480f04695ed..551b0bc28095129f3eac15f648b059f94e61e01c 100644 (file)
@@ -1278,11 +1278,9 @@ static int msm_pdev_probe(struct platform_device *pdev)
        return msm_drv_probe(&pdev->dev, NULL);
 }
 
-static int msm_pdev_remove(struct platform_device *pdev)
+static void msm_pdev_remove(struct platform_device *pdev)
 {
        component_master_del(&pdev->dev, &msm_drm_ops);
-
-       return 0;
 }
 
 void msm_drv_shutdown(struct platform_device *pdev)
@@ -1303,7 +1301,7 @@ void msm_drv_shutdown(struct platform_device *pdev)
 
 static struct platform_driver msm_platform_driver = {
        .probe      = msm_pdev_probe,
-       .remove     = msm_pdev_remove,
+       .remove_new = msm_pdev_remove,
        .shutdown   = msm_drv_shutdown,
        .driver     = {
                .name   = "msm",
index 6bf6c4a0f55036e3c848582039550ddef4c61a59..268fb3d490de16036bb3413d3a88a5ae2ba7e511 100644 (file)
@@ -492,15 +492,13 @@ static int mdss_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int mdss_remove(struct platform_device *pdev)
+static void mdss_remove(struct platform_device *pdev)
 {
        struct msm_mdss *mdss = platform_get_drvdata(pdev);
 
        of_platform_depopulate(&pdev->dev);
 
        msm_mdss_destroy(mdss);
-
-       return 0;
 }
 
 static const struct msm_mdss_data sc7180_data = {
@@ -594,7 +592,7 @@ MODULE_DEVICE_TABLE(of, mdss_dt_match);
 
 static struct platform_driver mdss_platform_driver = {
        .probe      = mdss_probe,
-       .remove     = mdss_remove,
+       .remove_new = mdss_remove,
        .driver     = {
                .name   = "msm-mdss",
                .of_match_table = mdss_dt_match,