Commit 1ed54a19 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Douglas Anderson

drm/vc4: 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 vc4 drm drivers from always returning zero in the
remove callback to the void returning variant.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230507162616.1368908-53-u.kleine-koenig@pengutronix.de
parent b9578128
...@@ -1450,15 +1450,14 @@ static int vc4_crtc_dev_probe(struct platform_device *pdev) ...@@ -1450,15 +1450,14 @@ static int vc4_crtc_dev_probe(struct platform_device *pdev)
return component_add(&pdev->dev, &vc4_crtc_ops); return component_add(&pdev->dev, &vc4_crtc_ops);
} }
static int vc4_crtc_dev_remove(struct platform_device *pdev) static void vc4_crtc_dev_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &vc4_crtc_ops); component_del(&pdev->dev, &vc4_crtc_ops);
return 0;
} }
struct platform_driver vc4_crtc_driver = { struct platform_driver vc4_crtc_driver = {
.probe = vc4_crtc_dev_probe, .probe = vc4_crtc_dev_probe,
.remove = vc4_crtc_dev_remove, .remove_new = vc4_crtc_dev_remove,
.driver = { .driver = {
.name = "vc4_crtc", .name = "vc4_crtc",
.of_match_table = vc4_crtc_dt_match, .of_match_table = vc4_crtc_dt_match,
......
...@@ -388,15 +388,14 @@ static int vc4_dpi_dev_probe(struct platform_device *pdev) ...@@ -388,15 +388,14 @@ static int vc4_dpi_dev_probe(struct platform_device *pdev)
return component_add(&pdev->dev, &vc4_dpi_ops); return component_add(&pdev->dev, &vc4_dpi_ops);
} }
static int vc4_dpi_dev_remove(struct platform_device *pdev) static void vc4_dpi_dev_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &vc4_dpi_ops); component_del(&pdev->dev, &vc4_dpi_ops);
return 0;
} }
struct platform_driver vc4_dpi_driver = { struct platform_driver vc4_dpi_driver = {
.probe = vc4_dpi_dev_probe, .probe = vc4_dpi_dev_probe,
.remove = vc4_dpi_dev_remove, .remove_new = vc4_dpi_dev_remove,
.driver = { .driver = {
.name = "vc4_dpi", .name = "vc4_dpi",
.of_match_table = vc4_dpi_dt_match, .of_match_table = vc4_dpi_dt_match,
......
...@@ -439,11 +439,9 @@ static int vc4_platform_drm_probe(struct platform_device *pdev) ...@@ -439,11 +439,9 @@ static int vc4_platform_drm_probe(struct platform_device *pdev)
return component_master_add_with_match(dev, &vc4_drm_ops, match); return component_master_add_with_match(dev, &vc4_drm_ops, match);
} }
static int vc4_platform_drm_remove(struct platform_device *pdev) static void vc4_platform_drm_remove(struct platform_device *pdev)
{ {
component_master_del(&pdev->dev, &vc4_drm_ops); component_master_del(&pdev->dev, &vc4_drm_ops);
return 0;
} }
static const struct of_device_id vc4_of_match[] = { static const struct of_device_id vc4_of_match[] = {
...@@ -456,7 +454,7 @@ MODULE_DEVICE_TABLE(of, vc4_of_match); ...@@ -456,7 +454,7 @@ MODULE_DEVICE_TABLE(of, vc4_of_match);
static struct platform_driver vc4_platform_driver = { static struct platform_driver vc4_platform_driver = {
.probe = vc4_platform_drm_probe, .probe = vc4_platform_drm_probe,
.remove = vc4_platform_drm_remove, .remove_new = vc4_platform_drm_remove,
.driver = { .driver = {
.name = "vc4-drm", .name = "vc4-drm",
.of_match_table = vc4_of_match, .of_match_table = vc4_of_match,
......
...@@ -1825,20 +1825,18 @@ static int vc4_dsi_dev_probe(struct platform_device *pdev) ...@@ -1825,20 +1825,18 @@ static int vc4_dsi_dev_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int vc4_dsi_dev_remove(struct platform_device *pdev) static void vc4_dsi_dev_remove(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct vc4_dsi *dsi = dev_get_drvdata(dev); struct vc4_dsi *dsi = dev_get_drvdata(dev);
mipi_dsi_host_unregister(&dsi->dsi_host); mipi_dsi_host_unregister(&dsi->dsi_host);
vc4_dsi_put(dsi); vc4_dsi_put(dsi);
return 0;
} }
struct platform_driver vc4_dsi_driver = { struct platform_driver vc4_dsi_driver = {
.probe = vc4_dsi_dev_probe, .probe = vc4_dsi_dev_probe,
.remove = vc4_dsi_dev_remove, .remove_new = vc4_dsi_dev_remove,
.driver = { .driver = {
.name = "vc4_dsi", .name = "vc4_dsi",
.of_match_table = vc4_dsi_dt_match, .of_match_table = vc4_dsi_dt_match,
......
...@@ -3770,10 +3770,9 @@ static int vc4_hdmi_dev_probe(struct platform_device *pdev) ...@@ -3770,10 +3770,9 @@ static int vc4_hdmi_dev_probe(struct platform_device *pdev)
return component_add(&pdev->dev, &vc4_hdmi_ops); return component_add(&pdev->dev, &vc4_hdmi_ops);
} }
static int vc4_hdmi_dev_remove(struct platform_device *pdev) static void vc4_hdmi_dev_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &vc4_hdmi_ops); component_del(&pdev->dev, &vc4_hdmi_ops);
return 0;
} }
static const struct vc4_hdmi_variant bcm2835_variant = { static const struct vc4_hdmi_variant bcm2835_variant = {
...@@ -3869,7 +3868,7 @@ static const struct dev_pm_ops vc4_hdmi_pm_ops = { ...@@ -3869,7 +3868,7 @@ static const struct dev_pm_ops vc4_hdmi_pm_ops = {
struct platform_driver vc4_hdmi_driver = { struct platform_driver vc4_hdmi_driver = {
.probe = vc4_hdmi_dev_probe, .probe = vc4_hdmi_dev_probe,
.remove = vc4_hdmi_dev_remove, .remove_new = vc4_hdmi_dev_remove,
.driver = { .driver = {
.name = "vc4_hdmi", .name = "vc4_hdmi",
.of_match_table = vc4_hdmi_dt_match, .of_match_table = vc4_hdmi_dt_match,
......
...@@ -1061,10 +1061,9 @@ static int vc4_hvs_dev_probe(struct platform_device *pdev) ...@@ -1061,10 +1061,9 @@ static int vc4_hvs_dev_probe(struct platform_device *pdev)
return component_add(&pdev->dev, &vc4_hvs_ops); return component_add(&pdev->dev, &vc4_hvs_ops);
} }
static int vc4_hvs_dev_remove(struct platform_device *pdev) static void vc4_hvs_dev_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &vc4_hvs_ops); component_del(&pdev->dev, &vc4_hvs_ops);
return 0;
} }
static const struct of_device_id vc4_hvs_dt_match[] = { static const struct of_device_id vc4_hvs_dt_match[] = {
...@@ -1075,7 +1074,7 @@ static const struct of_device_id vc4_hvs_dt_match[] = { ...@@ -1075,7 +1074,7 @@ static const struct of_device_id vc4_hvs_dt_match[] = {
struct platform_driver vc4_hvs_driver = { struct platform_driver vc4_hvs_driver = {
.probe = vc4_hvs_dev_probe, .probe = vc4_hvs_dev_probe,
.remove = vc4_hvs_dev_remove, .remove_new = vc4_hvs_dev_remove,
.driver = { .driver = {
.name = "vc4_hvs", .name = "vc4_hvs",
.of_match_table = vc4_hvs_dt_match, .of_match_table = vc4_hvs_dt_match,
......
...@@ -573,10 +573,9 @@ static int vc4_txp_probe(struct platform_device *pdev) ...@@ -573,10 +573,9 @@ static int vc4_txp_probe(struct platform_device *pdev)
return component_add(&pdev->dev, &vc4_txp_ops); return component_add(&pdev->dev, &vc4_txp_ops);
} }
static int vc4_txp_remove(struct platform_device *pdev) static void vc4_txp_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &vc4_txp_ops); component_del(&pdev->dev, &vc4_txp_ops);
return 0;
} }
static const struct of_device_id vc4_txp_dt_match[] = { static const struct of_device_id vc4_txp_dt_match[] = {
...@@ -586,7 +585,7 @@ static const struct of_device_id vc4_txp_dt_match[] = { ...@@ -586,7 +585,7 @@ static const struct of_device_id vc4_txp_dt_match[] = {
struct platform_driver vc4_txp_driver = { struct platform_driver vc4_txp_driver = {
.probe = vc4_txp_probe, .probe = vc4_txp_probe,
.remove = vc4_txp_remove, .remove_new = vc4_txp_remove,
.driver = { .driver = {
.name = "vc4_txp", .name = "vc4_txp",
.of_match_table = vc4_txp_dt_match, .of_match_table = vc4_txp_dt_match,
......
...@@ -532,10 +532,9 @@ static int vc4_v3d_dev_probe(struct platform_device *pdev) ...@@ -532,10 +532,9 @@ static int vc4_v3d_dev_probe(struct platform_device *pdev)
return component_add(&pdev->dev, &vc4_v3d_ops); return component_add(&pdev->dev, &vc4_v3d_ops);
} }
static int vc4_v3d_dev_remove(struct platform_device *pdev) static void vc4_v3d_dev_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &vc4_v3d_ops); component_del(&pdev->dev, &vc4_v3d_ops);
return 0;
} }
const struct of_device_id vc4_v3d_dt_match[] = { const struct of_device_id vc4_v3d_dt_match[] = {
...@@ -547,7 +546,7 @@ const struct of_device_id vc4_v3d_dt_match[] = { ...@@ -547,7 +546,7 @@ const struct of_device_id vc4_v3d_dt_match[] = {
struct platform_driver vc4_v3d_driver = { struct platform_driver vc4_v3d_driver = {
.probe = vc4_v3d_dev_probe, .probe = vc4_v3d_dev_probe,
.remove = vc4_v3d_dev_remove, .remove_new = vc4_v3d_dev_remove,
.driver = { .driver = {
.name = "vc4_v3d", .name = "vc4_v3d",
.of_match_table = vc4_v3d_dt_match, .of_match_table = vc4_v3d_dt_match,
......
...@@ -812,15 +812,14 @@ static int vc4_vec_dev_probe(struct platform_device *pdev) ...@@ -812,15 +812,14 @@ static int vc4_vec_dev_probe(struct platform_device *pdev)
return component_add(&pdev->dev, &vc4_vec_ops); return component_add(&pdev->dev, &vc4_vec_ops);
} }
static int vc4_vec_dev_remove(struct platform_device *pdev) static void vc4_vec_dev_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &vc4_vec_ops); component_del(&pdev->dev, &vc4_vec_ops);
return 0;
} }
struct platform_driver vc4_vec_driver = { struct platform_driver vc4_vec_driver = {
.probe = vc4_vec_dev_probe, .probe = vc4_vec_dev_probe,
.remove = vc4_vec_dev_remove, .remove_new = vc4_vec_dev_remove,
.driver = { .driver = {
.name = "vc4_vec", .name = "vc4_vec",
.of_match_table = vc4_vec_dt_match, .of_match_table = vc4_vec_dt_match,
......
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