* [PATCH 01/30] pwm: atmel-hlcdc: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-06 11:53 ` Claudiu.Beznea
2023-03-03 18:54 ` [PATCH 02/30] pwm: atmel-tcb: " Uwe Kleine-König
` (13 subsequent siblings)
14 siblings, 1 reply; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea
Cc: kernel, linux-pwm, linux-arm-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/pwm/pwm-atmel-hlcdc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c
index a43b2babc809..96a709a9d49a 100644
--- a/drivers/pwm/pwm-atmel-hlcdc.c
+++ b/drivers/pwm/pwm-atmel-hlcdc.c
@@ -278,15 +278,13 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev)
return 0;
}
-static int atmel_hlcdc_pwm_remove(struct platform_device *pdev)
+static void atmel_hlcdc_pwm_remove(struct platform_device *pdev)
{
struct atmel_hlcdc_pwm *chip = platform_get_drvdata(pdev);
pwmchip_remove(&chip->chip);
clk_disable_unprepare(chip->hlcdc->periph_clk);
-
- return 0;
}
static const struct of_device_id atmel_hlcdc_pwm_dt_ids[] = {
@@ -301,7 +299,7 @@ static struct platform_driver atmel_hlcdc_pwm_driver = {
.pm = &atmel_hlcdc_pwm_pm_ops,
},
.probe = atmel_hlcdc_pwm_probe,
- .remove = atmel_hlcdc_pwm_remove,
+ .remove_new = atmel_hlcdc_pwm_remove,
};
module_platform_driver(atmel_hlcdc_pwm_driver);
--
2.39.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] 21+ messages in thread* Re: [PATCH 01/30] pwm: atmel-hlcdc: Convert to platform remove callback returning void
2023-03-03 18:54 ` [PATCH 01/30] pwm: atmel-hlcdc: " Uwe Kleine-König
@ 2023-03-06 11:53 ` Claudiu.Beznea
0 siblings, 0 replies; 21+ messages in thread
From: Claudiu.Beznea @ 2023-03-06 11:53 UTC (permalink / raw)
To: u.kleine-koenig, thierry.reding, Nicolas.Ferre, alexandre.belloni
Cc: kernel, linux-pwm, linux-arm-kernel
On 03.03.2023 20:54, Uwe Kleine-König wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> 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>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> ---
> drivers/pwm/pwm-atmel-hlcdc.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c
> index a43b2babc809..96a709a9d49a 100644
> --- a/drivers/pwm/pwm-atmel-hlcdc.c
> +++ b/drivers/pwm/pwm-atmel-hlcdc.c
> @@ -278,15 +278,13 @@ static int atmel_hlcdc_pwm_probe(struct platform_device *pdev)
> return 0;
> }
>
> -static int atmel_hlcdc_pwm_remove(struct platform_device *pdev)
> +static void atmel_hlcdc_pwm_remove(struct platform_device *pdev)
> {
> struct atmel_hlcdc_pwm *chip = platform_get_drvdata(pdev);
>
> pwmchip_remove(&chip->chip);
>
> clk_disable_unprepare(chip->hlcdc->periph_clk);
> -
> - return 0;
> }
>
> static const struct of_device_id atmel_hlcdc_pwm_dt_ids[] = {
> @@ -301,7 +299,7 @@ static struct platform_driver atmel_hlcdc_pwm_driver = {
> .pm = &atmel_hlcdc_pwm_pm_ops,
> },
> .probe = atmel_hlcdc_pwm_probe,
> - .remove = atmel_hlcdc_pwm_remove,
> + .remove_new = atmel_hlcdc_pwm_remove,
> };
> module_platform_driver(atmel_hlcdc_pwm_driver);
>
> --
> 2.39.1
>
_______________________________________________
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] 21+ messages in thread
* [PATCH 02/30] pwm: atmel-tcb: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 01/30] pwm: atmel-hlcdc: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-06 11:53 ` Claudiu.Beznea
2023-03-03 18:54 ` [PATCH 03/30] pwm: atmel: " Uwe Kleine-König
` (12 subsequent siblings)
14 siblings, 1 reply; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea
Cc: kernel, linux-pwm, linux-arm-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/pwm/pwm-atmel-tcb.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
index 2837b4ce8053..4a116dc44f6e 100644
--- a/drivers/pwm/pwm-atmel-tcb.c
+++ b/drivers/pwm/pwm-atmel-tcb.c
@@ -500,7 +500,7 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
return err;
}
-static int atmel_tcb_pwm_remove(struct platform_device *pdev)
+static void atmel_tcb_pwm_remove(struct platform_device *pdev)
{
struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev);
@@ -509,8 +509,6 @@ static int atmel_tcb_pwm_remove(struct platform_device *pdev)
clk_disable_unprepare(tcbpwm->slow_clk);
clk_put(tcbpwm->slow_clk);
clk_put(tcbpwm->clk);
-
- return 0;
}
static const struct of_device_id atmel_tcb_pwm_dt_ids[] = {
@@ -564,7 +562,7 @@ static struct platform_driver atmel_tcb_pwm_driver = {
.pm = &atmel_tcb_pwm_pm_ops,
},
.probe = atmel_tcb_pwm_probe,
- .remove = atmel_tcb_pwm_remove,
+ .remove_new = atmel_tcb_pwm_remove,
};
module_platform_driver(atmel_tcb_pwm_driver);
--
2.39.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] 21+ messages in thread* Re: [PATCH 02/30] pwm: atmel-tcb: Convert to platform remove callback returning void
2023-03-03 18:54 ` [PATCH 02/30] pwm: atmel-tcb: " Uwe Kleine-König
@ 2023-03-06 11:53 ` Claudiu.Beznea
0 siblings, 0 replies; 21+ messages in thread
From: Claudiu.Beznea @ 2023-03-06 11:53 UTC (permalink / raw)
To: u.kleine-koenig, thierry.reding, Nicolas.Ferre, alexandre.belloni
Cc: kernel, linux-pwm, linux-arm-kernel
On 03.03.2023 20:54, Uwe Kleine-König wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> 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>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> ---
> drivers/pwm/pwm-atmel-tcb.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
> index 2837b4ce8053..4a116dc44f6e 100644
> --- a/drivers/pwm/pwm-atmel-tcb.c
> +++ b/drivers/pwm/pwm-atmel-tcb.c
> @@ -500,7 +500,7 @@ static int atmel_tcb_pwm_probe(struct platform_device *pdev)
> return err;
> }
>
> -static int atmel_tcb_pwm_remove(struct platform_device *pdev)
> +static void atmel_tcb_pwm_remove(struct platform_device *pdev)
> {
> struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev);
>
> @@ -509,8 +509,6 @@ static int atmel_tcb_pwm_remove(struct platform_device *pdev)
> clk_disable_unprepare(tcbpwm->slow_clk);
> clk_put(tcbpwm->slow_clk);
> clk_put(tcbpwm->clk);
> -
> - return 0;
> }
>
> static const struct of_device_id atmel_tcb_pwm_dt_ids[] = {
> @@ -564,7 +562,7 @@ static struct platform_driver atmel_tcb_pwm_driver = {
> .pm = &atmel_tcb_pwm_pm_ops,
> },
> .probe = atmel_tcb_pwm_probe,
> - .remove = atmel_tcb_pwm_remove,
> + .remove_new = atmel_tcb_pwm_remove,
> };
> module_platform_driver(atmel_tcb_pwm_driver);
>
> --
> 2.39.1
>
_______________________________________________
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] 21+ messages in thread
* [PATCH 03/30] pwm: atmel: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 01/30] pwm: atmel-hlcdc: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 02/30] pwm: atmel-tcb: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-06 11:53 ` Claudiu.Beznea
2023-03-03 18:54 ` [PATCH 04/30] pwm: bcm-iproc: " Uwe Kleine-König
` (11 subsequent siblings)
14 siblings, 1 reply; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding, Claudiu Beznea, Nicolas Ferre, Alexandre Belloni
Cc: kernel, linux-arm-kernel, linux-pwm
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/pwm/pwm-atmel.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
index cdbc23649032..0c567d9623cd 100644
--- a/drivers/pwm/pwm-atmel.c
+++ b/drivers/pwm/pwm-atmel.c
@@ -511,15 +511,13 @@ static int atmel_pwm_probe(struct platform_device *pdev)
return ret;
}
-static int atmel_pwm_remove(struct platform_device *pdev)
+static void atmel_pwm_remove(struct platform_device *pdev)
{
struct atmel_pwm_chip *atmel_pwm = platform_get_drvdata(pdev);
pwmchip_remove(&atmel_pwm->chip);
clk_unprepare(atmel_pwm->clk);
-
- return 0;
}
static struct platform_driver atmel_pwm_driver = {
@@ -528,7 +526,7 @@ static struct platform_driver atmel_pwm_driver = {
.of_match_table = of_match_ptr(atmel_pwm_dt_ids),
},
.probe = atmel_pwm_probe,
- .remove = atmel_pwm_remove,
+ .remove_new = atmel_pwm_remove,
};
module_platform_driver(atmel_pwm_driver);
--
2.39.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] 21+ messages in thread* Re: [PATCH 03/30] pwm: atmel: Convert to platform remove callback returning void
2023-03-03 18:54 ` [PATCH 03/30] pwm: atmel: " Uwe Kleine-König
@ 2023-03-06 11:53 ` Claudiu.Beznea
0 siblings, 0 replies; 21+ messages in thread
From: Claudiu.Beznea @ 2023-03-06 11:53 UTC (permalink / raw)
To: u.kleine-koenig, thierry.reding, Nicolas.Ferre, alexandre.belloni
Cc: kernel, linux-arm-kernel, linux-pwm
On 03.03.2023 20:54, Uwe Kleine-König wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> 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>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> ---
> drivers/pwm/pwm-atmel.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
> index cdbc23649032..0c567d9623cd 100644
> --- a/drivers/pwm/pwm-atmel.c
> +++ b/drivers/pwm/pwm-atmel.c
> @@ -511,15 +511,13 @@ static int atmel_pwm_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int atmel_pwm_remove(struct platform_device *pdev)
> +static void atmel_pwm_remove(struct platform_device *pdev)
> {
> struct atmel_pwm_chip *atmel_pwm = platform_get_drvdata(pdev);
>
> pwmchip_remove(&atmel_pwm->chip);
>
> clk_unprepare(atmel_pwm->clk);
> -
> - return 0;
> }
>
> static struct platform_driver atmel_pwm_driver = {
> @@ -528,7 +526,7 @@ static struct platform_driver atmel_pwm_driver = {
> .of_match_table = of_match_ptr(atmel_pwm_dt_ids),
> },
> .probe = atmel_pwm_probe,
> - .remove = atmel_pwm_remove,
> + .remove_new = atmel_pwm_remove,
> };
> module_platform_driver(atmel_pwm_driver);
>
> --
> 2.39.1
>
_______________________________________________
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] 21+ messages in thread
* [PATCH 04/30] pwm: bcm-iproc: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
` (2 preceding siblings ...)
2023-03-03 18:54 ` [PATCH 03/30] pwm: atmel: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 05/30] pwm: bcm2835: " Uwe Kleine-König
` (10 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding, Ray Jui, Scott Branden
Cc: kernel, Broadcom internal kernel review list, linux-pwm,
linux-arm-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/pwm/pwm-bcm-iproc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/pwm-bcm-iproc.c b/drivers/pwm/pwm-bcm-iproc.c
index 97ec131eb7c1..7d70b6f186a6 100644
--- a/drivers/pwm/pwm-bcm-iproc.c
+++ b/drivers/pwm/pwm-bcm-iproc.c
@@ -239,15 +239,13 @@ static int iproc_pwmc_probe(struct platform_device *pdev)
return ret;
}
-static int iproc_pwmc_remove(struct platform_device *pdev)
+static void iproc_pwmc_remove(struct platform_device *pdev)
{
struct iproc_pwmc *ip = platform_get_drvdata(pdev);
pwmchip_remove(&ip->chip);
clk_disable_unprepare(ip->clk);
-
- return 0;
}
static const struct of_device_id bcm_iproc_pwmc_dt[] = {
@@ -262,7 +260,7 @@ static struct platform_driver iproc_pwmc_driver = {
.of_match_table = bcm_iproc_pwmc_dt,
},
.probe = iproc_pwmc_probe,
- .remove = iproc_pwmc_remove,
+ .remove_new = iproc_pwmc_remove,
};
module_platform_driver(iproc_pwmc_driver);
--
2.39.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] 21+ messages in thread* [PATCH 05/30] pwm: bcm2835: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
` (3 preceding siblings ...)
2023-03-03 18:54 ` [PATCH 04/30] pwm: bcm-iproc: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 07/30] pwm: brcmstb: " Uwe Kleine-König
` (9 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding, Florian Fainelli, Ray Jui, Scott Branden
Cc: kernel, Broadcom internal kernel review list, linux-pwm,
linux-rpi-kernel, linux-arm-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/pwm/pwm-bcm2835.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c
index 50b8594be31d..bdfc2a5ec0d6 100644
--- a/drivers/pwm/pwm-bcm2835.c
+++ b/drivers/pwm/pwm-bcm2835.c
@@ -173,15 +173,13 @@ static int bcm2835_pwm_probe(struct platform_device *pdev)
return ret;
}
-static int bcm2835_pwm_remove(struct platform_device *pdev)
+static void bcm2835_pwm_remove(struct platform_device *pdev)
{
struct bcm2835_pwm *pc = platform_get_drvdata(pdev);
pwmchip_remove(&pc->chip);
clk_disable_unprepare(pc->clk);
-
- return 0;
}
static const struct of_device_id bcm2835_pwm_of_match[] = {
@@ -196,7 +194,7 @@ static struct platform_driver bcm2835_pwm_driver = {
.of_match_table = bcm2835_pwm_of_match,
},
.probe = bcm2835_pwm_probe,
- .remove = bcm2835_pwm_remove,
+ .remove_new = bcm2835_pwm_remove,
};
module_platform_driver(bcm2835_pwm_driver);
--
2.39.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] 21+ messages in thread* [PATCH 07/30] pwm: brcmstb: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
` (4 preceding siblings ...)
2023-03-03 18:54 ` [PATCH 05/30] pwm: bcm2835: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 12/30] pwm: imx-tpm: " Uwe Kleine-König
` (8 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding, Florian Fainelli
Cc: kernel, Broadcom internal kernel review list, linux-pwm,
linux-arm-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/pwm/pwm-brcmstb.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/pwm-brcmstb.c b/drivers/pwm/pwm-brcmstb.c
index 3db3f96edf78..a3faa9a3de7c 100644
--- a/drivers/pwm/pwm-brcmstb.c
+++ b/drivers/pwm/pwm-brcmstb.c
@@ -275,14 +275,12 @@ static int brcmstb_pwm_probe(struct platform_device *pdev)
return ret;
}
-static int brcmstb_pwm_remove(struct platform_device *pdev)
+static void brcmstb_pwm_remove(struct platform_device *pdev)
{
struct brcmstb_pwm *p = platform_get_drvdata(pdev);
pwmchip_remove(&p->chip);
clk_disable_unprepare(p->clk);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -310,7 +308,7 @@ static SIMPLE_DEV_PM_OPS(brcmstb_pwm_pm_ops, brcmstb_pwm_suspend,
static struct platform_driver brcmstb_pwm_driver = {
.probe = brcmstb_pwm_probe,
- .remove = brcmstb_pwm_remove,
+ .remove_new = brcmstb_pwm_remove,
.driver = {
.name = "pwm-brcmstb",
.of_match_table = brcmstb_pwm_of_match,
--
2.39.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] 21+ messages in thread* [PATCH 12/30] pwm: imx-tpm: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
` (5 preceding siblings ...)
2023-03-03 18:54 ` [PATCH 07/30] pwm: brcmstb: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 13/30] pwm: lpc18xx-sct: " Uwe Kleine-König
` (7 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding, Shawn Guo, Sascha Hauer
Cc: kernel, Fabio Estevam, NXP Linux Team, linux-pwm,
linux-arm-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/pwm/pwm-imx-tpm.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/pwm-imx-tpm.c b/drivers/pwm/pwm-imx-tpm.c
index ed1aad96fff0..5e2b452ee5f2 100644
--- a/drivers/pwm/pwm-imx-tpm.c
+++ b/drivers/pwm/pwm-imx-tpm.c
@@ -381,15 +381,13 @@ static int pwm_imx_tpm_probe(struct platform_device *pdev)
return ret;
}
-static int pwm_imx_tpm_remove(struct platform_device *pdev)
+static void pwm_imx_tpm_remove(struct platform_device *pdev)
{
struct imx_tpm_pwm_chip *tpm = platform_get_drvdata(pdev);
pwmchip_remove(&tpm->chip);
clk_disable_unprepare(tpm->clk);
-
- return 0;
}
static int __maybe_unused pwm_imx_tpm_suspend(struct device *dev)
@@ -432,7 +430,7 @@ static struct platform_driver imx_tpm_pwm_driver = {
.pm = &imx_tpm_pwm_pm,
},
.probe = pwm_imx_tpm_probe,
- .remove = pwm_imx_tpm_remove,
+ .remove_new = pwm_imx_tpm_remove,
};
module_platform_driver(imx_tpm_pwm_driver);
--
2.39.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] 21+ messages in thread* [PATCH 13/30] pwm: lpc18xx-sct: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
` (6 preceding siblings ...)
2023-03-03 18:54 ` [PATCH 12/30] pwm: imx-tpm: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 15/30] pwm: mtk-disp: " Uwe Kleine-König
` (6 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding, Vladimir Zapolskiy; +Cc: kernel, linux-pwm, linux-arm-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/pwm/pwm-lpc18xx-sct.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c
index 378e1df944dc..b9bf5b366f4b 100644
--- a/drivers/pwm/pwm-lpc18xx-sct.c
+++ b/drivers/pwm/pwm-lpc18xx-sct.c
@@ -449,7 +449,7 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev)
return ret;
}
-static int lpc18xx_pwm_remove(struct platform_device *pdev)
+static void lpc18xx_pwm_remove(struct platform_device *pdev)
{
struct lpc18xx_pwm_chip *lpc18xx_pwm = platform_get_drvdata(pdev);
u32 val;
@@ -461,8 +461,6 @@ static int lpc18xx_pwm_remove(struct platform_device *pdev)
val | LPC18XX_PWM_CTRL_HALT);
clk_disable_unprepare(lpc18xx_pwm->pwm_clk);
-
- return 0;
}
static struct platform_driver lpc18xx_pwm_driver = {
@@ -471,7 +469,7 @@ static struct platform_driver lpc18xx_pwm_driver = {
.of_match_table = lpc18xx_pwm_of_match,
},
.probe = lpc18xx_pwm_probe,
- .remove = lpc18xx_pwm_remove,
+ .remove_new = lpc18xx_pwm_remove,
};
module_platform_driver(lpc18xx_pwm_driver);
--
2.39.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] 21+ messages in thread* [PATCH 15/30] pwm: mtk-disp: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
` (7 preceding siblings ...)
2023-03-03 18:54 ` [PATCH 13/30] pwm: lpc18xx-sct: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 18/30] pwm: rockchip: " Uwe Kleine-König
` (5 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding, Matthias Brugger
Cc: kernel, AngeloGioacchino Del Regno, linux-pwm, linux-arm-kernel,
linux-mediatek
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/pwm/pwm-mtk-disp.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c
index 692a06121b28..4cfe88d54652 100644
--- a/drivers/pwm/pwm-mtk-disp.c
+++ b/drivers/pwm/pwm-mtk-disp.c
@@ -260,13 +260,11 @@ static int mtk_disp_pwm_probe(struct platform_device *pdev)
return 0;
}
-static int mtk_disp_pwm_remove(struct platform_device *pdev)
+static void mtk_disp_pwm_remove(struct platform_device *pdev)
{
struct mtk_disp_pwm *mdp = platform_get_drvdata(pdev);
pwmchip_remove(&mdp->chip);
-
- return 0;
}
static const struct mtk_pwm_data mt2701_pwm_data = {
@@ -314,7 +312,7 @@ static struct platform_driver mtk_disp_pwm_driver = {
.of_match_table = mtk_disp_pwm_of_match,
},
.probe = mtk_disp_pwm_probe,
- .remove = mtk_disp_pwm_remove,
+ .remove_new = mtk_disp_pwm_remove,
};
module_platform_driver(mtk_disp_pwm_driver);
--
2.39.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] 21+ messages in thread* [PATCH 18/30] pwm: rockchip: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
` (8 preceding siblings ...)
2023-03-03 18:54 ` [PATCH 15/30] pwm: mtk-disp: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 19/30] pwm: samsung: " Uwe Kleine-König
` (4 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding, Heiko Stuebner
Cc: kernel, linux-pwm, linux-arm-kernel, linux-rockchip
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/pwm/pwm-rockchip.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c
index 7f084eb34092..c1a1f2d864b5 100644
--- a/drivers/pwm/pwm-rockchip.c
+++ b/drivers/pwm/pwm-rockchip.c
@@ -376,7 +376,7 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
return ret;
}
-static int rockchip_pwm_remove(struct platform_device *pdev)
+static void rockchip_pwm_remove(struct platform_device *pdev)
{
struct rockchip_pwm_chip *pc = platform_get_drvdata(pdev);
@@ -384,8 +384,6 @@ static int rockchip_pwm_remove(struct platform_device *pdev)
clk_unprepare(pc->pclk);
clk_unprepare(pc->clk);
-
- return 0;
}
static struct platform_driver rockchip_pwm_driver = {
@@ -394,7 +392,7 @@ static struct platform_driver rockchip_pwm_driver = {
.of_match_table = rockchip_pwm_dt_ids,
},
.probe = rockchip_pwm_probe,
- .remove = rockchip_pwm_remove,
+ .remove_new = rockchip_pwm_remove,
};
module_platform_driver(rockchip_pwm_driver);
--
2.39.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] 21+ messages in thread* [PATCH 19/30] pwm: samsung: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
` (9 preceding siblings ...)
2023-03-03 18:54 ` [PATCH 18/30] pwm: rockchip: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 24/30] pwm: stm32: " Uwe Kleine-König
` (3 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding, Krzysztof Kozlowski
Cc: kernel, Alim Akhtar, linux-arm-kernel, linux-samsung-soc,
linux-pwm
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/pwm/pwm-samsung.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index 9c5b4f515641..e8828f57ab15 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -621,15 +621,13 @@ static int pwm_samsung_probe(struct platform_device *pdev)
return 0;
}
-static int pwm_samsung_remove(struct platform_device *pdev)
+static void pwm_samsung_remove(struct platform_device *pdev)
{
struct samsung_pwm_chip *chip = platform_get_drvdata(pdev);
pwmchip_remove(&chip->chip);
clk_disable_unprepare(chip->base_clk);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -676,7 +674,7 @@ static struct platform_driver pwm_samsung_driver = {
.of_match_table = of_match_ptr(samsung_pwm_matches),
},
.probe = pwm_samsung_probe,
- .remove = pwm_samsung_remove,
+ .remove_new = pwm_samsung_remove,
};
module_platform_driver(pwm_samsung_driver);
--
2.39.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] 21+ messages in thread* [PATCH 24/30] pwm: stm32: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
` (10 preceding siblings ...)
2023-03-03 18:54 ` [PATCH 19/30] pwm: samsung: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 25/30] pwm: sun4i: " Uwe Kleine-König
` (2 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding, Fabrice Gasnier, Maxime Coquelin,
Alexandre Torgue
Cc: kernel, linux-pwm, linux-stm32, linux-arm-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/pwm/pwm-stm32.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index 21e4a34dfff3..a482f7e0e4ab 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -642,7 +642,7 @@ static int stm32_pwm_probe(struct platform_device *pdev)
return 0;
}
-static int stm32_pwm_remove(struct platform_device *pdev)
+static void stm32_pwm_remove(struct platform_device *pdev)
{
struct stm32_pwm *priv = platform_get_drvdata(pdev);
unsigned int i;
@@ -651,8 +651,6 @@ static int stm32_pwm_remove(struct platform_device *pdev)
pwm_disable(&priv->chip.pwms[i]);
pwmchip_remove(&priv->chip);
-
- return 0;
}
static int __maybe_unused stm32_pwm_suspend(struct device *dev)
@@ -699,7 +697,7 @@ MODULE_DEVICE_TABLE(of, stm32_pwm_of_match);
static struct platform_driver stm32_pwm_driver = {
.probe = stm32_pwm_probe,
- .remove = stm32_pwm_remove,
+ .remove_new = stm32_pwm_remove,
.driver = {
.name = "stm32-pwm",
.of_match_table = stm32_pwm_of_match,
--
2.39.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] 21+ messages in thread* [PATCH 25/30] pwm: sun4i: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
` (11 preceding siblings ...)
2023-03-03 18:54 ` [PATCH 24/30] pwm: stm32: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-14 20:13 ` Jernej Škrabec
2023-03-03 18:54 ` [PATCH 29/30] pwm: vt8500: " Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 30/30] pwm: xilinx: " Uwe Kleine-König
14 siblings, 1 reply; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
Cc: kernel, linux-pwm, linux-arm-kernel, linux-sunxi
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/pwm/pwm-sun4i.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
index b973da73e9ab..a8790a8fc53e 100644
--- a/drivers/pwm/pwm-sun4i.c
+++ b/drivers/pwm/pwm-sun4i.c
@@ -477,7 +477,7 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
return ret;
}
-static int sun4i_pwm_remove(struct platform_device *pdev)
+static void sun4i_pwm_remove(struct platform_device *pdev)
{
struct sun4i_pwm_chip *sun4ichip = platform_get_drvdata(pdev);
@@ -485,8 +485,6 @@ static int sun4i_pwm_remove(struct platform_device *pdev)
clk_disable_unprepare(sun4ichip->bus_clk);
reset_control_assert(sun4ichip->rst);
-
- return 0;
}
static struct platform_driver sun4i_pwm_driver = {
@@ -495,7 +493,7 @@ static struct platform_driver sun4i_pwm_driver = {
.of_match_table = sun4i_pwm_dt_ids,
},
.probe = sun4i_pwm_probe,
- .remove = sun4i_pwm_remove,
+ .remove_new = sun4i_pwm_remove,
};
module_platform_driver(sun4i_pwm_driver);
--
2.39.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] 21+ messages in thread* Re: [PATCH 25/30] pwm: sun4i: Convert to platform remove callback returning void
2023-03-03 18:54 ` [PATCH 25/30] pwm: sun4i: " Uwe Kleine-König
@ 2023-03-14 20:13 ` Jernej Škrabec
0 siblings, 0 replies; 21+ messages in thread
From: Jernej Škrabec @ 2023-03-14 20:13 UTC (permalink / raw)
To: Thierry Reding, Chen-Yu Tsai, Samuel Holland,
Uwe Kleine-König
Cc: kernel, linux-pwm, linux-arm-kernel, linux-sunxi
Dne petek, 03. marec 2023 ob 19:54:40 CET 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 (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>
> ---
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
> drivers/pwm/pwm-sun4i.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
> index b973da73e9ab..a8790a8fc53e 100644
> --- a/drivers/pwm/pwm-sun4i.c
> +++ b/drivers/pwm/pwm-sun4i.c
> @@ -477,7 +477,7 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int sun4i_pwm_remove(struct platform_device *pdev)
> +static void sun4i_pwm_remove(struct platform_device *pdev)
> {
> struct sun4i_pwm_chip *sun4ichip = platform_get_drvdata(pdev);
>
> @@ -485,8 +485,6 @@ static int sun4i_pwm_remove(struct platform_device
> *pdev)
>
> clk_disable_unprepare(sun4ichip->bus_clk);
> reset_control_assert(sun4ichip->rst);
> -
> - return 0;
> }
>
> static struct platform_driver sun4i_pwm_driver = {
> @@ -495,7 +493,7 @@ static struct platform_driver sun4i_pwm_driver = {
> .of_match_table = sun4i_pwm_dt_ids,
> },
> .probe = sun4i_pwm_probe,
> - .remove = sun4i_pwm_remove,
> + .remove_new = sun4i_pwm_remove,
> };
> module_platform_driver(sun4i_pwm_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] 21+ messages in thread
* [PATCH 29/30] pwm: vt8500: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
` (12 preceding siblings ...)
2023-03-03 18:54 ` [PATCH 25/30] pwm: sun4i: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-03 18:54 ` [PATCH 30/30] pwm: xilinx: " Uwe Kleine-König
14 siblings, 0 replies; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding; +Cc: kernel, linux-arm-kernel, linux-pwm
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/pwm/pwm-vt8500.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c
index f1ff9940b37c..d2c48fd98706 100644
--- a/drivers/pwm/pwm-vt8500.c
+++ b/drivers/pwm/pwm-vt8500.c
@@ -279,20 +279,18 @@ static int vt8500_pwm_probe(struct platform_device *pdev)
return ret;
}
-static int vt8500_pwm_remove(struct platform_device *pdev)
+static void vt8500_pwm_remove(struct platform_device *pdev)
{
struct vt8500_chip *vt8500 = platform_get_drvdata(pdev);
pwmchip_remove(&vt8500->chip);
clk_unprepare(vt8500->clk);
-
- return 0;
}
static struct platform_driver vt8500_pwm_driver = {
.probe = vt8500_pwm_probe,
- .remove = vt8500_pwm_remove,
+ .remove_new = vt8500_pwm_remove,
.driver = {
.name = "vt8500-pwm",
.of_match_table = vt8500_pwm_dt_ids,
--
2.39.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] 21+ messages in thread* [PATCH 30/30] pwm: xilinx: Convert to platform remove callback returning void
2023-03-03 18:54 [PATCH 00/30] pwm: Convert to platform remove callback returning void Uwe Kleine-König
` (13 preceding siblings ...)
2023-03-03 18:54 ` [PATCH 29/30] pwm: vt8500: " Uwe Kleine-König
@ 2023-03-03 18:54 ` Uwe Kleine-König
2023-03-03 18:58 ` Sean Anderson
14 siblings, 1 reply; 21+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 18:54 UTC (permalink / raw)
To: Thierry Reding, Sean Anderson, Michal Simek
Cc: kernel, linux-pwm, linux-arm-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/pwm/pwm-xilinx.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/pwm/pwm-xilinx.c b/drivers/pwm/pwm-xilinx.c
index f7a50fdcd9a5..85153ee90809 100644
--- a/drivers/pwm/pwm-xilinx.c
+++ b/drivers/pwm/pwm-xilinx.c
@@ -292,14 +292,13 @@ static int xilinx_pwm_probe(struct platform_device *pdev)
return 0;
}
-static int xilinx_pwm_remove(struct platform_device *pdev)
+static void xilinx_pwm_remove(struct platform_device *pdev)
{
struct xilinx_pwm_device *xilinx_pwm = platform_get_drvdata(pdev);
pwmchip_remove(&xilinx_pwm->chip);
clk_rate_exclusive_put(xilinx_pwm->priv.clk);
clk_disable_unprepare(xilinx_pwm->priv.clk);
- return 0;
}
static const struct of_device_id xilinx_pwm_of_match[] = {
@@ -310,7 +309,7 @@ MODULE_DEVICE_TABLE(of, xilinx_pwm_of_match);
static struct platform_driver xilinx_pwm_driver = {
.probe = xilinx_pwm_probe,
- .remove = xilinx_pwm_remove,
+ .remove_new = xilinx_pwm_remove,
.driver = {
.name = "xilinx-pwm",
.of_match_table = of_match_ptr(xilinx_pwm_of_match),
--
2.39.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] 21+ messages in thread* Re: [PATCH 30/30] pwm: xilinx: Convert to platform remove callback returning void
2023-03-03 18:54 ` [PATCH 30/30] pwm: xilinx: " Uwe Kleine-König
@ 2023-03-03 18:58 ` Sean Anderson
0 siblings, 0 replies; 21+ messages in thread
From: Sean Anderson @ 2023-03-03 18:58 UTC (permalink / raw)
To: Uwe Kleine-König, Thierry Reding, Michal Simek
Cc: kernel, linux-pwm, linux-arm-kernel
On 3/3/23 13:54, 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/pwm/pwm-xilinx.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pwm/pwm-xilinx.c b/drivers/pwm/pwm-xilinx.c
> index f7a50fdcd9a5..85153ee90809 100644
> --- a/drivers/pwm/pwm-xilinx.c
> +++ b/drivers/pwm/pwm-xilinx.c
> @@ -292,14 +292,13 @@ static int xilinx_pwm_probe(struct platform_device *pdev)
> return 0;
> }
>
> -static int xilinx_pwm_remove(struct platform_device *pdev)
> +static void xilinx_pwm_remove(struct platform_device *pdev)
> {
> struct xilinx_pwm_device *xilinx_pwm = platform_get_drvdata(pdev);
>
> pwmchip_remove(&xilinx_pwm->chip);
> clk_rate_exclusive_put(xilinx_pwm->priv.clk);
> clk_disable_unprepare(xilinx_pwm->priv.clk);
> - return 0;
> }
>
> static const struct of_device_id xilinx_pwm_of_match[] = {
> @@ -310,7 +309,7 @@ MODULE_DEVICE_TABLE(of, xilinx_pwm_of_match);
>
> static struct platform_driver xilinx_pwm_driver = {
> .probe = xilinx_pwm_probe,
> - .remove = xilinx_pwm_remove,
> + .remove_new = xilinx_pwm_remove,
> .driver = {
> .name = "xilinx-pwm",
> .of_match_table = of_match_ptr(xilinx_pwm_of_match),
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
_______________________________________________
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] 21+ messages in thread