* [PATCH 11/52] input: stmpe-keypad - Convert to platform remove callback returning void
[not found] <20230920125829.1478827-1-u.kleine-koenig@pengutronix.de>
@ 2023-09-20 12:57 ` Uwe Kleine-König
2023-09-20 12:58 ` [PATCH 42/52] input: sun4i-ps2 " Uwe Kleine-König
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2023-09-20 12:57 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Coquelin, Alexandre Torgue, linux-input, linux-stm32,
linux-arm-kernel, 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/keyboard/stmpe-keypad.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/input/keyboard/stmpe-keypad.c b/drivers/input/keyboard/stmpe-keypad.c
index 2c6c53290cc0..2013c0afd0c3 100644
--- a/drivers/input/keyboard/stmpe-keypad.c
+++ b/drivers/input/keyboard/stmpe-keypad.c
@@ -404,20 +404,18 @@ static int stmpe_keypad_probe(struct platform_device *pdev)
return 0;
}
-static int stmpe_keypad_remove(struct platform_device *pdev)
+static void stmpe_keypad_remove(struct platform_device *pdev)
{
struct stmpe_keypad *keypad = platform_get_drvdata(pdev);
stmpe_disable(keypad->stmpe, STMPE_BLOCK_KEYPAD);
-
- return 0;
}
static struct platform_driver stmpe_keypad_driver = {
.driver.name = "stmpe-keypad",
.driver.owner = THIS_MODULE,
.probe = stmpe_keypad_probe,
- .remove = stmpe_keypad_remove,
+ .remove_new = stmpe_keypad_remove,
};
module_platform_driver(stmpe_keypad_driver);
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 42/52] input: sun4i-ps2 - Convert to platform remove callback returning void
[not found] <20230920125829.1478827-1-u.kleine-koenig@pengutronix.de>
2023-09-20 12:57 ` [PATCH 11/52] input: stmpe-keypad - Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-09-20 12:58 ` Uwe Kleine-König
2023-09-20 16:07 ` Jernej Škrabec
2023-09-20 12:58 ` [PATCH 43/52] input: xilinx_ps2 " Uwe Kleine-König
` (2 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2023-09-20 12:58 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, linux-input,
linux-arm-kernel, linux-sunxi, 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/serio/sun4i-ps2.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/input/serio/sun4i-ps2.c b/drivers/input/serio/sun4i-ps2.c
index eb262640192e..aec66d9f5176 100644
--- a/drivers/input/serio/sun4i-ps2.c
+++ b/drivers/input/serio/sun4i-ps2.c
@@ -297,7 +297,7 @@ static int sun4i_ps2_probe(struct platform_device *pdev)
return error;
}
-static int sun4i_ps2_remove(struct platform_device *pdev)
+static void sun4i_ps2_remove(struct platform_device *pdev)
{
struct sun4i_ps2data *drvdata = platform_get_drvdata(pdev);
@@ -311,8 +311,6 @@ static int sun4i_ps2_remove(struct platform_device *pdev)
iounmap(drvdata->reg_base);
kfree(drvdata);
-
- return 0;
}
static const struct of_device_id sun4i_ps2_match[] = {
@@ -324,7 +322,7 @@ MODULE_DEVICE_TABLE(of, sun4i_ps2_match);
static struct platform_driver sun4i_ps2_driver = {
.probe = sun4i_ps2_probe,
- .remove = sun4i_ps2_remove,
+ .remove_new = sun4i_ps2_remove,
.driver = {
.name = DRIVER_NAME,
.of_match_table = sun4i_ps2_match,
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 43/52] input: xilinx_ps2 - Convert to platform remove callback returning void
[not found] <20230920125829.1478827-1-u.kleine-koenig@pengutronix.de>
2023-09-20 12:57 ` [PATCH 11/52] input: stmpe-keypad - Convert to platform remove callback returning void Uwe Kleine-König
2023-09-20 12:58 ` [PATCH 42/52] input: sun4i-ps2 " Uwe Kleine-König
@ 2023-09-20 12:58 ` Uwe Kleine-König
2023-09-20 12:58 ` [PATCH 48/52] input: stmpe-ts " Uwe Kleine-König
2023-09-20 12:58 ` [PATCH 49/52] input: sun4i-ts " Uwe Kleine-König
4 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2023-09-20 12:58 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Michal Simek, Rob Herring, linux-input, linux-arm-kernel, 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/serio/xilinx_ps2.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c
index f3d28da70b75..d8f9faf2b529 100644
--- a/drivers/input/serio/xilinx_ps2.c
+++ b/drivers/input/serio/xilinx_ps2.c
@@ -329,7 +329,7 @@ static int xps2_of_probe(struct platform_device *ofdev)
* if the driver module is being unloaded. It frees any resources allocated to
* the device.
*/
-static int xps2_of_remove(struct platform_device *of_dev)
+static void xps2_of_remove(struct platform_device *of_dev)
{
struct xps2data *drvdata = platform_get_drvdata(of_dev);
struct resource r_mem; /* IO mem resources */
@@ -344,8 +344,6 @@ static int xps2_of_remove(struct platform_device *of_dev)
release_mem_region(r_mem.start, resource_size(&r_mem));
kfree(drvdata);
-
- return 0;
}
/* Match table for of_platform binding */
@@ -361,7 +359,7 @@ static struct platform_driver xps2_of_driver = {
.of_match_table = xps2_of_match,
},
.probe = xps2_of_probe,
- .remove = xps2_of_remove,
+ .remove_new = xps2_of_remove,
};
module_platform_driver(xps2_of_driver);
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 48/52] input: stmpe-ts - Convert to platform remove callback returning void
[not found] <20230920125829.1478827-1-u.kleine-koenig@pengutronix.de>
` (2 preceding siblings ...)
2023-09-20 12:58 ` [PATCH 43/52] input: xilinx_ps2 " Uwe Kleine-König
@ 2023-09-20 12:58 ` Uwe Kleine-König
2023-09-20 12:58 ` [PATCH 49/52] input: sun4i-ts " Uwe Kleine-König
4 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2023-09-20 12:58 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Maxime Coquelin, Alexandre Torgue, linux-input, linux-stm32,
linux-arm-kernel, 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/touchscreen/stmpe-ts.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
index 25c45c3a3561..b204fdb2d22c 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -350,13 +350,11 @@ static int stmpe_input_probe(struct platform_device *pdev)
return 0;
}
-static int stmpe_ts_remove(struct platform_device *pdev)
+static void stmpe_ts_remove(struct platform_device *pdev)
{
struct stmpe_touch *ts = platform_get_drvdata(pdev);
stmpe_disable(ts->stmpe, STMPE_BLOCK_TOUCHSCREEN);
-
- return 0;
}
static struct platform_driver stmpe_ts_driver = {
@@ -364,7 +362,7 @@ static struct platform_driver stmpe_ts_driver = {
.name = STMPE_TS_NAME,
},
.probe = stmpe_input_probe,
- .remove = stmpe_ts_remove,
+ .remove_new = stmpe_ts_remove,
};
module_platform_driver(stmpe_ts_driver);
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 49/52] input: sun4i-ts - Convert to platform remove callback returning void
[not found] <20230920125829.1478827-1-u.kleine-koenig@pengutronix.de>
` (3 preceding siblings ...)
2023-09-20 12:58 ` [PATCH 48/52] input: stmpe-ts " Uwe Kleine-König
@ 2023-09-20 12:58 ` Uwe Kleine-König
2023-09-20 16:07 ` Jernej Škrabec
4 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2023-09-20 12:58 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Rafael J. Wysocki,
Krzysztof Kozlowski, Daniel Lezcano, Jonathan Corbet, linux-input,
linux-arm-kernel, linux-sunxi, 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/touchscreen/sun4i-ts.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index bb3c6072fc82..92b2b840b4b7 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -375,7 +375,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)
return 0;
}
-static int sun4i_ts_remove(struct platform_device *pdev)
+static void sun4i_ts_remove(struct platform_device *pdev)
{
struct sun4i_ts_data *ts = platform_get_drvdata(pdev);
@@ -385,8 +385,6 @@ static int sun4i_ts_remove(struct platform_device *pdev)
/* Deactivate all IRQs */
writel(0, ts->base + TP_INT_FIFOC);
-
- return 0;
}
static const struct of_device_id sun4i_ts_of_match[] = {
@@ -403,7 +401,7 @@ static struct platform_driver sun4i_ts_driver = {
.of_match_table = sun4i_ts_of_match,
},
.probe = sun4i_ts_probe,
- .remove = sun4i_ts_remove,
+ .remove_new = sun4i_ts_remove,
};
module_platform_driver(sun4i_ts_driver);
--
2.40.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 49/52] input: sun4i-ts - Convert to platform remove callback returning void
2023-09-20 12:58 ` [PATCH 49/52] input: sun4i-ts " Uwe Kleine-König
@ 2023-09-20 16:07 ` Jernej Škrabec
0 siblings, 0 replies; 7+ messages in thread
From: Jernej Škrabec @ 2023-09-20 16:07 UTC (permalink / raw)
To: Dmitry Torokhov, Uwe Kleine-König
Cc: Chen-Yu Tsai, Samuel Holland, Rafael J. Wysocki,
Krzysztof Kozlowski, Daniel Lezcano, Jonathan Corbet, linux-input,
linux-arm-kernel, linux-sunxi, kernel
Dne sreda, 20. september 2023 ob 14:58:26 CEST je Uwe Kleine-König napisal(a):
> 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>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
> ---
> drivers/input/touchscreen/sun4i-ts.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/input/touchscreen/sun4i-ts.c
> b/drivers/input/touchscreen/sun4i-ts.c index bb3c6072fc82..92b2b840b4b7
> 100644
> --- a/drivers/input/touchscreen/sun4i-ts.c
> +++ b/drivers/input/touchscreen/sun4i-ts.c
> @@ -375,7 +375,7 @@ static int sun4i_ts_probe(struct platform_device *pdev)
> return 0;
> }
>
> -static int sun4i_ts_remove(struct platform_device *pdev)
> +static void sun4i_ts_remove(struct platform_device *pdev)
> {
> struct sun4i_ts_data *ts = platform_get_drvdata(pdev);
>
> @@ -385,8 +385,6 @@ static int sun4i_ts_remove(struct platform_device *pdev)
>
> /* Deactivate all IRQs */
> writel(0, ts->base + TP_INT_FIFOC);
> -
> - return 0;
> }
>
> static const struct of_device_id sun4i_ts_of_match[] = {
> @@ -403,7 +401,7 @@ static struct platform_driver sun4i_ts_driver = {
> .of_match_table = sun4i_ts_of_match,
> },
> .probe = sun4i_ts_probe,
> - .remove = sun4i_ts_remove,
> + .remove_new = sun4i_ts_remove,
> };
>
> module_platform_driver(sun4i_ts_driver);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 42/52] input: sun4i-ps2 - Convert to platform remove callback returning void
2023-09-20 12:58 ` [PATCH 42/52] input: sun4i-ps2 " Uwe Kleine-König
@ 2023-09-20 16:07 ` Jernej Škrabec
0 siblings, 0 replies; 7+ messages in thread
From: Jernej Škrabec @ 2023-09-20 16:07 UTC (permalink / raw)
To: Dmitry Torokhov, Uwe Kleine-König
Cc: Chen-Yu Tsai, Samuel Holland, linux-input, linux-arm-kernel,
linux-sunxi, kernel
Dne sreda, 20. september 2023 ob 14:58:19 CEST je Uwe Kleine-König napisal(a):
> 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>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
> ---
> drivers/input/serio/sun4i-ps2.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/input/serio/sun4i-ps2.c
> b/drivers/input/serio/sun4i-ps2.c index eb262640192e..aec66d9f5176 100644
> --- a/drivers/input/serio/sun4i-ps2.c
> +++ b/drivers/input/serio/sun4i-ps2.c
> @@ -297,7 +297,7 @@ static int sun4i_ps2_probe(struct platform_device *pdev)
> return error;
> }
>
> -static int sun4i_ps2_remove(struct platform_device *pdev)
> +static void sun4i_ps2_remove(struct platform_device *pdev)
> {
> struct sun4i_ps2data *drvdata = platform_get_drvdata(pdev);
>
> @@ -311,8 +311,6 @@ static int sun4i_ps2_remove(struct platform_device
> *pdev) iounmap(drvdata->reg_base);
>
> kfree(drvdata);
> -
> - return 0;
> }
>
> static const struct of_device_id sun4i_ps2_match[] = {
> @@ -324,7 +322,7 @@ MODULE_DEVICE_TABLE(of, sun4i_ps2_match);
>
> static struct platform_driver sun4i_ps2_driver = {
> .probe = sun4i_ps2_probe,
> - .remove = sun4i_ps2_remove,
> + .remove_new = sun4i_ps2_remove,
> .driver = {
> .name = DRIVER_NAME,
> .of_match_table = sun4i_ps2_match,
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-09-20 16:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230920125829.1478827-1-u.kleine-koenig@pengutronix.de>
2023-09-20 12:57 ` [PATCH 11/52] input: stmpe-keypad - Convert to platform remove callback returning void Uwe Kleine-König
2023-09-20 12:58 ` [PATCH 42/52] input: sun4i-ps2 " Uwe Kleine-König
2023-09-20 16:07 ` Jernej Škrabec
2023-09-20 12:58 ` [PATCH 43/52] input: xilinx_ps2 " Uwe Kleine-König
2023-09-20 12:58 ` [PATCH 48/52] input: stmpe-ts " Uwe Kleine-König
2023-09-20 12:58 ` [PATCH 49/52] input: sun4i-ts " Uwe Kleine-König
2023-09-20 16:07 ` Jernej Škrabec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox