* [PATCH 23/52] input: pm8941-pwrkey - Convert to platform remove callback returning void
2023-09-20 12:57 [PATCH 00/52] input: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-09-20 12:58 ` Uwe Kleine-König
2023-09-20 13:03 ` Konrad Dybcio
2023-09-24 2:48 ` [PATCH 00/52] input: " Dmitry Torokhov
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2023-09-20 12:58 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, linux-arm-msm,
linux-input, 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 ignored (apart
from emitting a warning) 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. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
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/input/misc/pm8941-pwrkey.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c
index ba747c5b2b5f..bab710023d8f 100644
--- a/drivers/input/misc/pm8941-pwrkey.c
+++ b/drivers/input/misc/pm8941-pwrkey.c
@@ -408,14 +408,12 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev)
return 0;
}
-static int pm8941_pwrkey_remove(struct platform_device *pdev)
+static void pm8941_pwrkey_remove(struct platform_device *pdev)
{
struct pm8941_pwrkey *pwrkey = platform_get_drvdata(pdev);
if (pwrkey->data->supports_ps_hold_poff_config)
unregister_reboot_notifier(&pwrkey->reboot_notifier);
-
- return 0;
}
static const struct pm8941_data pwrkey_data = {
@@ -467,7 +465,7 @@ MODULE_DEVICE_TABLE(of, pm8941_pwr_key_id_table);
static struct platform_driver pm8941_pwrkey_driver = {
.probe = pm8941_pwrkey_probe,
- .remove = pm8941_pwrkey_remove,
+ .remove_new = pm8941_pwrkey_remove,
.driver = {
.name = "pm8941-pwrkey",
.pm = pm_sleep_ptr(&pm8941_pwr_key_pm_ops),
--
2.40.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 23/52] input: pm8941-pwrkey - Convert to platform remove callback returning void
2023-09-20 12:58 ` [PATCH 23/52] input: pm8941-pwrkey - " Uwe Kleine-König
@ 2023-09-20 13:03 ` Konrad Dybcio
0 siblings, 0 replies; 8+ messages in thread
From: Konrad Dybcio @ 2023-09-20 13:03 UTC (permalink / raw)
To: Uwe Kleine-König, Dmitry Torokhov
Cc: Andy Gross, Bjorn Andersson, linux-arm-msm, linux-input, kernel
On 9/20/23 14:58, 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 ignored (apart
> from emitting a warning) 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. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
>
> 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>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Konrad
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 00/52] input: Convert to platform remove callback returning void
2023-09-20 12:57 [PATCH 00/52] input: Convert to platform remove callback returning void Uwe Kleine-König
2023-09-20 12:58 ` [PATCH 23/52] input: pm8941-pwrkey - " Uwe Kleine-König
@ 2023-09-24 2:48 ` Dmitry Torokhov
2023-09-24 15:50 ` Uwe Kleine-König
2023-11-13 3:23 ` patchwork-bot+chrome-platform
2023-11-13 3:42 ` patchwork-bot+chrome-platform
3 siblings, 1 reply; 8+ messages in thread
From: Dmitry Torokhov @ 2023-09-24 2:48 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Michael Hennerich, linux-input, kernel, Benson Leung,
Guenter Roeck, Greg Kroah-Hartman, Jonathan Cameron,
joewu (吳仲振), chrome-platform,
Andy Shevchenko, Mattijs Korpershoek, Jeff LaBundy, Rob Herring,
Siarhei Volkau, Pavel Machek, Steven Rostedt (Google),
Paolo Abeni, Kalle Valo, Yangtao Li, ye xingchen, Maxime Coquelin,
Alexandre Torgue, linux-stm32, linux-arm-kernel,
Support Opensource, Andrey Moiseev, Lee Jones, Linus Walleij,
Andy Gross, Bjorn Andersson, Konrad Dybcio, linux-arm-msm,
Hans de Goede, Miloslav Trmac, patches, Christophe JAILLET,
Liang He, Chen Jun, Ruan Jinjie, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, linux-sunxi, Michal Simek, Robert Jarzmik,
Dmitry Baryshkov, Arnd Bergmann, Rafael J. Wysocki,
Krzysztof Kozlowski, Daniel Lezcano, Jonathan Corbet
On Wed, Sep 20, 2023 at 02:57:37PM +0200, Uwe Kleine-König wrote:
> Hello,
>
> this series converts all platform drivers below drivers/input to use
> remove_new. The motivation is to get rid of an integer return code
> that is (mostly) ignored by the platform driver core and error prone on
> the driver side.
>
> See commit 5c5a7680e67b ("platform: Provide a remove callback that
> returns no value") for an extended explanation and the eventual goal.
>
> There are no interdependencies between the patches. As there are still
> quite a few drivers to convert, I'm happy about every patch that makes
> it in. So even if there is a merge conflict with one patch until you
> apply or a subject prefix is suboptimal, please apply the remainder of
> this series anyhow.
Applied the lot (fixing the i8042-sparcio patch subject), thank you!
--
Dmitry
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 00/52] input: Convert to platform remove callback returning void
2023-09-24 2:48 ` [PATCH 00/52] input: " Dmitry Torokhov
@ 2023-09-24 15:50 ` Uwe Kleine-König
2023-09-30 15:37 ` Dmitry Torokhov
0 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2023-09-24 15:50 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Lee Jones, Linus Walleij, Alexandre Torgue, Pavel Machek,
Guenter Roeck, Liang He, linux-stm32, Daniel Lezcano,
chrome-platform, Arnd Bergmann, Samuel Holland, Andrey Moiseev,
Michal Simek, Ruan Jinjie, Yangtao Li, Jernej Skrabec,
joewu (吳仲振), Miloslav Trmac, Robert Jarzmik,
Chen-Yu Tsai, Andy Gross, linux-input, Jeff LaBundy, linux-sunxi,
linux-arm-msm, Maxime Coquelin, Michael Hennerich, Rob Herring,
ye xingchen, Kalle Valo, Steven Rostedt (Google), Hans de Goede,
Siarhei Volkau, Christophe JAILLET, Jonathan Cameron,
Andy Shevchenko, Benson Leung, linux-arm-kernel, Paolo Abeni,
Support Opensource, Chen Jun, Greg Kroah-Hartman,
Mattijs Korpershoek, Rafael J. Wysocki, Konrad Dybcio,
Krzysztof Kozlowski, kernel, patches, Dmitry Baryshkov,
Jonathan Corbet, Bjorn Andersson
[-- Attachment #1: Type: text/plain, Size: 1511 bytes --]
Hello Dmitry,
On Sat, Sep 23, 2023 at 07:48:21PM -0700, Dmitry Torokhov wrote:
> On Wed, Sep 20, 2023 at 02:57:37PM +0200, Uwe Kleine-König wrote:
> > Hello,
> >
> > this series converts all platform drivers below drivers/input to use
> > remove_new. The motivation is to get rid of an integer return code
> > that is (mostly) ignored by the platform driver core and error prone on
> > the driver side.
> >
> > See commit 5c5a7680e67b ("platform: Provide a remove callback that
> > returns no value") for an extended explanation and the eventual goal.
> >
> > There are no interdependencies between the patches. As there are still
> > quite a few drivers to convert, I'm happy about every patch that makes
> > it in. So even if there is a merge conflict with one patch until you
> > apply or a subject prefix is suboptimal, please apply the remainder of
> > this series anyhow.
>
> Applied the lot (fixing the i8042-sparcio patch subject), thank you!
Thanks. In the meantime I found out why my process failed here: I only
fixed *.c, but this driver struct is defined in a header file
i8042-sparcio.h.
This file is only included by drivers/input/serio/i8042.h which in turn
is only included by drivers/input/serio/i8042.c. So there is only one
instance created, but I'd call that unusual anyhow.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 00/52] input: Convert to platform remove callback returning void
2023-09-24 15:50 ` Uwe Kleine-König
@ 2023-09-30 15:37 ` Dmitry Torokhov
0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Torokhov @ 2023-09-30 15:37 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Lee Jones, Linus Walleij, Alexandre Torgue, Pavel Machek,
Guenter Roeck, Liang He, linux-stm32, Daniel Lezcano,
chrome-platform, Arnd Bergmann, Samuel Holland, Andrey Moiseev,
Michal Simek, Ruan Jinjie, Yangtao Li, Jernej Skrabec,
joewu (吳仲振), Miloslav Trmac, Robert Jarzmik,
Chen-Yu Tsai, Andy Gross, linux-input, Jeff LaBundy, linux-sunxi,
linux-arm-msm, Maxime Coquelin, Michael Hennerich, Rob Herring,
ye xingchen, Kalle Valo, Steven Rostedt (Google), Hans de Goede,
Siarhei Volkau, Christophe JAILLET, Jonathan Cameron,
Andy Shevchenko, Benson Leung, linux-arm-kernel, Paolo Abeni,
Support Opensource, Chen Jun, Greg Kroah-Hartman,
Mattijs Korpershoek, Rafael J. Wysocki, Konrad Dybcio,
Krzysztof Kozlowski, kernel, patches, Dmitry Baryshkov,
Jonathan Corbet, Bjorn Andersson
Hi Uwe,
Sorry for the spotty responses.
On Sun, Sep 24, 2023 at 05:50:57PM +0200, Uwe Kleine-König wrote:
> Hello Dmitry,
>
> On Sat, Sep 23, 2023 at 07:48:21PM -0700, Dmitry Torokhov wrote:
> > On Wed, Sep 20, 2023 at 02:57:37PM +0200, Uwe Kleine-König wrote:
> > > Hello,
> > >
> > > this series converts all platform drivers below drivers/input to use
> > > remove_new. The motivation is to get rid of an integer return code
> > > that is (mostly) ignored by the platform driver core and error prone on
> > > the driver side.
> > >
> > > See commit 5c5a7680e67b ("platform: Provide a remove callback that
> > > returns no value") for an extended explanation and the eventual goal.
> > >
> > > There are no interdependencies between the patches. As there are still
> > > quite a few drivers to convert, I'm happy about every patch that makes
> > > it in. So even if there is a merge conflict with one patch until you
> > > apply or a subject prefix is suboptimal, please apply the remainder of
> > > this series anyhow.
> >
> > Applied the lot (fixing the i8042-sparcio patch subject), thank you!
>
> Thanks. In the meantime I found out why my process failed here: I only
> fixed *.c, but this driver struct is defined in a header file
> i8042-sparcio.h.
>
> This file is only included by drivers/input/serio/i8042.h which in turn
> is only included by drivers/input/serio/i8042.c. So there is only one
> instance created, but I'd call that unusual anyhow.
Right, i8042 is essentially a singleton, and what you see here is an
attempt to bolt OF onto a legacy driver that is largely predates the
current driver model. I wanted to clean it up, but it is still widely
used and I am hesitant to disturb it too much.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 00/52] input: Convert to platform remove callback returning void
2023-09-20 12:57 [PATCH 00/52] input: Convert to platform remove callback returning void Uwe Kleine-König
2023-09-20 12:58 ` [PATCH 23/52] input: pm8941-pwrkey - " Uwe Kleine-König
2023-09-24 2:48 ` [PATCH 00/52] input: " Dmitry Torokhov
@ 2023-11-13 3:23 ` patchwork-bot+chrome-platform
2023-11-13 3:42 ` patchwork-bot+chrome-platform
3 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-11-13 3:23 UTC (permalink / raw)
To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
Cc: dmitry.torokhov, michael.hennerich, linux-input, kernel, bleung,
groeck, gregkh, Jonathan.Cameron, joewu, chrome-platform,
andriy.shevchenko, mkorpershoek, jeff, robh, lis8215, pavel,
rostedt, pabeni, kvalo, frank.li, ye.xingchen, mcoquelin.stm32,
alexandre.torgue, linux-stm32, linux-arm-kernel,
support.opensource, o2g.org.ru, lee, linus.walleij, agross,
andersson, konrad.dybcio, linux-arm-msm, hdegoede, mitr, patches,
christophe.jaillet, windhl, chenjun102, ruanjinjie, wens,
jernej.skrabec, samuel, linux-sunxi, michal.simek, robert.jarzmik,
dmitry.baryshkov, arnd, rafael.j.wysocki, krzysztof.kozlowski,
daniel.lezcano, corbet
Hello:
This patch was applied to chrome-platform/linux.git (for-kernelci)
by Dmitry Torokhov <dmitry.torokhov@gmail.com>:
On Wed, 20 Sep 2023 14:57:37 +0200 you wrote:
> Hello,
>
> this series converts all platform drivers below drivers/input to use
> remove_new. The motivation is to get rid of an integer return code
> that is (mostly) ignored by the platform driver core and error prone on
> the driver side.
>
> [...]
Here is the summary with links:
- [02/52] input: cros_ec_keyb - Convert to platform remove callback returning void
https://git.kernel.org/chrome-platform/c/63ef64cb6453
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH 00/52] input: Convert to platform remove callback returning void
2023-09-20 12:57 [PATCH 00/52] input: Convert to platform remove callback returning void Uwe Kleine-König
` (2 preceding siblings ...)
2023-11-13 3:23 ` patchwork-bot+chrome-platform
@ 2023-11-13 3:42 ` patchwork-bot+chrome-platform
3 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+chrome-platform @ 2023-11-13 3:42 UTC (permalink / raw)
To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig_=3Cu=2Ekleine-koenig=40pengutronix=2Ede=3E?=
Cc: dmitry.torokhov, michael.hennerich, linux-input, kernel, bleung,
groeck, gregkh, Jonathan.Cameron, joewu, chrome-platform,
andriy.shevchenko, mkorpershoek, jeff, robh, lis8215, pavel,
rostedt, pabeni, kvalo, frank.li, ye.xingchen, mcoquelin.stm32,
alexandre.torgue, linux-stm32, linux-arm-kernel,
support.opensource, o2g.org.ru, lee, linus.walleij, agross,
andersson, konrad.dybcio, linux-arm-msm, hdegoede, mitr, patches,
christophe.jaillet, windhl, chenjun102, ruanjinjie, wens,
jernej.skrabec, samuel, linux-sunxi, michal.simek, robert.jarzmik,
dmitry.baryshkov, arnd, rafael.j.wysocki, krzysztof.kozlowski,
daniel.lezcano, corbet
Hello:
This patch was applied to chrome-platform/linux.git (for-next)
by Dmitry Torokhov <dmitry.torokhov@gmail.com>:
On Wed, 20 Sep 2023 14:57:37 +0200 you wrote:
> Hello,
>
> this series converts all platform drivers below drivers/input to use
> remove_new. The motivation is to get rid of an integer return code
> that is (mostly) ignored by the platform driver core and error prone on
> the driver side.
>
> [...]
Here is the summary with links:
- [02/52] input: cros_ec_keyb - Convert to platform remove callback returning void
https://git.kernel.org/chrome-platform/c/63ef64cb6453
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 8+ messages in thread