Message ID | 20230508205306.1474415-1-u.kleine-koenig@pengutronix.de |
---|---|
Headers | show |
Series | i2c: Convert to platform remove callback returning void | expand |
On 09/05/23 02:22, Uwe Kleine-König wrote: > 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/i2c/busses/i2c-omap.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c > index 4199f57a6bf2..58fd6fa3edf1 100644 > --- a/drivers/i2c/busses/i2c-omap.c > +++ b/drivers/i2c/busses/i2c-omap.c > @@ -1519,7 +1519,7 @@ omap_i2c_probe(struct platform_device *pdev) > return r; > } > > -static int omap_i2c_remove(struct platform_device *pdev) > +static void omap_i2c_remove(struct platform_device *pdev) > { > struct omap_i2c_dev *omap = platform_get_drvdata(pdev); > int ret; > @@ -1535,8 +1535,6 @@ static int omap_i2c_remove(struct platform_device *pdev) > pm_runtime_dont_use_autosuspend(&pdev->dev); > pm_runtime_put_sync(&pdev->dev); > pm_runtime_disable(&pdev->dev); > - > - return 0; > } > > static int __maybe_unused omap_i2c_runtime_suspend(struct device *dev) > @@ -1588,7 +1586,7 @@ static const struct dev_pm_ops omap_i2c_pm_ops = { > > static struct platform_driver omap_i2c_driver = { > .probe = omap_i2c_probe, > - .remove = omap_i2c_remove, > + .remove_new = omap_i2c_remove, > .driver = { > .name = "omap_i2c", > .pm = &omap_i2c_pm_ops, Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>
[Dropped Phil Edworthy from recipents as his email address has problems] Hello, On Mon, May 08, 2023 at 10:51:37PM +0200, Uwe Kleine-König wrote: > this series convers the drivers below drivers/i2c to the .remove_new() > callback of struct platform_driver(). The motivation is to make the > remove callback less prone for errors and wrong assumptions. See commit > 5c5a7680e67b ("platform: Provide a remove callback that returns no > value") for a more detailed rationale. > > All but one driver already returned zero unconditionally in their > .remove() callback, so converting them to .remove_new() is trivial. > i2c-davinci has two patches in this series, first the error path is > improved to not return an error code, then it's converted as the others > drivers are. > > The two davinci patches are also the only interdependency in this > series. I was unsure if I should split the series in two, the busses and > the mux changes; if convenient these can be applied independent of each > other. I wonder how this series will go in. My expectation was that Wolfram picks up the whole series via his tree?! Best regards Uwe
> Subject: Re: [PATCH 00/89] i2c: Convert to platform remove callback > returning void > > [Dropped Phil Edworthy from recipents as his email address has problems] Phil no longer works with Renesas. Adding Fabrizio who is taking care of RZ/V2M I2C driver. Cheers, Biju
On Thu, Jun 01, 2023 at 03:54:50PM +0200, Wolfram Sang wrote: > > > I wonder how this series will go in. My expectation was that Wolfram > > picks up the whole series via his tree?! > > Will do. I am currently super-busy, though. Whole series applied to for-next. I squashed all the commits into one. These are mostly simple changes which we won't revert anyhow, but fix incrementally if we ever find an issue.