linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void
@ 2023-03-22 17:02 Uwe Kleine-König
  2023-03-22 17:02 ` [PATCH 01/12] gpu: host1x: Make host1x_client_unregister() return void Uwe Kleine-König
                   ` (12 more replies)
  0 siblings, 13 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-03-22 17:02 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter,
	Sowjanya Komatineni, Mauro Carvalho Chehab, Greg Kroah-Hartman
  Cc: dri-devel, linux-tegra, kernel, linux-media, linux-staging

Hello,

this series adapts the platform drivers below drivers/gpu/drm/tegra to
use the .remove_new() callback. Compared to the traditional .remove()
callback .remove_new() returns no value. This is a good thing because
the driver core doesn't (and cannot) cope for errors during remove. The
only effect of a non-zero return value in .remove() is that the driver
core emits a warning. The device is removed anyhow and an early return
from .remove() usually yields a resource leak.

By changing the remove callback to return void driver authors cannot
reasonably assume any more that there is some kind of cleanup later.

The first two patches are simplifications that make it obvious that all
remove callbacks always return zero. After that all drivers can be
converted trivially.

Best regards
Uwe

Uwe Kleine-König (12):
  gpu: host1x: Make host1x_client_unregister() return void
  drm/tegra: rgb: Make tegra_dc_rgb_remove() return void
  drm/tegra: dc: Convert to platform remove callback returning void
  drm/tegra: dpaux: Convert to platform remove callback returning void
  drm/tegra: dsi: Convert to platform remove callback returning void
  drm/tegra: gr2d: Convert to platform remove callback returning void
  drm/tegra: gr3d: Convert to platform remove callback returning void
  drm/tegra: hdmi: Convert to platform remove callback returning void
  drm/tegra: hub: Convert to platform remove callback returning void
  drm/tegra: nvdec: Convert to platform remove callback returning void
  drm/tegra: sor: Convert to platform remove callback returning void
  drm/tegra: vic: Convert to platform remove callback returning void

 drivers/gpu/drm/tegra/dc.c              | 20 ++++----------------
 drivers/gpu/drm/tegra/dc.h              |  2 +-
 drivers/gpu/drm/tegra/dpaux.c           |  6 ++----
 drivers/gpu/drm/tegra/dsi.c             | 14 +++-----------
 drivers/gpu/drm/tegra/gr2d.c            | 14 +++-----------
 drivers/gpu/drm/tegra/gr3d.c            | 14 +++-----------
 drivers/gpu/drm/tegra/hdmi.c            | 14 +++-----------
 drivers/gpu/drm/tegra/hub.c             | 13 +++----------
 drivers/gpu/drm/tegra/nvdec.c           | 14 +++-----------
 drivers/gpu/drm/tegra/rgb.c             |  6 ++----
 drivers/gpu/drm/tegra/sor.c             | 14 +++-----------
 drivers/gpu/drm/tegra/vic.c             | 14 +++-----------
 drivers/gpu/host1x/bus.c                |  6 ++----
 drivers/staging/media/tegra-video/csi.c |  8 +-------
 drivers/staging/media/tegra-video/vi.c  |  8 +-------
 include/linux/host1x.h                  |  2 +-
 16 files changed, 38 insertions(+), 131 deletions(-)

base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
-- 
2.39.2


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 01/12] gpu: host1x: Make host1x_client_unregister() return void
  2023-03-22 17:02 [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-03-22 17:02 ` Uwe Kleine-König
  2023-03-27  7:17   ` Hans Verkuil
  2023-03-22 17:02 ` [PATCH 02/12] drm/tegra: rgb: Make tegra_dc_rgb_remove() " Uwe Kleine-König
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 15+ messages in thread
From: Uwe Kleine-König @ 2023-03-22 17:02 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter,
	Sowjanya Komatineni, Mauro Carvalho Chehab, Greg Kroah-Hartman
  Cc: dri-devel, linux-tegra, kernel, linux-media, linux-staging

This function returned zero unconditionally. Make it return no value and
simplify all callers accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/gpu/drm/tegra/dc.c              | 7 +------
 drivers/gpu/drm/tegra/dsi.c             | 8 +-------
 drivers/gpu/drm/tegra/gr2d.c            | 8 +-------
 drivers/gpu/drm/tegra/gr3d.c            | 8 +-------
 drivers/gpu/drm/tegra/hdmi.c            | 8 +-------
 drivers/gpu/drm/tegra/hub.c             | 9 ++-------
 drivers/gpu/drm/tegra/nvdec.c           | 8 +-------
 drivers/gpu/drm/tegra/sor.c             | 8 +-------
 drivers/gpu/drm/tegra/vic.c             | 8 +-------
 drivers/gpu/host1x/bus.c                | 6 ++----
 drivers/staging/media/tegra-video/csi.c | 8 +-------
 drivers/staging/media/tegra-video/vi.c  | 8 +-------
 include/linux/host1x.h                  | 2 +-
 13 files changed, 15 insertions(+), 81 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index a67453cee883..bd108159fc2c 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -3268,12 +3268,7 @@ static int tegra_dc_remove(struct platform_device *pdev)
 	struct tegra_dc *dc = platform_get_drvdata(pdev);
 	int err;
 
-	err = host1x_client_unregister(&dc->client);
-	if (err < 0) {
-		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
-			err);
-		return err;
-	}
+	host1x_client_unregister(&dc->client);
 
 	err = tegra_dc_rgb_remove(dc);
 	if (err < 0) {
diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index de1333dc0d86..c8a02a1024bc 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -1662,16 +1662,10 @@ static int tegra_dsi_probe(struct platform_device *pdev)
 static int tegra_dsi_remove(struct platform_device *pdev)
 {
 	struct tegra_dsi *dsi = platform_get_drvdata(pdev);
-	int err;
 
 	pm_runtime_disable(&pdev->dev);
 
-	err = host1x_client_unregister(&dsi->client);
-	if (err < 0) {
-		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
-			err);
-		return err;
-	}
+	host1x_client_unregister(&dsi->client);
 
 	tegra_output_remove(&dsi->output);
 
diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c
index e3bb4c99ed39..49b8d4953e7f 100644
--- a/drivers/gpu/drm/tegra/gr2d.c
+++ b/drivers/gpu/drm/tegra/gr2d.c
@@ -298,14 +298,8 @@ static int gr2d_probe(struct platform_device *pdev)
 static int gr2d_remove(struct platform_device *pdev)
 {
 	struct gr2d *gr2d = platform_get_drvdata(pdev);
-	int err;
 
-	err = host1x_client_unregister(&gr2d->client.base);
-	if (err < 0) {
-		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
-			err);
-		return err;
-	}
+	host1x_client_unregister(&gr2d->client.base);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c
index a1fd3113ea96..cd3679d8eef9 100644
--- a/drivers/gpu/drm/tegra/gr3d.c
+++ b/drivers/gpu/drm/tegra/gr3d.c
@@ -553,14 +553,8 @@ static int gr3d_probe(struct platform_device *pdev)
 static int gr3d_remove(struct platform_device *pdev)
 {
 	struct gr3d *gr3d = platform_get_drvdata(pdev);
-	int err;
 
-	err = host1x_client_unregister(&gr3d->client.base);
-	if (err < 0) {
-		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
-			err);
-		return err;
-	}
+	host1x_client_unregister(&gr3d->client.base);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index 40ec3e6cf204..6798eea317df 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -1877,14 +1877,8 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
 static int tegra_hdmi_remove(struct platform_device *pdev)
 {
 	struct tegra_hdmi *hdmi = platform_get_drvdata(pdev);
-	int err;
 
-	err = host1x_client_unregister(&hdmi->client);
-	if (err < 0) {
-		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
-			err);
-		return err;
-	}
+	host1x_client_unregister(&hdmi->client);
 
 	tegra_output_remove(&hdmi->output);
 
diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c
index b872527a123c..2c91dc444085 100644
--- a/drivers/gpu/drm/tegra/hub.c
+++ b/drivers/gpu/drm/tegra/hub.c
@@ -1178,13 +1178,8 @@ static int tegra_display_hub_remove(struct platform_device *pdev)
 {
 	struct tegra_display_hub *hub = platform_get_drvdata(pdev);
 	unsigned int i;
-	int err;
 
-	err = host1x_client_unregister(&hub->client);
-	if (err < 0) {
-		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
-			err);
-	}
+	host1x_client_unregister(&hub->client);
 
 	for (i = 0; i < hub->soc->num_wgrps; i++) {
 		struct tegra_windowgroup *wgrp = &hub->wgrps[i];
@@ -1194,7 +1189,7 @@ static int tegra_display_hub_remove(struct platform_device *pdev)
 
 	pm_runtime_disable(&pdev->dev);
 
-	return err;
+	return 0;
 }
 
 static const struct tegra_display_hub_soc tegra186_display_hub = {
diff --git a/drivers/gpu/drm/tegra/nvdec.c b/drivers/gpu/drm/tegra/nvdec.c
index 86c5818ac27b..077f3af0d0b6 100644
--- a/drivers/gpu/drm/tegra/nvdec.c
+++ b/drivers/gpu/drm/tegra/nvdec.c
@@ -550,14 +550,8 @@ static int nvdec_probe(struct platform_device *pdev)
 static int nvdec_remove(struct platform_device *pdev)
 {
 	struct nvdec *nvdec = platform_get_drvdata(pdev);
-	int err;
 
-	err = host1x_client_unregister(&nvdec->client.base);
-	if (err < 0) {
-		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
-			err);
-		return err;
-	}
+	host1x_client_unregister(&nvdec->client.base);
 
 	falcon_exit(&nvdec->falcon);
 
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 8af632740673..d067b2d01b2e 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -3981,14 +3981,8 @@ static int tegra_sor_probe(struct platform_device *pdev)
 static int tegra_sor_remove(struct platform_device *pdev)
 {
 	struct tegra_sor *sor = platform_get_drvdata(pdev);
-	int err;
 
-	err = host1x_client_unregister(&sor->client);
-	if (err < 0) {
-		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
-			err);
-		return err;
-	}
+	host1x_client_unregister(&sor->client);
 
 	pm_runtime_disable(&pdev->dev);
 
diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c
index 531a71c72061..fd614756ecf8 100644
--- a/drivers/gpu/drm/tegra/vic.c
+++ b/drivers/gpu/drm/tegra/vic.c
@@ -540,14 +540,8 @@ static int vic_probe(struct platform_device *pdev)
 static int vic_remove(struct platform_device *pdev)
 {
 	struct vic *vic = platform_get_drvdata(pdev);
-	int err;
 
-	err = host1x_client_unregister(&vic->client.base);
-	if (err < 0) {
-		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
-			err);
-		return err;
-	}
+	host1x_client_unregister(&vic->client.base);
 
 	falcon_exit(&vic->falcon);
 
diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
index bc7271a00a94..4d16a3396c4a 100644
--- a/drivers/gpu/host1x/bus.c
+++ b/drivers/gpu/host1x/bus.c
@@ -803,7 +803,7 @@ EXPORT_SYMBOL(__host1x_client_register);
  * Removes a host1x client from its host1x controller instance. If a logical
  * device has already been initialized, it will be torn down.
  */
-int host1x_client_unregister(struct host1x_client *client)
+void host1x_client_unregister(struct host1x_client *client)
 {
 	struct host1x_client *c;
 	struct host1x *host1x;
@@ -815,7 +815,7 @@ int host1x_client_unregister(struct host1x_client *client)
 		err = host1x_del_client(host1x, client);
 		if (!err) {
 			mutex_unlock(&devices_lock);
-			return 0;
+			return;
 		}
 	}
 
@@ -832,8 +832,6 @@ int host1x_client_unregister(struct host1x_client *client)
 	mutex_unlock(&clients_lock);
 
 	host1x_bo_cache_destroy(&client->cache);
-
-	return 0;
 }
 EXPORT_SYMBOL(host1x_client_unregister);
 
diff --git a/drivers/staging/media/tegra-video/csi.c b/drivers/staging/media/tegra-video/csi.c
index 426e653bd55d..36ca639622c9 100644
--- a/drivers/staging/media/tegra-video/csi.c
+++ b/drivers/staging/media/tegra-video/csi.c
@@ -778,14 +778,8 @@ static int tegra_csi_probe(struct platform_device *pdev)
 static int tegra_csi_remove(struct platform_device *pdev)
 {
 	struct tegra_csi *csi = platform_get_drvdata(pdev);
-	int err;
 
-	err = host1x_client_unregister(&csi->client);
-	if (err < 0) {
-		dev_err(&pdev->dev,
-			"failed to unregister host1x client: %d\n", err);
-		return err;
-	}
+	host1x_client_unregister(&csi->client);
 
 	pm_runtime_disable(&pdev->dev);
 
diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c
index 11dd142c98c5..26f7aedce718 100644
--- a/drivers/staging/media/tegra-video/vi.c
+++ b/drivers/staging/media/tegra-video/vi.c
@@ -2041,14 +2041,8 @@ static int tegra_vi_probe(struct platform_device *pdev)
 static int tegra_vi_remove(struct platform_device *pdev)
 {
 	struct tegra_vi *vi = platform_get_drvdata(pdev);
-	int err;
 
-	err = host1x_client_unregister(&vi->client);
-	if (err < 0) {
-		dev_err(&pdev->dev,
-			"failed to unregister host1x client: %d\n", err);
-		return err;
-	}
+	host1x_client_unregister(&vi->client);
 
 	pm_runtime_disable(&pdev->dev);
 
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index 9a9de4b97a25..9c8119ed13a4 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -443,7 +443,7 @@ int __host1x_client_register(struct host1x_client *client);
 		__host1x_client_register(client);	\
 	})
 
-int host1x_client_unregister(struct host1x_client *client);
+void host1x_client_unregister(struct host1x_client *client);
 
 int host1x_client_suspend(struct host1x_client *client);
 int host1x_client_resume(struct host1x_client *client);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 02/12] drm/tegra: rgb: Make tegra_dc_rgb_remove() return void
  2023-03-22 17:02 [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void Uwe Kleine-König
  2023-03-22 17:02 ` [PATCH 01/12] gpu: host1x: Make host1x_client_unregister() return void Uwe Kleine-König
@ 2023-03-22 17:02 ` Uwe Kleine-König
  2023-03-22 17:02 ` [PATCH 03/12] drm/tegra: dc: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-03-22 17:02 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter
  Cc: dri-devel, linux-tegra, kernel

This function returned zero unconditionally. Make it return no value and
simplify all callers accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/gpu/drm/tegra/dc.c  | 7 +------
 drivers/gpu/drm/tegra/dc.h  | 2 +-
 drivers/gpu/drm/tegra/rgb.c | 6 ++----
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index bd108159fc2c..6bf1b2bc43b1 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -3266,15 +3266,10 @@ static int tegra_dc_probe(struct platform_device *pdev)
 static int tegra_dc_remove(struct platform_device *pdev)
 {
 	struct tegra_dc *dc = platform_get_drvdata(pdev);
-	int err;
 
 	host1x_client_unregister(&dc->client);
 
-	err = tegra_dc_rgb_remove(dc);
-	if (err < 0) {
-		dev_err(&pdev->dev, "failed to remove RGB output: %d\n", err);
-		return err;
-	}
+	tegra_dc_rgb_remove(dc);
 
 	pm_runtime_disable(&pdev->dev);
 
diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h
index f902794d42cc..0559fa6b1bf7 100644
--- a/drivers/gpu/drm/tegra/dc.h
+++ b/drivers/gpu/drm/tegra/dc.h
@@ -169,7 +169,7 @@ void tegra_crtc_atomic_post_commit(struct drm_crtc *crtc,
 
 /* from rgb.c */
 int tegra_dc_rgb_probe(struct tegra_dc *dc);
-int tegra_dc_rgb_remove(struct tegra_dc *dc);
+void tegra_dc_rgb_remove(struct tegra_dc *dc);
 int tegra_dc_rgb_init(struct drm_device *drm, struct tegra_dc *dc);
 int tegra_dc_rgb_exit(struct tegra_dc *dc);
 
diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c
index ff8fce36d2aa..da2d9baca214 100644
--- a/drivers/gpu/drm/tegra/rgb.c
+++ b/drivers/gpu/drm/tegra/rgb.c
@@ -250,12 +250,12 @@ int tegra_dc_rgb_probe(struct tegra_dc *dc)
 	return 0;
 }
 
-int tegra_dc_rgb_remove(struct tegra_dc *dc)
+void tegra_dc_rgb_remove(struct tegra_dc *dc)
 {
 	struct tegra_rgb *rgb;
 
 	if (!dc->rgb)
-		return 0;
+		return;
 
 	rgb = to_rgb(dc->rgb);
 	clk_put(rgb->pll_d2_out0);
@@ -263,8 +263,6 @@ int tegra_dc_rgb_remove(struct tegra_dc *dc)
 
 	tegra_output_remove(dc->rgb);
 	dc->rgb = NULL;
-
-	return 0;
 }
 
 int tegra_dc_rgb_init(struct drm_device *drm, struct tegra_dc *dc)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 03/12] drm/tegra: dc: Convert to platform remove callback returning void
  2023-03-22 17:02 [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void Uwe Kleine-König
  2023-03-22 17:02 ` [PATCH 01/12] gpu: host1x: Make host1x_client_unregister() return void Uwe Kleine-König
  2023-03-22 17:02 ` [PATCH 02/12] drm/tegra: rgb: Make tegra_dc_rgb_remove() " Uwe Kleine-König
@ 2023-03-22 17:02 ` Uwe Kleine-König
  2023-03-22 17:02 ` [PATCH 04/12] drm/tegra: dpaux: " Uwe Kleine-König
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-03-22 17:02 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter
  Cc: dri-devel, linux-tegra, kernel

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 this driver 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>
---
 drivers/gpu/drm/tegra/dc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 6bf1b2bc43b1..53630b673029 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -3263,7 +3263,7 @@ static int tegra_dc_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int tegra_dc_remove(struct platform_device *pdev)
+static void tegra_dc_remove(struct platform_device *pdev)
 {
 	struct tegra_dc *dc = platform_get_drvdata(pdev);
 
@@ -3272,8 +3272,6 @@ static int tegra_dc_remove(struct platform_device *pdev)
 	tegra_dc_rgb_remove(dc);
 
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 struct platform_driver tegra_dc_driver = {
@@ -3282,5 +3280,5 @@ struct platform_driver tegra_dc_driver = {
 		.of_match_table = tegra_dc_of_match,
 	},
 	.probe = tegra_dc_probe,
-	.remove = tegra_dc_remove,
+	.remove_new = tegra_dc_remove,
 };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 04/12] drm/tegra: dpaux: Convert to platform remove callback returning void
  2023-03-22 17:02 [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2023-03-22 17:02 ` [PATCH 03/12] drm/tegra: dc: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-03-22 17:02 ` Uwe Kleine-König
  2023-03-22 17:02 ` [PATCH 05/12] drm/tegra: dsi: " Uwe Kleine-König
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-03-22 17:02 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter
  Cc: dri-devel, linux-tegra, kernel

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 this driver 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>
---
 drivers/gpu/drm/tegra/dpaux.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c
index 3c84e73d5051..4d2677dcd831 100644
--- a/drivers/gpu/drm/tegra/dpaux.c
+++ b/drivers/gpu/drm/tegra/dpaux.c
@@ -579,7 +579,7 @@ static int tegra_dpaux_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int tegra_dpaux_remove(struct platform_device *pdev)
+static void tegra_dpaux_remove(struct platform_device *pdev)
 {
 	struct tegra_dpaux *dpaux = platform_get_drvdata(pdev);
 
@@ -594,8 +594,6 @@ static int tegra_dpaux_remove(struct platform_device *pdev)
 	mutex_lock(&dpaux_lock);
 	list_del(&dpaux->list);
 	mutex_unlock(&dpaux_lock);
-
-	return 0;
 }
 
 static int tegra_dpaux_suspend(struct device *dev)
@@ -695,7 +693,7 @@ struct platform_driver tegra_dpaux_driver = {
 		.pm = pm_ptr(&tegra_dpaux_pm_ops),
 	},
 	.probe = tegra_dpaux_probe,
-	.remove = tegra_dpaux_remove,
+	.remove_new = tegra_dpaux_remove,
 };
 
 struct drm_dp_aux *drm_dp_aux_find_by_of_node(struct device_node *np)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 05/12] drm/tegra: dsi: Convert to platform remove callback returning void
  2023-03-22 17:02 [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (3 preceding siblings ...)
  2023-03-22 17:02 ` [PATCH 04/12] drm/tegra: dpaux: " Uwe Kleine-König
@ 2023-03-22 17:02 ` Uwe Kleine-König
  2023-03-22 17:02 ` [PATCH 06/12] drm/tegra: gr2d: " Uwe Kleine-König
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-03-22 17:02 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter
  Cc: dri-devel, linux-tegra, kernel

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 this driver 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>
---
 drivers/gpu/drm/tegra/dsi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index c8a02a1024bc..7781e69e1ff7 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -1659,7 +1659,7 @@ static int tegra_dsi_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int tegra_dsi_remove(struct platform_device *pdev)
+static void tegra_dsi_remove(struct platform_device *pdev)
 {
 	struct tegra_dsi *dsi = platform_get_drvdata(pdev);
 
@@ -1671,8 +1671,6 @@ static int tegra_dsi_remove(struct platform_device *pdev)
 
 	mipi_dsi_host_unregister(&dsi->host);
 	tegra_mipi_free(dsi->mipi);
-
-	return 0;
 }
 
 static const struct of_device_id tegra_dsi_of_match[] = {
@@ -1690,5 +1688,5 @@ struct platform_driver tegra_dsi_driver = {
 		.of_match_table = tegra_dsi_of_match,
 	},
 	.probe = tegra_dsi_probe,
-	.remove = tegra_dsi_remove,
+	.remove_new = tegra_dsi_remove,
 };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 06/12] drm/tegra: gr2d: Convert to platform remove callback returning void
  2023-03-22 17:02 [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (4 preceding siblings ...)
  2023-03-22 17:02 ` [PATCH 05/12] drm/tegra: dsi: " Uwe Kleine-König
@ 2023-03-22 17:02 ` Uwe Kleine-König
  2023-03-22 17:02 ` [PATCH 07/12] drm/tegra: gr3d: " Uwe Kleine-König
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-03-22 17:02 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter
  Cc: dri-devel, linux-tegra, kernel

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 this driver 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>
---
 drivers/gpu/drm/tegra/gr2d.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c
index 49b8d4953e7f..50f77fddda54 100644
--- a/drivers/gpu/drm/tegra/gr2d.c
+++ b/drivers/gpu/drm/tegra/gr2d.c
@@ -295,13 +295,11 @@ static int gr2d_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int gr2d_remove(struct platform_device *pdev)
+static void gr2d_remove(struct platform_device *pdev)
 {
 	struct gr2d *gr2d = platform_get_drvdata(pdev);
 
 	host1x_client_unregister(&gr2d->client.base);
-
-	return 0;
 }
 
 static int __maybe_unused gr2d_runtime_suspend(struct device *dev)
@@ -397,5 +395,5 @@ struct platform_driver tegra_gr2d_driver = {
 		.pm = &tegra_gr2d_pm,
 	},
 	.probe = gr2d_probe,
-	.remove = gr2d_remove,
+	.remove_new = gr2d_remove,
 };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 07/12] drm/tegra: gr3d: Convert to platform remove callback returning void
  2023-03-22 17:02 [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (5 preceding siblings ...)
  2023-03-22 17:02 ` [PATCH 06/12] drm/tegra: gr2d: " Uwe Kleine-König
@ 2023-03-22 17:02 ` Uwe Kleine-König
  2023-03-22 17:02 ` [PATCH 08/12] drm/tegra: hdmi: " Uwe Kleine-König
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-03-22 17:02 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter
  Cc: dri-devel, linux-tegra, kernel

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 this driver 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>
---
 drivers/gpu/drm/tegra/gr3d.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c
index cd3679d8eef9..c026c2c916c1 100644
--- a/drivers/gpu/drm/tegra/gr3d.c
+++ b/drivers/gpu/drm/tegra/gr3d.c
@@ -550,13 +550,11 @@ static int gr3d_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int gr3d_remove(struct platform_device *pdev)
+static void gr3d_remove(struct platform_device *pdev)
 {
 	struct gr3d *gr3d = platform_get_drvdata(pdev);
 
 	host1x_client_unregister(&gr3d->client.base);
-
-	return 0;
 }
 
 static int __maybe_unused gr3d_runtime_suspend(struct device *dev)
@@ -632,5 +630,5 @@ struct platform_driver tegra_gr3d_driver = {
 		.pm = &tegra_gr3d_pm,
 	},
 	.probe = gr3d_probe,
-	.remove = gr3d_remove,
+	.remove_new = gr3d_remove,
 };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 08/12] drm/tegra: hdmi: Convert to platform remove callback returning void
  2023-03-22 17:02 [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (6 preceding siblings ...)
  2023-03-22 17:02 ` [PATCH 07/12] drm/tegra: gr3d: " Uwe Kleine-König
@ 2023-03-22 17:02 ` Uwe Kleine-König
  2023-03-22 17:02 ` [PATCH 09/12] drm/tegra: hub: " Uwe Kleine-König
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-03-22 17:02 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter
  Cc: dri-devel, linux-tegra, kernel

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 this driver 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>
---
 drivers/gpu/drm/tegra/hdmi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index 6798eea317df..6eac54ae1205 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -1874,15 +1874,13 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int tegra_hdmi_remove(struct platform_device *pdev)
+static void tegra_hdmi_remove(struct platform_device *pdev)
 {
 	struct tegra_hdmi *hdmi = platform_get_drvdata(pdev);
 
 	host1x_client_unregister(&hdmi->client);
 
 	tegra_output_remove(&hdmi->output);
-
-	return 0;
 }
 
 struct platform_driver tegra_hdmi_driver = {
@@ -1891,5 +1889,5 @@ struct platform_driver tegra_hdmi_driver = {
 		.of_match_table = tegra_hdmi_of_match,
 	},
 	.probe = tegra_hdmi_probe,
-	.remove = tegra_hdmi_remove,
+	.remove_new = tegra_hdmi_remove,
 };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 09/12] drm/tegra: hub: Convert to platform remove callback returning void
  2023-03-22 17:02 [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (7 preceding siblings ...)
  2023-03-22 17:02 ` [PATCH 08/12] drm/tegra: hdmi: " Uwe Kleine-König
@ 2023-03-22 17:02 ` Uwe Kleine-König
  2023-03-22 17:02 ` [PATCH 10/12] drm/tegra: nvdec: " Uwe Kleine-König
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-03-22 17:02 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter
  Cc: dri-devel, linux-tegra, kernel

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 this driver 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>
---
 drivers/gpu/drm/tegra/hub.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c
index 2c91dc444085..916857361a91 100644
--- a/drivers/gpu/drm/tegra/hub.c
+++ b/drivers/gpu/drm/tegra/hub.c
@@ -1174,7 +1174,7 @@ static int tegra_display_hub_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int tegra_display_hub_remove(struct platform_device *pdev)
+static void tegra_display_hub_remove(struct platform_device *pdev)
 {
 	struct tegra_display_hub *hub = platform_get_drvdata(pdev);
 	unsigned int i;
@@ -1188,8 +1188,6 @@ static int tegra_display_hub_remove(struct platform_device *pdev)
 	}
 
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 static const struct tegra_display_hub_soc tegra186_display_hub = {
@@ -1221,5 +1219,5 @@ struct platform_driver tegra_display_hub_driver = {
 		.of_match_table = tegra_display_hub_of_match,
 	},
 	.probe = tegra_display_hub_probe,
-	.remove = tegra_display_hub_remove,
+	.remove_new = tegra_display_hub_remove,
 };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 10/12] drm/tegra: nvdec: Convert to platform remove callback returning void
  2023-03-22 17:02 [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (8 preceding siblings ...)
  2023-03-22 17:02 ` [PATCH 09/12] drm/tegra: hub: " Uwe Kleine-König
@ 2023-03-22 17:02 ` Uwe Kleine-König
  2023-03-22 17:02 ` [PATCH 11/12] drm/tegra: sor: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-03-22 17:02 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter
  Cc: dri-devel, linux-tegra, kernel

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 this driver 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>
---
 drivers/gpu/drm/tegra/nvdec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/nvdec.c b/drivers/gpu/drm/tegra/nvdec.c
index 077f3af0d0b6..ae78a81e5eef 100644
--- a/drivers/gpu/drm/tegra/nvdec.c
+++ b/drivers/gpu/drm/tegra/nvdec.c
@@ -547,15 +547,13 @@ static int nvdec_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int nvdec_remove(struct platform_device *pdev)
+static void nvdec_remove(struct platform_device *pdev)
 {
 	struct nvdec *nvdec = platform_get_drvdata(pdev);
 
 	host1x_client_unregister(&nvdec->client.base);
 
 	falcon_exit(&nvdec->falcon);
-
-	return 0;
 }
 
 static const struct dev_pm_ops nvdec_pm_ops = {
@@ -571,7 +569,7 @@ struct platform_driver tegra_nvdec_driver = {
 		.pm = &nvdec_pm_ops
 	},
 	.probe = nvdec_probe,
-	.remove = nvdec_remove,
+	.remove_new = nvdec_remove,
 };
 
 #if IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 11/12] drm/tegra: sor: Convert to platform remove callback returning void
  2023-03-22 17:02 [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (9 preceding siblings ...)
  2023-03-22 17:02 ` [PATCH 10/12] drm/tegra: nvdec: " Uwe Kleine-König
@ 2023-03-22 17:02 ` Uwe Kleine-König
  2023-03-22 17:02 ` [PATCH 12/12] drm/tegra: vic: " Uwe Kleine-König
  2023-04-04 12:14 ` [PATCH 00/12] drm/tegra: " Thierry Reding
  12 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-03-22 17:02 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter
  Cc: dri-devel, linux-tegra, kernel

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 this driver 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>
---
 drivers/gpu/drm/tegra/sor.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index d067b2d01b2e..e617d55f6f3c 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -3978,7 +3978,7 @@ static int tegra_sor_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int tegra_sor_remove(struct platform_device *pdev)
+static void tegra_sor_remove(struct platform_device *pdev)
 {
 	struct tegra_sor *sor = platform_get_drvdata(pdev);
 
@@ -3992,8 +3992,6 @@ static int tegra_sor_remove(struct platform_device *pdev)
 	}
 
 	tegra_output_remove(&sor->output);
-
-	return 0;
 }
 
 static int __maybe_unused tegra_sor_suspend(struct device *dev)
@@ -4053,5 +4051,5 @@ struct platform_driver tegra_sor_driver = {
 		.pm = &tegra_sor_pm_ops,
 	},
 	.probe = tegra_sor_probe,
-	.remove = tegra_sor_remove,
+	.remove_new = tegra_sor_remove,
 };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 12/12] drm/tegra: vic: Convert to platform remove callback returning void
  2023-03-22 17:02 [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (10 preceding siblings ...)
  2023-03-22 17:02 ` [PATCH 11/12] drm/tegra: sor: " Uwe Kleine-König
@ 2023-03-22 17:02 ` Uwe Kleine-König
  2023-04-04 12:14 ` [PATCH 00/12] drm/tegra: " Thierry Reding
  12 siblings, 0 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-03-22 17:02 UTC (permalink / raw)
  To: Thierry Reding, David Airlie, Daniel Vetter, Jonathan Hunter
  Cc: dri-devel, linux-tegra, kernel

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 this driver 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>
---
 drivers/gpu/drm/tegra/vic.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c
index fd614756ecf8..da7a038dca20 100644
--- a/drivers/gpu/drm/tegra/vic.c
+++ b/drivers/gpu/drm/tegra/vic.c
@@ -537,15 +537,13 @@ static int vic_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int vic_remove(struct platform_device *pdev)
+static void vic_remove(struct platform_device *pdev)
 {
 	struct vic *vic = platform_get_drvdata(pdev);
 
 	host1x_client_unregister(&vic->client.base);
 
 	falcon_exit(&vic->falcon);
-
-	return 0;
 }
 
 static const struct dev_pm_ops vic_pm_ops = {
@@ -560,7 +558,7 @@ struct platform_driver tegra_vic_driver = {
 		.pm = &vic_pm_ops
 	},
 	.probe = vic_probe,
-	.remove = vic_remove,
+	.remove_new = vic_remove,
 };
 
 #if IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 01/12] gpu: host1x: Make host1x_client_unregister() return void
  2023-03-22 17:02 ` [PATCH 01/12] gpu: host1x: Make host1x_client_unregister() return void Uwe Kleine-König
@ 2023-03-27  7:17   ` Hans Verkuil
  0 siblings, 0 replies; 15+ messages in thread
From: Hans Verkuil @ 2023-03-27  7:17 UTC (permalink / raw)
  To: Uwe Kleine-König, Thierry Reding, David Airlie,
	Daniel Vetter, Jonathan Hunter, Sowjanya Komatineni,
	Mauro Carvalho Chehab, Greg Kroah-Hartman
  Cc: dri-devel, linux-tegra, kernel, linux-media, linux-staging

On 22/03/2023 18:02, Uwe Kleine-König wrote:
> This function returned zero unconditionally. Make it return no value and
> simplify all callers accordingly.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/gpu/drm/tegra/dc.c              | 7 +------
>  drivers/gpu/drm/tegra/dsi.c             | 8 +-------
>  drivers/gpu/drm/tegra/gr2d.c            | 8 +-------
>  drivers/gpu/drm/tegra/gr3d.c            | 8 +-------
>  drivers/gpu/drm/tegra/hdmi.c            | 8 +-------
>  drivers/gpu/drm/tegra/hub.c             | 9 ++-------
>  drivers/gpu/drm/tegra/nvdec.c           | 8 +-------
>  drivers/gpu/drm/tegra/sor.c             | 8 +-------
>  drivers/gpu/drm/tegra/vic.c             | 8 +-------
>  drivers/gpu/host1x/bus.c                | 6 ++----
>  drivers/staging/media/tegra-video/csi.c | 8 +-------
>  drivers/staging/media/tegra-video/vi.c  | 8 +-------
>  include/linux/host1x.h                  | 2 +-
>  13 files changed, 15 insertions(+), 81 deletions(-)

Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Regards,

	Hans

> 
> diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
> index a67453cee883..bd108159fc2c 100644
> --- a/drivers/gpu/drm/tegra/dc.c
> +++ b/drivers/gpu/drm/tegra/dc.c
> @@ -3268,12 +3268,7 @@ static int tegra_dc_remove(struct platform_device *pdev)
>  	struct tegra_dc *dc = platform_get_drvdata(pdev);
>  	int err;
>  
> -	err = host1x_client_unregister(&dc->client);
> -	if (err < 0) {
> -		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
> -			err);
> -		return err;
> -	}
> +	host1x_client_unregister(&dc->client);
>  
>  	err = tegra_dc_rgb_remove(dc);
>  	if (err < 0) {
> diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
> index de1333dc0d86..c8a02a1024bc 100644
> --- a/drivers/gpu/drm/tegra/dsi.c
> +++ b/drivers/gpu/drm/tegra/dsi.c
> @@ -1662,16 +1662,10 @@ static int tegra_dsi_probe(struct platform_device *pdev)
>  static int tegra_dsi_remove(struct platform_device *pdev)
>  {
>  	struct tegra_dsi *dsi = platform_get_drvdata(pdev);
> -	int err;
>  
>  	pm_runtime_disable(&pdev->dev);
>  
> -	err = host1x_client_unregister(&dsi->client);
> -	if (err < 0) {
> -		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
> -			err);
> -		return err;
> -	}
> +	host1x_client_unregister(&dsi->client);
>  
>  	tegra_output_remove(&dsi->output);
>  
> diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c
> index e3bb4c99ed39..49b8d4953e7f 100644
> --- a/drivers/gpu/drm/tegra/gr2d.c
> +++ b/drivers/gpu/drm/tegra/gr2d.c
> @@ -298,14 +298,8 @@ static int gr2d_probe(struct platform_device *pdev)
>  static int gr2d_remove(struct platform_device *pdev)
>  {
>  	struct gr2d *gr2d = platform_get_drvdata(pdev);
> -	int err;
>  
> -	err = host1x_client_unregister(&gr2d->client.base);
> -	if (err < 0) {
> -		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
> -			err);
> -		return err;
> -	}
> +	host1x_client_unregister(&gr2d->client.base);
>  
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c
> index a1fd3113ea96..cd3679d8eef9 100644
> --- a/drivers/gpu/drm/tegra/gr3d.c
> +++ b/drivers/gpu/drm/tegra/gr3d.c
> @@ -553,14 +553,8 @@ static int gr3d_probe(struct platform_device *pdev)
>  static int gr3d_remove(struct platform_device *pdev)
>  {
>  	struct gr3d *gr3d = platform_get_drvdata(pdev);
> -	int err;
>  
> -	err = host1x_client_unregister(&gr3d->client.base);
> -	if (err < 0) {
> -		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
> -			err);
> -		return err;
> -	}
> +	host1x_client_unregister(&gr3d->client.base);
>  
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
> index 40ec3e6cf204..6798eea317df 100644
> --- a/drivers/gpu/drm/tegra/hdmi.c
> +++ b/drivers/gpu/drm/tegra/hdmi.c
> @@ -1877,14 +1877,8 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
>  static int tegra_hdmi_remove(struct platform_device *pdev)
>  {
>  	struct tegra_hdmi *hdmi = platform_get_drvdata(pdev);
> -	int err;
>  
> -	err = host1x_client_unregister(&hdmi->client);
> -	if (err < 0) {
> -		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
> -			err);
> -		return err;
> -	}
> +	host1x_client_unregister(&hdmi->client);
>  
>  	tegra_output_remove(&hdmi->output);
>  
> diff --git a/drivers/gpu/drm/tegra/hub.c b/drivers/gpu/drm/tegra/hub.c
> index b872527a123c..2c91dc444085 100644
> --- a/drivers/gpu/drm/tegra/hub.c
> +++ b/drivers/gpu/drm/tegra/hub.c
> @@ -1178,13 +1178,8 @@ static int tegra_display_hub_remove(struct platform_device *pdev)
>  {
>  	struct tegra_display_hub *hub = platform_get_drvdata(pdev);
>  	unsigned int i;
> -	int err;
>  
> -	err = host1x_client_unregister(&hub->client);
> -	if (err < 0) {
> -		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
> -			err);
> -	}
> +	host1x_client_unregister(&hub->client);
>  
>  	for (i = 0; i < hub->soc->num_wgrps; i++) {
>  		struct tegra_windowgroup *wgrp = &hub->wgrps[i];
> @@ -1194,7 +1189,7 @@ static int tegra_display_hub_remove(struct platform_device *pdev)
>  
>  	pm_runtime_disable(&pdev->dev);
>  
> -	return err;
> +	return 0;
>  }
>  
>  static const struct tegra_display_hub_soc tegra186_display_hub = {
> diff --git a/drivers/gpu/drm/tegra/nvdec.c b/drivers/gpu/drm/tegra/nvdec.c
> index 86c5818ac27b..077f3af0d0b6 100644
> --- a/drivers/gpu/drm/tegra/nvdec.c
> +++ b/drivers/gpu/drm/tegra/nvdec.c
> @@ -550,14 +550,8 @@ static int nvdec_probe(struct platform_device *pdev)
>  static int nvdec_remove(struct platform_device *pdev)
>  {
>  	struct nvdec *nvdec = platform_get_drvdata(pdev);
> -	int err;
>  
> -	err = host1x_client_unregister(&nvdec->client.base);
> -	if (err < 0) {
> -		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
> -			err);
> -		return err;
> -	}
> +	host1x_client_unregister(&nvdec->client.base);
>  
>  	falcon_exit(&nvdec->falcon);
>  
> diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
> index 8af632740673..d067b2d01b2e 100644
> --- a/drivers/gpu/drm/tegra/sor.c
> +++ b/drivers/gpu/drm/tegra/sor.c
> @@ -3981,14 +3981,8 @@ static int tegra_sor_probe(struct platform_device *pdev)
>  static int tegra_sor_remove(struct platform_device *pdev)
>  {
>  	struct tegra_sor *sor = platform_get_drvdata(pdev);
> -	int err;
>  
> -	err = host1x_client_unregister(&sor->client);
> -	if (err < 0) {
> -		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
> -			err);
> -		return err;
> -	}
> +	host1x_client_unregister(&sor->client);
>  
>  	pm_runtime_disable(&pdev->dev);
>  
> diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c
> index 531a71c72061..fd614756ecf8 100644
> --- a/drivers/gpu/drm/tegra/vic.c
> +++ b/drivers/gpu/drm/tegra/vic.c
> @@ -540,14 +540,8 @@ static int vic_probe(struct platform_device *pdev)
>  static int vic_remove(struct platform_device *pdev)
>  {
>  	struct vic *vic = platform_get_drvdata(pdev);
> -	int err;
>  
> -	err = host1x_client_unregister(&vic->client.base);
> -	if (err < 0) {
> -		dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
> -			err);
> -		return err;
> -	}
> +	host1x_client_unregister(&vic->client.base);
>  
>  	falcon_exit(&vic->falcon);
>  
> diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
> index bc7271a00a94..4d16a3396c4a 100644
> --- a/drivers/gpu/host1x/bus.c
> +++ b/drivers/gpu/host1x/bus.c
> @@ -803,7 +803,7 @@ EXPORT_SYMBOL(__host1x_client_register);
>   * Removes a host1x client from its host1x controller instance. If a logical
>   * device has already been initialized, it will be torn down.
>   */
> -int host1x_client_unregister(struct host1x_client *client)
> +void host1x_client_unregister(struct host1x_client *client)
>  {
>  	struct host1x_client *c;
>  	struct host1x *host1x;
> @@ -815,7 +815,7 @@ int host1x_client_unregister(struct host1x_client *client)
>  		err = host1x_del_client(host1x, client);
>  		if (!err) {
>  			mutex_unlock(&devices_lock);
> -			return 0;
> +			return;
>  		}
>  	}
>  
> @@ -832,8 +832,6 @@ int host1x_client_unregister(struct host1x_client *client)
>  	mutex_unlock(&clients_lock);
>  
>  	host1x_bo_cache_destroy(&client->cache);
> -
> -	return 0;
>  }
>  EXPORT_SYMBOL(host1x_client_unregister);
>  
> diff --git a/drivers/staging/media/tegra-video/csi.c b/drivers/staging/media/tegra-video/csi.c
> index 426e653bd55d..36ca639622c9 100644
> --- a/drivers/staging/media/tegra-video/csi.c
> +++ b/drivers/staging/media/tegra-video/csi.c
> @@ -778,14 +778,8 @@ static int tegra_csi_probe(struct platform_device *pdev)
>  static int tegra_csi_remove(struct platform_device *pdev)
>  {
>  	struct tegra_csi *csi = platform_get_drvdata(pdev);
> -	int err;
>  
> -	err = host1x_client_unregister(&csi->client);
> -	if (err < 0) {
> -		dev_err(&pdev->dev,
> -			"failed to unregister host1x client: %d\n", err);
> -		return err;
> -	}
> +	host1x_client_unregister(&csi->client);
>  
>  	pm_runtime_disable(&pdev->dev);
>  
> diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c
> index 11dd142c98c5..26f7aedce718 100644
> --- a/drivers/staging/media/tegra-video/vi.c
> +++ b/drivers/staging/media/tegra-video/vi.c
> @@ -2041,14 +2041,8 @@ static int tegra_vi_probe(struct platform_device *pdev)
>  static int tegra_vi_remove(struct platform_device *pdev)
>  {
>  	struct tegra_vi *vi = platform_get_drvdata(pdev);
> -	int err;
>  
> -	err = host1x_client_unregister(&vi->client);
> -	if (err < 0) {
> -		dev_err(&pdev->dev,
> -			"failed to unregister host1x client: %d\n", err);
> -		return err;
> -	}
> +	host1x_client_unregister(&vi->client);
>  
>  	pm_runtime_disable(&pdev->dev);
>  
> diff --git a/include/linux/host1x.h b/include/linux/host1x.h
> index 9a9de4b97a25..9c8119ed13a4 100644
> --- a/include/linux/host1x.h
> +++ b/include/linux/host1x.h
> @@ -443,7 +443,7 @@ int __host1x_client_register(struct host1x_client *client);
>  		__host1x_client_register(client);	\
>  	})
>  
> -int host1x_client_unregister(struct host1x_client *client);
> +void host1x_client_unregister(struct host1x_client *client);
>  
>  int host1x_client_suspend(struct host1x_client *client);
>  int host1x_client_resume(struct host1x_client *client);


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void
  2023-03-22 17:02 [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (11 preceding siblings ...)
  2023-03-22 17:02 ` [PATCH 12/12] drm/tegra: vic: " Uwe Kleine-König
@ 2023-04-04 12:14 ` Thierry Reding
  12 siblings, 0 replies; 15+ messages in thread
From: Thierry Reding @ 2023-04-04 12:14 UTC (permalink / raw)
  To: Daniel Vetter, Thierry Reding, Greg Kroah-Hartman,
	Mauro Carvalho Chehab, Sowjanya Komatineni, Jonathan Hunter,
	Uwe Kleine-König, David Airlie
  Cc: linux-staging, kernel, linux-tegra, dri-devel, linux-media

From: Thierry Reding <treding@nvidia.com>

On Wed, 22 Mar 2023 18:02:11 +0100, Uwe Kleine-König wrote:
> this series adapts the platform drivers below drivers/gpu/drm/tegra to
> use the .remove_new() callback. Compared to the traditional .remove()
> callback .remove_new() returns no value. This is a good thing because
> the driver core doesn't (and cannot) cope for errors during remove. The
> only effect of a non-zero return value in .remove() is that the driver
> core emits a warning. The device is removed anyhow and an early return
> from .remove() usually yields a resource leak.
> 
> [...]

Applied, thanks!

[01/12] gpu: host1x: Make host1x_client_unregister() return void
        commit: 1d83d1a2df0bfb6bd79400746c289e2c4edc5909
[02/12] drm/tegra: rgb: Make tegra_dc_rgb_remove() return void
        commit: bbf9c91c6efaabbd4be0b894d9b753a69a5e02b6
[03/12] drm/tegra: dc: Convert to platform remove callback returning void
        commit: 902a0ab485b6f2b37450635b82b91cd17e8aa608
[04/12] drm/tegra: dpaux: Convert to platform remove callback returning void
        commit: 1255aa402c5c8e07ef6d453474ef1bd25651b420
[05/12] drm/tegra: dsi: Convert to platform remove callback returning void
        commit: 6e470293da9d83569373f83655fdd851bd4dd1d2
[06/12] drm/tegra: gr2d: Convert to platform remove callback returning void
        commit: f7140bd214d5f55dbd2096673290c8bc2bb6121c
[07/12] drm/tegra: gr3d: Convert to platform remove callback returning void
        commit: d2c29d8095c82eae11af29f8857e854f40186f59
[08/12] drm/tegra: hdmi: Convert to platform remove callback returning void
        commit: a3365945203bc6c75f8323ce7df38f1a91600ce7
[09/12] drm/tegra: hub: Convert to platform remove callback returning void
        commit: a407ae48ac9f72f719c6598fe61d03e6b8687349
[10/12] drm/tegra: nvdec: Convert to platform remove callback returning void
        commit: 222ace4a40bf5b2beafe7e4a226fab673360d689
[11/12] drm/tegra: sor: Convert to platform remove callback returning void
        commit: b674031a7bbda964741e0fa961cca8ca6b5faae2
[12/12] drm/tegra: vic: Convert to platform remove callback returning void
        commit: ba0fe014a9ebd5e578d52b2f6521591d409b8f61

Best regards,
-- 
Thierry Reding <treding@nvidia.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-04-04 12:20 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 17:02 [PATCH 00/12] drm/tegra: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-22 17:02 ` [PATCH 01/12] gpu: host1x: Make host1x_client_unregister() return void Uwe Kleine-König
2023-03-27  7:17   ` Hans Verkuil
2023-03-22 17:02 ` [PATCH 02/12] drm/tegra: rgb: Make tegra_dc_rgb_remove() " Uwe Kleine-König
2023-03-22 17:02 ` [PATCH 03/12] drm/tegra: dc: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-22 17:02 ` [PATCH 04/12] drm/tegra: dpaux: " Uwe Kleine-König
2023-03-22 17:02 ` [PATCH 05/12] drm/tegra: dsi: " Uwe Kleine-König
2023-03-22 17:02 ` [PATCH 06/12] drm/tegra: gr2d: " Uwe Kleine-König
2023-03-22 17:02 ` [PATCH 07/12] drm/tegra: gr3d: " Uwe Kleine-König
2023-03-22 17:02 ` [PATCH 08/12] drm/tegra: hdmi: " Uwe Kleine-König
2023-03-22 17:02 ` [PATCH 09/12] drm/tegra: hub: " Uwe Kleine-König
2023-03-22 17:02 ` [PATCH 10/12] drm/tegra: nvdec: " Uwe Kleine-König
2023-03-22 17:02 ` [PATCH 11/12] drm/tegra: sor: " Uwe Kleine-König
2023-03-22 17:02 ` [PATCH 12/12] drm/tegra: vic: " Uwe Kleine-König
2023-04-04 12:14 ` [PATCH 00/12] drm/tegra: " Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).