* [PATCH 02/58] mmc: bcm2835: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-14 10:10 ` Florian Fainelli
2023-07-13 8:07 ` [PATCH 03/58] mmc: jz4740: " Yangtao Li
` (56 subsequent siblings)
57 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson, Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-rpi-kernel,
linux-arm-kernel, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/bcm2835.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index eea208856ce0..35d8fdea668b 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -1431,7 +1431,7 @@ static int bcm2835_probe(struct platform_device *pdev)
return ret;
}
-static int bcm2835_remove(struct platform_device *pdev)
+static void bcm2835_remove(struct platform_device *pdev)
{
struct bcm2835_host *host = platform_get_drvdata(pdev);
struct mmc_host *mmc = mmc_from_priv(host);
@@ -1449,8 +1449,6 @@ static int bcm2835_remove(struct platform_device *pdev)
dma_release_channel(host->dma_chan_rxtx);
mmc_free_host(mmc);
-
- return 0;
}
static const struct of_device_id bcm2835_match[] = {
@@ -1461,7 +1459,7 @@ MODULE_DEVICE_TABLE(of, bcm2835_match);
static struct platform_driver bcm2835_driver = {
.probe = bcm2835_probe,
- .remove = bcm2835_remove,
+ .remove_new = bcm2835_remove,
.driver = {
.name = "sdhost-bcm2835",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 02/58] mmc: bcm2835: Convert to platform remove callback returning void
2023-07-13 8:07 ` [PATCH 02/58] mmc: bcm2835: " Yangtao Li
@ 2023-07-14 10:10 ` Florian Fainelli
0 siblings, 0 replies; 80+ messages in thread
From: Florian Fainelli @ 2023-07-14 10:10 UTC (permalink / raw)
To: Yangtao Li, Ulf Hansson, Ray Jui, Scott Branden,
Broadcom internal kernel review list
Cc: Uwe Kleine-König, linux-mmc, linux-rpi-kernel,
linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 798 bytes --]
On 7/13/2023 10:07 AM, Yangtao Li 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]
^ permalink raw reply [flat|nested] 80+ messages in thread
* [PATCH 03/58] mmc: jz4740: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
2023-07-13 8:07 ` [PATCH 02/58] mmc: bcm2835: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:20 ` Paul Cercueil
2023-07-13 8:07 ` [PATCH 04/58] mmc: litex_mmc: " Yangtao Li
` (55 subsequent siblings)
57 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Paul Cercueil, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mips, linux-mmc,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/jz4740_mmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c
index 1846a05210e3..f379ce5b582d 100644
--- a/drivers/mmc/host/jz4740_mmc.c
+++ b/drivers/mmc/host/jz4740_mmc.c
@@ -1163,7 +1163,7 @@ static int jz4740_mmc_probe(struct platform_device* pdev)
return ret;
}
-static int jz4740_mmc_remove(struct platform_device *pdev)
+static void jz4740_mmc_remove(struct platform_device *pdev)
{
struct jz4740_mmc_host *host = platform_get_drvdata(pdev);
@@ -1179,8 +1179,6 @@ static int jz4740_mmc_remove(struct platform_device *pdev)
jz4740_mmc_release_dma_channels(host);
mmc_free_host(host->mmc);
-
- return 0;
}
static int jz4740_mmc_suspend(struct device *dev)
@@ -1198,7 +1196,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(jz4740_mmc_pm_ops, jz4740_mmc_suspend,
static struct platform_driver jz4740_mmc_driver = {
.probe = jz4740_mmc_probe,
- .remove = jz4740_mmc_remove,
+ .remove_new = jz4740_mmc_remove,
.driver = {
.name = "jz4740-mmc",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 03/58] mmc: jz4740: Convert to platform remove callback returning void
2023-07-13 8:07 ` [PATCH 03/58] mmc: jz4740: " Yangtao Li
@ 2023-07-13 8:20 ` Paul Cercueil
0 siblings, 0 replies; 80+ messages in thread
From: Paul Cercueil @ 2023-07-13 8:20 UTC (permalink / raw)
To: Yangtao Li, Ulf Hansson
Cc: Uwe Kleine-König, linux-mips, linux-mmc, linux-kernel
Hi,
Le jeudi 13 juillet 2023 à 16:07 +0800, Yangtao Li a écrit :
> 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Cheers,
-Paul
> ---
> drivers/mmc/host/jz4740_mmc.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/jz4740_mmc.c
> b/drivers/mmc/host/jz4740_mmc.c
> index 1846a05210e3..f379ce5b582d 100644
> --- a/drivers/mmc/host/jz4740_mmc.c
> +++ b/drivers/mmc/host/jz4740_mmc.c
> @@ -1163,7 +1163,7 @@ static int jz4740_mmc_probe(struct
> platform_device* pdev)
> return ret;
> }
>
> -static int jz4740_mmc_remove(struct platform_device *pdev)
> +static void jz4740_mmc_remove(struct platform_device *pdev)
> {
> struct jz4740_mmc_host *host = platform_get_drvdata(pdev);
>
> @@ -1179,8 +1179,6 @@ static int jz4740_mmc_remove(struct
> platform_device *pdev)
> jz4740_mmc_release_dma_channels(host);
>
> mmc_free_host(host->mmc);
> -
> - return 0;
> }
>
> static int jz4740_mmc_suspend(struct device *dev)
> @@ -1198,7 +1196,7 @@ static
> DEFINE_SIMPLE_DEV_PM_OPS(jz4740_mmc_pm_ops, jz4740_mmc_suspend,
>
> static struct platform_driver jz4740_mmc_driver = {
> .probe = jz4740_mmc_probe,
> - .remove = jz4740_mmc_remove,
> + .remove_new = jz4740_mmc_remove,
> .driver = {
> .name = "jz4740-mmc",
> .probe_type = PROBE_PREFER_ASYNCHRONOUS,
^ permalink raw reply [flat|nested] 80+ messages in thread
* [PATCH 04/58] mmc: litex_mmc: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
2023-07-13 8:07 ` [PATCH 02/58] mmc: bcm2835: " Yangtao Li
2023-07-13 8:07 ` [PATCH 03/58] mmc: jz4740: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 05/58] mmc: mtk-sd: " Yangtao Li
` (54 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson, Karol Gugala, Mateusz Holenko, Gabriel Somlo,
Joel Stanley
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/litex_mmc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/litex_mmc.c b/drivers/mmc/host/litex_mmc.c
index 9af6b0902efe..4ec8072dc60b 100644
--- a/drivers/mmc/host/litex_mmc.c
+++ b/drivers/mmc/host/litex_mmc.c
@@ -629,12 +629,11 @@ static int litex_mmc_probe(struct platform_device *pdev)
return 0;
}
-static int litex_mmc_remove(struct platform_device *pdev)
+static void litex_mmc_remove(struct platform_device *pdev)
{
struct litex_mmc_host *host = platform_get_drvdata(pdev);
mmc_remove_host(host->mmc);
- return 0;
}
static const struct of_device_id litex_match[] = {
@@ -645,7 +644,7 @@ MODULE_DEVICE_TABLE(of, litex_match);
static struct platform_driver litex_mmc_driver = {
.probe = litex_mmc_probe,
- .remove = litex_mmc_remove,
+ .remove_new = litex_mmc_remove,
.driver = {
.name = "litex-mmc",
.of_match_table = litex_match,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 05/58] mmc: mtk-sd: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (2 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 04/58] mmc: litex_mmc: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 06/58] mmc: cb710: " Yangtao Li
` (53 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Chaotian Jing, Ulf Hansson, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-kernel,
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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/mtk-sd.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 02403ff99e0d..9e2debd1edbe 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -2887,7 +2887,7 @@ static int msdc_drv_probe(struct platform_device *pdev)
return ret;
}
-static int msdc_drv_remove(struct platform_device *pdev)
+static void msdc_drv_remove(struct platform_device *pdev)
{
struct mmc_host *mmc;
struct msdc_host *host;
@@ -2911,8 +2911,6 @@ static int msdc_drv_remove(struct platform_device *pdev)
host->dma.bd, host->dma.bd_addr);
mmc_free_host(mmc);
-
- return 0;
}
static void msdc_save_reg(struct msdc_host *host)
@@ -3054,7 +3052,7 @@ static const struct dev_pm_ops msdc_dev_pm_ops = {
static struct platform_driver mt_msdc_driver = {
.probe = msdc_drv_probe,
- .remove = msdc_drv_remove,
+ .remove_new = msdc_drv_remove,
.driver = {
.name = "mtk-msdc",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 06/58] mmc: cb710: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (3 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 05/58] mmc: mtk-sd: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-14 14:15 ` Michał Mirosław
2023-07-13 8:07 ` [PATCH 07/58] mmc: davinci_mmc: " Yangtao Li
` (52 subsequent siblings)
57 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Michał Mirosław, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/cb710-mmc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c
index 6d623b2681c3..0aec33b88bef 100644
--- a/drivers/mmc/host/cb710-mmc.c
+++ b/drivers/mmc/host/cb710-mmc.c
@@ -745,7 +745,7 @@ static int cb710_mmc_init(struct platform_device *pdev)
return err;
}
-static int cb710_mmc_exit(struct platform_device *pdev)
+static void cb710_mmc_exit(struct platform_device *pdev)
{
struct cb710_slot *slot = cb710_pdev_to_slot(pdev);
struct mmc_host *mmc = cb710_slot_to_mmc(slot);
@@ -766,13 +766,12 @@ static int cb710_mmc_exit(struct platform_device *pdev)
tasklet_kill(&reader->finish_req_tasklet);
mmc_free_host(mmc);
- return 0;
}
static struct platform_driver cb710_mmc_driver = {
.driver.name = "cb710-mmc",
.probe = cb710_mmc_init,
- .remove = cb710_mmc_exit,
+ .remove_new = cb710_mmc_exit,
#ifdef CONFIG_PM
.suspend = cb710_mmc_suspend,
.resume = cb710_mmc_resume,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 06/58] mmc: cb710: Convert to platform remove callback returning void
2023-07-13 8:07 ` [PATCH 06/58] mmc: cb710: " Yangtao Li
@ 2023-07-14 14:15 ` Michał Mirosław
0 siblings, 0 replies; 80+ messages in thread
From: Michał Mirosław @ 2023-07-14 14:15 UTC (permalink / raw)
To: Yangtao Li; +Cc: Ulf Hansson, Uwe Kleine-König, linux-mmc, linux-kernel
On Thu, Jul 13, 2023 at 04:07:15PM +0800, Yangtao Li 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
Acked-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---
> drivers/mmc/host/cb710-mmc.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c
> index 6d623b2681c3..0aec33b88bef 100644
> --- a/drivers/mmc/host/cb710-mmc.c
> +++ b/drivers/mmc/host/cb710-mmc.c
> @@ -745,7 +745,7 @@ static int cb710_mmc_init(struct platform_device *pdev)
> return err;
> }
>
> -static int cb710_mmc_exit(struct platform_device *pdev)
> +static void cb710_mmc_exit(struct platform_device *pdev)
> {
> struct cb710_slot *slot = cb710_pdev_to_slot(pdev);
> struct mmc_host *mmc = cb710_slot_to_mmc(slot);
> @@ -766,13 +766,12 @@ static int cb710_mmc_exit(struct platform_device *pdev)
> tasklet_kill(&reader->finish_req_tasklet);
>
> mmc_free_host(mmc);
> - return 0;
> }
>
> static struct platform_driver cb710_mmc_driver = {
> .driver.name = "cb710-mmc",
> .probe = cb710_mmc_init,
> - .remove = cb710_mmc_exit,
> + .remove_new = cb710_mmc_exit,
> #ifdef CONFIG_PM
> .suspend = cb710_mmc_suspend,
> .resume = cb710_mmc_resume,
> --
> 2.39.0
>
--
Michał Mirosław
^ permalink raw reply [flat|nested] 80+ messages in thread
* [PATCH 07/58] mmc: davinci_mmc: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (4 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 06/58] mmc: cb710: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 08/58] mmc: dw_mmc: hi3798cv200: " Yangtao Li
` (51 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/davinci_mmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 7138dfa065bf..0a08b85e35b0 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1345,7 +1345,7 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
return ret;
}
-static int __exit davinci_mmcsd_remove(struct platform_device *pdev)
+static void __exit davinci_mmcsd_remove(struct platform_device *pdev)
{
struct mmc_davinci_host *host = platform_get_drvdata(pdev);
@@ -1354,8 +1354,6 @@ static int __exit davinci_mmcsd_remove(struct platform_device *pdev)
davinci_release_dma_channels(host);
clk_disable_unprepare(host->clk);
mmc_free_host(host->mmc);
-
- return 0;
}
#ifdef CONFIG_PM
@@ -1402,7 +1400,7 @@ static struct platform_driver davinci_mmcsd_driver = {
.of_match_table = davinci_mmc_dt_ids,
},
.probe = davinci_mmcsd_probe,
- .remove = __exit_p(davinci_mmcsd_remove),
+ .remove_new = __exit_p(davinci_mmcsd_remove),
.id_table = davinci_mmc_devtype,
};
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 08/58] mmc: dw_mmc: hi3798cv200: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (5 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 07/58] mmc: davinci_mmc: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 09/58] mmc: sdhci-pic32: " Yangtao Li
` (50 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Jaehoon Chung, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/dw_mmc-hi3798cv200.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc-hi3798cv200.c b/drivers/mmc/host/dw_mmc-hi3798cv200.c
index 6f22fe054087..e9470c50a348 100644
--- a/drivers/mmc/host/dw_mmc-hi3798cv200.c
+++ b/drivers/mmc/host/dw_mmc-hi3798cv200.c
@@ -171,7 +171,7 @@ static int dw_mci_hi3798cv200_probe(struct platform_device *pdev)
return dw_mci_pltfm_register(pdev, &hi3798cv200_data);
}
-static int dw_mci_hi3798cv200_remove(struct platform_device *pdev)
+static void dw_mci_hi3798cv200_remove(struct platform_device *pdev)
{
struct dw_mci *host = platform_get_drvdata(pdev);
struct hi3798cv200_priv *priv = host->priv;
@@ -180,8 +180,6 @@ static int dw_mci_hi3798cv200_remove(struct platform_device *pdev)
clk_disable_unprepare(priv->sample_clk);
dw_mci_pltfm_remove(pdev);
-
- return 0;
}
static const struct of_device_id dw_mci_hi3798cv200_match[] = {
@@ -192,7 +190,7 @@ static const struct of_device_id dw_mci_hi3798cv200_match[] = {
MODULE_DEVICE_TABLE(of, dw_mci_hi3798cv200_match);
static struct platform_driver dw_mci_hi3798cv200_driver = {
.probe = dw_mci_hi3798cv200_probe,
- .remove = dw_mci_hi3798cv200_remove,
+ .remove_new = dw_mci_hi3798cv200_remove,
.driver = {
.name = "dwmmc_hi3798cv200",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 09/58] mmc: sdhci-pic32: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (6 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 08/58] mmc: dw_mmc: hi3798cv200: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-14 9:49 ` Adrian Hunter
2023-07-13 8:07 ` [PATCH 10/58] mmc: sdhci: milbeaut: " Yangtao Li
` (49 subsequent siblings)
57 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-pic32.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pic32.c b/drivers/mmc/host/sdhci-pic32.c
index 6696b6bdd88e..7a0351a9c74e 100644
--- a/drivers/mmc/host/sdhci-pic32.c
+++ b/drivers/mmc/host/sdhci-pic32.c
@@ -210,7 +210,7 @@ static int pic32_sdhci_probe(struct platform_device *pdev)
return ret;
}
-static int pic32_sdhci_remove(struct platform_device *pdev)
+static void pic32_sdhci_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct pic32_sdhci_priv *sdhci_pdata = sdhci_priv(host);
@@ -221,8 +221,6 @@ static int pic32_sdhci_remove(struct platform_device *pdev)
clk_disable_unprepare(sdhci_pdata->base_clk);
clk_disable_unprepare(sdhci_pdata->sys_clk);
sdhci_pltfm_free(pdev);
-
- return 0;
}
static const struct of_device_id pic32_sdhci_id_table[] = {
@@ -238,7 +236,7 @@ static struct platform_driver pic32_sdhci_driver = {
.of_match_table = of_match_ptr(pic32_sdhci_id_table),
},
.probe = pic32_sdhci_probe,
- .remove = pic32_sdhci_remove,
+ .remove_new = pic32_sdhci_remove,
};
module_platform_driver(pic32_sdhci_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 09/58] mmc: sdhci-pic32: Convert to platform remove callback returning void
2023-07-13 8:07 ` [PATCH 09/58] mmc: sdhci-pic32: " Yangtao Li
@ 2023-07-14 9:49 ` Adrian Hunter
0 siblings, 0 replies; 80+ messages in thread
From: Adrian Hunter @ 2023-07-14 9:49 UTC (permalink / raw)
To: Yangtao Li, Ulf Hansson; +Cc: Uwe Kleine-König, linux-mmc, linux-kernel
On 13/07/23 11:07, Yangtao Li 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
For the following patches:
[PATCH 09_58] mmc: sdhci-pic32: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 10_58] mmc: sdhci: milbeaut: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 12_58] mmc: sdhci-of-at91: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 15_58] mmc: sdhci-pxav3: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 19_58] mmc: xenon: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 20_58] mmc: sdhci-s3c: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 27_58] mmc: sdhci-of-arasan: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 28_58] mmc: sdhci-of-dwcmshc: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 33_58] mmc: sdhci-omap: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 34_58] mmc: sdhci-of-aspeed: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 36_58] mmc: sdhci-sprd: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 37_58] mmc: sdhci-tegra: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 38_58] mmc: sdhci-acpi: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 39_58] mmc: sdhci-esdhc-imx: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 40_58] mmc: sdhci-msm: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 47_58] mmc: sdhci-st: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 49_58] mmc: sdhci-esdhc-mcf: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1107
[PATCH 51_58] mmc: sdhci-spear: Convert to platform remove callback returning void - Yangtao Li <frank.li@vivo.com> - 2023-07-13 1108
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
^ permalink raw reply [flat|nested] 80+ messages in thread
* [PATCH 10/58] mmc: sdhci: milbeaut: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (7 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 09/58] mmc: sdhci-pic32: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 11/58] mmc: omap_hsmmc: " Yangtao Li
` (48 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson, Taichi Sugaya, Takao Orito
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-milbeaut.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-milbeaut.c b/drivers/mmc/host/sdhci-milbeaut.c
index 148b37ac6564..ee4514c90eea 100644
--- a/drivers/mmc/host/sdhci-milbeaut.c
+++ b/drivers/mmc/host/sdhci-milbeaut.c
@@ -313,7 +313,7 @@ static int sdhci_milbeaut_probe(struct platform_device *pdev)
return ret;
}
-static int sdhci_milbeaut_remove(struct platform_device *pdev)
+static void sdhci_milbeaut_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct f_sdhost_priv *priv = sdhci_priv(host);
@@ -326,8 +326,6 @@ static int sdhci_milbeaut_remove(struct platform_device *pdev)
sdhci_free_host(host);
platform_set_drvdata(pdev, NULL);
-
- return 0;
}
static struct platform_driver sdhci_milbeaut_driver = {
@@ -337,7 +335,7 @@ static struct platform_driver sdhci_milbeaut_driver = {
.of_match_table = of_match_ptr(mlb_dt_ids),
},
.probe = sdhci_milbeaut_probe,
- .remove = sdhci_milbeaut_remove,
+ .remove_new = sdhci_milbeaut_remove,
};
module_platform_driver(sdhci_milbeaut_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 11/58] mmc: omap_hsmmc: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (8 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 10/58] mmc: sdhci: milbeaut: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 12/58] mmc: sdhci-of-at91: " Yangtao Li
` (47 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-omap,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/omap_hsmmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 1e0f2d7774bd..c5a7bba3549d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1982,7 +1982,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
return ret;
}
-static int omap_hsmmc_remove(struct platform_device *pdev)
+static void omap_hsmmc_remove(struct platform_device *pdev)
{
struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
@@ -2000,8 +2000,6 @@ static int omap_hsmmc_remove(struct platform_device *pdev)
clk_disable_unprepare(host->dbclk);
mmc_free_host(host->mmc);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -2126,7 +2124,7 @@ static const struct dev_pm_ops omap_hsmmc_dev_pm_ops = {
static struct platform_driver omap_hsmmc_driver = {
.probe = omap_hsmmc_probe,
- .remove = omap_hsmmc_remove,
+ .remove_new = omap_hsmmc_remove,
.driver = {
.name = DRIVER_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 12/58] mmc: sdhci-of-at91: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (9 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 11/58] mmc: omap_hsmmc: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 13/58] mmc: omap: " Yangtao Li
` (46 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Adrian Hunter, Eugen Hristev, Ulf Hansson, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-of-at91.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index cd0134580a90..af5bc0caf29b 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -443,7 +443,7 @@ static int sdhci_at91_probe(struct platform_device *pdev)
return ret;
}
-static int sdhci_at91_remove(struct platform_device *pdev)
+static void sdhci_at91_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -461,8 +461,6 @@ static int sdhci_at91_remove(struct platform_device *pdev)
clk_disable_unprepare(gck);
clk_disable_unprepare(hclock);
clk_disable_unprepare(mainck);
-
- return 0;
}
static struct platform_driver sdhci_at91_driver = {
@@ -473,7 +471,7 @@ static struct platform_driver sdhci_at91_driver = {
.pm = &sdhci_at91_dev_pm_ops,
},
.probe = sdhci_at91_probe,
- .remove = sdhci_at91_remove,
+ .remove_new = sdhci_at91_remove,
};
module_platform_driver(sdhci_at91_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 13/58] mmc: omap: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (10 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 12/58] mmc: sdhci-of-at91: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 14/58] mmc: dw_mmc: exynos: " Yangtao Li
` (45 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Aaro Koskinen, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-omap, linux-mmc,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/omap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 6a259563690d..9fb8995b43a1 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1506,7 +1506,7 @@ static int mmc_omap_probe(struct platform_device *pdev)
return ret;
}
-static int mmc_omap_remove(struct platform_device *pdev)
+static void mmc_omap_remove(struct platform_device *pdev)
{
struct mmc_omap_host *host = platform_get_drvdata(pdev);
int i;
@@ -1532,8 +1532,6 @@ static int mmc_omap_remove(struct platform_device *pdev)
dma_release_channel(host->dma_rx);
destroy_workqueue(host->mmc_omap_wq);
-
- return 0;
}
#if IS_BUILTIN(CONFIG_OF)
@@ -1546,7 +1544,7 @@ MODULE_DEVICE_TABLE(of, mmc_omap_match);
static struct platform_driver mmc_omap_driver = {
.probe = mmc_omap_probe,
- .remove = mmc_omap_remove,
+ .remove_new = mmc_omap_remove,
.driver = {
.name = DRIVER_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 14/58] mmc: dw_mmc: exynos: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (11 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 13/58] mmc: omap: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:11 ` Krzysztof Kozlowski
2023-07-13 8:07 ` [PATCH 15/58] mmc: sdhci-pxav3: " Yangtao Li
` (44 subsequent siblings)
57 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Jaehoon Chung, Ulf Hansson, Krzysztof Kozlowski, Alim Akhtar
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-samsung-soc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/dw_mmc-exynos.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
index 9f20ac524c8b..698408e8bad0 100644
--- a/drivers/mmc/host/dw_mmc-exynos.c
+++ b/drivers/mmc/host/dw_mmc-exynos.c
@@ -664,15 +664,13 @@ static int dw_mci_exynos_probe(struct platform_device *pdev)
return 0;
}
-static int dw_mci_exynos_remove(struct platform_device *pdev)
+static void dw_mci_exynos_remove(struct platform_device *pdev)
{
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
dw_mci_pltfm_remove(pdev);
-
- return 0;
}
static const struct dev_pm_ops dw_mci_exynos_pmops = {
@@ -685,7 +683,7 @@ static const struct dev_pm_ops dw_mci_exynos_pmops = {
static struct platform_driver dw_mci_exynos_pltfm_driver = {
.probe = dw_mci_exynos_probe,
- .remove = dw_mci_exynos_remove,
+ .remove_new = dw_mci_exynos_remove,
.driver = {
.name = "dwmmc_exynos",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 14/58] mmc: dw_mmc: exynos: Convert to platform remove callback returning void
2023-07-13 8:07 ` [PATCH 14/58] mmc: dw_mmc: exynos: " Yangtao Li
@ 2023-07-13 8:11 ` Krzysztof Kozlowski
2023-07-13 9:02 ` Uwe Kleine-König
0 siblings, 1 reply; 80+ messages in thread
From: Krzysztof Kozlowski @ 2023-07-13 8:11 UTC (permalink / raw)
To: Yangtao Li, Jaehoon Chung, Ulf Hansson, Alim Akhtar
Cc: Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-samsung-soc, linux-kernel
On 13/07/2023 10:07, Yangtao Li 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.
You even copied Uwe's commit msg... Aren't you duplicate his work or is
it being coordinated?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 80+ messages in thread
* Re: [PATCH 14/58] mmc: dw_mmc: exynos: Convert to platform remove callback returning void
2023-07-13 8:11 ` Krzysztof Kozlowski
@ 2023-07-13 9:02 ` Uwe Kleine-König
0 siblings, 0 replies; 80+ messages in thread
From: Uwe Kleine-König @ 2023-07-13 9:02 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Yangtao Li, Jaehoon Chung, Ulf Hansson, Alim Akhtar, linux-mmc,
linux-arm-kernel, linux-samsung-soc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]
On Thu, Jul 13, 2023 at 10:11:15AM +0200, Krzysztof Kozlowski wrote:
> On 13/07/2023 10:07, Yangtao Li 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.
>
> You even copied Uwe's commit msg... Aren't you duplicate his work or is
> it being coordinated?
We communicated and I politely asked to not interfer. This series is
just what Yangtao had still pending. That's fine for me.
Thanks for noticing,
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] 80+ messages in thread
* [PATCH 15/58] mmc: sdhci-pxav3: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (12 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 14/58] mmc: dw_mmc: exynos: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 16/58] mmc: rtsx_pci: " Yangtao Li
` (43 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-pxav3.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index e39dcc998772..3af43ac05825 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -470,7 +470,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
return ret;
}
-static int sdhci_pxav3_remove(struct platform_device *pdev)
+static void sdhci_pxav3_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -486,8 +486,6 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
clk_disable_unprepare(pxa->clk_core);
sdhci_pltfm_free(pdev);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -570,7 +568,7 @@ static struct platform_driver sdhci_pxav3_driver = {
.pm = &sdhci_pxav3_pmops,
},
.probe = sdhci_pxav3_probe,
- .remove = sdhci_pxav3_remove,
+ .remove_new = sdhci_pxav3_remove,
};
module_platform_driver(sdhci_pxav3_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 16/58] mmc: rtsx_pci: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (13 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 15/58] mmc: sdhci-pxav3: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 9:06 ` Uwe Kleine-König
2023-07-13 8:07 ` [PATCH 17/58] mmc: sh_mmcif: " Yangtao Li
` (42 subsequent siblings)
57 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/rtsx_pci_sdmmc.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c
index 8098726dcc0b..5465a7225df4 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -1523,14 +1523,14 @@ static int rtsx_pci_sdmmc_drv_probe(struct platform_device *pdev)
return 0;
}
-static int rtsx_pci_sdmmc_drv_remove(struct platform_device *pdev)
+static void rtsx_pci_sdmmc_drv_remove(struct platform_device *pdev)
{
struct realtek_pci_sdmmc *host = platform_get_drvdata(pdev);
struct rtsx_pcr *pcr;
struct mmc_host *mmc;
if (!host)
- return 0;
+ return;
pcr = host->pcr;
pcr->slots[RTSX_SD_CARD].p_dev = NULL;
@@ -1566,8 +1566,6 @@ static int rtsx_pci_sdmmc_drv_remove(struct platform_device *pdev)
dev_dbg(&(pdev->dev),
": Realtek PCI-E SDMMC controller has been removed\n");
-
- return 0;
}
static const struct platform_device_id rtsx_pci_sdmmc_ids[] = {
@@ -1581,7 +1579,7 @@ MODULE_DEVICE_TABLE(platform, rtsx_pci_sdmmc_ids);
static struct platform_driver rtsx_pci_sdmmc_driver = {
.probe = rtsx_pci_sdmmc_drv_probe,
- .remove = rtsx_pci_sdmmc_drv_remove,
+ .remove_new = rtsx_pci_sdmmc_drv_remove,
.id_table = rtsx_pci_sdmmc_ids,
.driver = {
.name = DRV_NAME_RTSX_PCI_SDMMC,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 16/58] mmc: rtsx_pci: Convert to platform remove callback returning void
2023-07-13 8:07 ` [PATCH 16/58] mmc: rtsx_pci: " Yangtao Li
@ 2023-07-13 9:06 ` Uwe Kleine-König
0 siblings, 0 replies; 80+ messages in thread
From: Uwe Kleine-König @ 2023-07-13 9:06 UTC (permalink / raw)
To: Yangtao Li; +Cc: Ulf Hansson, linux-mmc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1946 bytes --]
On Thu, Jul 13, 2023 at 04:07:25PM +0800, Yangtao Li 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> drivers/mmc/host/rtsx_pci_sdmmc.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c
> index 8098726dcc0b..5465a7225df4 100644
> --- a/drivers/mmc/host/rtsx_pci_sdmmc.c
> +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
> @@ -1523,14 +1523,14 @@ static int rtsx_pci_sdmmc_drv_probe(struct platform_device *pdev)
> return 0;
> }
>
> -static int rtsx_pci_sdmmc_drv_remove(struct platform_device *pdev)
> +static void rtsx_pci_sdmmc_drv_remove(struct platform_device *pdev)
> {
> struct realtek_pci_sdmmc *host = platform_get_drvdata(pdev);
> struct rtsx_pcr *pcr;
> struct mmc_host *mmc;
>
> if (!host)
> - return 0;
> + return;
If host is NULL, there is a problem. While sometimes (rarely) driver
maintainers object, I usually remove these, see for example
3d82dca0f27ac5a0bfbbce439bba5c6452f3b7da.
> pcr = host->pcr;
> pcr->slots[RTSX_SD_CARD].p_dev = NULL;
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] 80+ messages in thread
* [PATCH 17/58] mmc: sh_mmcif: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (14 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 16/58] mmc: rtsx_pci: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 18/58] mmc: meson-gx: " Yangtao Li
` (41 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sh_mmcif.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 5cf53348372a..1066e0c2831b 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1509,7 +1509,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
return ret;
}
-static int sh_mmcif_remove(struct platform_device *pdev)
+static void sh_mmcif_remove(struct platform_device *pdev)
{
struct sh_mmcif_host *host = platform_get_drvdata(pdev);
@@ -1533,8 +1533,6 @@ static int sh_mmcif_remove(struct platform_device *pdev)
mmc_free_host(host->mmc);
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -1561,7 +1559,7 @@ static const struct dev_pm_ops sh_mmcif_dev_pm_ops = {
static struct platform_driver sh_mmcif_driver = {
.probe = sh_mmcif_probe,
- .remove = sh_mmcif_remove,
+ .remove_new = sh_mmcif_remove,
.driver = {
.name = DRIVER_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 18/58] mmc: meson-gx: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (15 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 17/58] mmc: sh_mmcif: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 19/58] mmc: xenon: " Yangtao Li
` (40 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-amlogic, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/meson-gx-mmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index ee9a25b900ae..106ebc1fd36f 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1297,7 +1297,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
return ret;
}
-static int meson_mmc_remove(struct platform_device *pdev)
+static void meson_mmc_remove(struct platform_device *pdev)
{
struct meson_host *host = dev_get_drvdata(&pdev->dev);
@@ -1308,8 +1308,6 @@ static int meson_mmc_remove(struct platform_device *pdev)
free_irq(host->irq, host);
clk_disable_unprepare(host->mmc_clk);
-
- return 0;
}
static const struct meson_mmc_data meson_gx_data = {
@@ -1340,7 +1338,7 @@ MODULE_DEVICE_TABLE(of, meson_mmc_of_match);
static struct platform_driver meson_mmc_driver = {
.probe = meson_mmc_probe,
- .remove = meson_mmc_remove,
+ .remove_new = meson_mmc_remove,
.driver = {
.name = DRIVER_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 19/58] mmc: xenon: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (16 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 18/58] mmc: meson-gx: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 20/58] mmc: sdhci-s3c: " Yangtao Li
` (39 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Adrian Hunter, Hu Ziji, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-xenon.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c
index 08e838400b52..25ba7aecc3be 100644
--- a/drivers/mmc/host/sdhci-xenon.c
+++ b/drivers/mmc/host/sdhci-xenon.c
@@ -578,7 +578,7 @@ static int xenon_probe(struct platform_device *pdev)
return err;
}
-static int xenon_remove(struct platform_device *pdev)
+static void xenon_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -595,8 +595,6 @@ static int xenon_remove(struct platform_device *pdev)
clk_disable_unprepare(pltfm_host->clk);
sdhci_pltfm_free(pdev);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -705,7 +703,7 @@ static struct platform_driver sdhci_xenon_driver = {
.pm = &sdhci_xenon_dev_pm_ops,
},
.probe = xenon_probe,
- .remove = xenon_remove,
+ .remove_new = xenon_remove,
};
module_platform_driver(sdhci_xenon_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 20/58] mmc: sdhci-s3c: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (17 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 19/58] mmc: xenon: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 21/58] mmc: meson-mx-sdhc: " Yangtao Li
` (38 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ben Dooks, Jaehoon Chung, Adrian Hunter, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-s3c.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 504015e84308..b61f12d328e0 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -668,7 +668,7 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
return ret;
}
-static int sdhci_s3c_remove(struct platform_device *pdev)
+static void sdhci_s3c_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_s3c *sc = sdhci_priv(host);
@@ -688,8 +688,6 @@ static int sdhci_s3c_remove(struct platform_device *pdev)
clk_disable_unprepare(sc->clk_io);
sdhci_free_host(host);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -776,7 +774,7 @@ MODULE_DEVICE_TABLE(of, sdhci_s3c_dt_match);
static struct platform_driver sdhci_s3c_driver = {
.probe = sdhci_s3c_probe,
- .remove = sdhci_s3c_remove,
+ .remove_new = sdhci_s3c_remove,
.id_table = sdhci_s3c_driver_ids,
.driver = {
.name = "s3c-sdhci",
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 21/58] mmc: meson-mx-sdhc: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (18 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 20/58] mmc: sdhci-s3c: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 22/58] mmc: rtsx_usb_sdmmc: " Yangtao Li
` (37 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-amlogic, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/meson-mx-sdhc-mmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c
index 97168cdfa8e9..528ec8166e7c 100644
--- a/drivers/mmc/host/meson-mx-sdhc-mmc.c
+++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c
@@ -880,7 +880,7 @@ static int meson_mx_sdhc_probe(struct platform_device *pdev)
return ret;
}
-static int meson_mx_sdhc_remove(struct platform_device *pdev)
+static void meson_mx_sdhc_remove(struct platform_device *pdev)
{
struct meson_mx_sdhc_host *host = platform_get_drvdata(pdev);
@@ -889,8 +889,6 @@ static int meson_mx_sdhc_remove(struct platform_device *pdev)
meson_mx_sdhc_disable_clks(host->mmc);
clk_disable_unprepare(host->pclk);
-
- return 0;
}
static const struct meson_mx_sdhc_data meson_mx_sdhc_data_meson8 = {
@@ -925,7 +923,7 @@ MODULE_DEVICE_TABLE(of, meson_mx_sdhc_of_match);
static struct platform_driver meson_mx_sdhc_driver = {
.probe = meson_mx_sdhc_probe,
- .remove = meson_mx_sdhc_remove,
+ .remove_new = meson_mx_sdhc_remove,
.driver = {
.name = "meson-mx-sdhc",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 22/58] mmc: rtsx_usb_sdmmc: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (19 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 21/58] mmc: meson-mx-sdhc: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 23/58] mmc: mxs-mmc: " Yangtao Li
` (36 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/rtsx_usb_sdmmc.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c
index 2c650cd58693..ded9b6849e35 100644
--- a/drivers/mmc/host/rtsx_usb_sdmmc.c
+++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
@@ -1379,13 +1379,13 @@ static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)
return 0;
}
-static int rtsx_usb_sdmmc_drv_remove(struct platform_device *pdev)
+static void rtsx_usb_sdmmc_drv_remove(struct platform_device *pdev)
{
struct rtsx_usb_sdmmc *host = platform_get_drvdata(pdev);
struct mmc_host *mmc;
if (!host)
- return 0;
+ return;
mmc = host->mmc;
host->host_removal = true;
@@ -1415,8 +1415,6 @@ static int rtsx_usb_sdmmc_drv_remove(struct platform_device *pdev)
dev_dbg(&(pdev->dev),
": Realtek USB SD/MMC module has been removed\n");
-
- return 0;
}
#ifdef CONFIG_PM
@@ -1455,7 +1453,7 @@ MODULE_DEVICE_TABLE(platform, rtsx_usb_sdmmc_ids);
static struct platform_driver rtsx_usb_sdmmc_driver = {
.probe = rtsx_usb_sdmmc_drv_probe,
- .remove = rtsx_usb_sdmmc_drv_remove,
+ .remove_new = rtsx_usb_sdmmc_drv_remove,
.id_table = rtsx_usb_sdmmc_ids,
.driver = {
.name = "rtsx_usb_sdmmc",
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 23/58] mmc: mxs-mmc: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (20 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 22/58] mmc: rtsx_usb_sdmmc: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 24/58] mmc: sdhci_am654: " Yangtao Li
` (35 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
Fabio Estevam, NXP Linux Team
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/mxs-mmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index 8c3655d3be96..9abfb169464b 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -674,7 +674,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
return ret;
}
-static int mxs_mmc_remove(struct platform_device *pdev)
+static void mxs_mmc_remove(struct platform_device *pdev)
{
struct mmc_host *mmc = platform_get_drvdata(pdev);
struct mxs_mmc_host *host = mmc_priv(mmc);
@@ -688,8 +688,6 @@ static int mxs_mmc_remove(struct platform_device *pdev)
clk_disable_unprepare(ssp->clk);
mmc_free_host(mmc);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -717,7 +715,7 @@ static SIMPLE_DEV_PM_OPS(mxs_mmc_pm_ops, mxs_mmc_suspend, mxs_mmc_resume);
static struct platform_driver mxs_mmc_driver = {
.probe = mxs_mmc_probe,
- .remove = mxs_mmc_remove,
+ .remove_new = mxs_mmc_remove,
.driver = {
.name = DRIVER_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 24/58] mmc: sdhci_am654: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (21 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 23/58] mmc: mxs-mmc: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 9:08 ` Uwe Kleine-König
2023-07-13 8:07 ` [PATCH 25/58] mmc: uniphier-sd: " Yangtao Li
` (34 subsequent siblings)
57 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci_am654.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
index 7cdf0f54e3a5..3cfaf7dca274 100644
--- a/drivers/mmc/host/sdhci_am654.c
+++ b/drivers/mmc/host/sdhci_am654.c
@@ -866,7 +866,7 @@ static int sdhci_am654_probe(struct platform_device *pdev)
return ret;
}
-static int sdhci_am654_remove(struct platform_device *pdev)
+static void sdhci_am654_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -874,14 +874,13 @@ static int sdhci_am654_remove(struct platform_device *pdev)
ret = pm_runtime_resume_and_get(&pdev->dev);
if (ret < 0)
- return ret;
+ return;
sdhci_remove_host(host, true);
clk_disable_unprepare(pltfm_host->clk);
pm_runtime_disable(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
sdhci_pltfm_free(pdev);
- return 0;
}
#ifdef CONFIG_PM
@@ -993,7 +992,7 @@ static struct platform_driver sdhci_am654_driver = {
.of_match_table = sdhci_am654_of_match,
},
.probe = sdhci_am654_probe,
- .remove = sdhci_am654_remove,
+ .remove_new = sdhci_am654_remove,
};
module_platform_driver(sdhci_am654_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 24/58] mmc: sdhci_am654: Convert to platform remove callback returning void
2023-07-13 8:07 ` [PATCH 24/58] mmc: sdhci_am654: " Yangtao Li
@ 2023-07-13 9:08 ` Uwe Kleine-König
0 siblings, 0 replies; 80+ messages in thread
From: Uwe Kleine-König @ 2023-07-13 9:08 UTC (permalink / raw)
To: Yangtao Li; +Cc: Adrian Hunter, Ulf Hansson, linux-mmc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1996 bytes --]
On Thu, Jul 13, 2023 at 04:07:33PM +0800, Yangtao Li 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> drivers/mmc/host/sdhci_am654.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
> index 7cdf0f54e3a5..3cfaf7dca274 100644
> --- a/drivers/mmc/host/sdhci_am654.c
> +++ b/drivers/mmc/host/sdhci_am654.c
> @@ -866,7 +866,7 @@ static int sdhci_am654_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int sdhci_am654_remove(struct platform_device *pdev)
> +static void sdhci_am654_remove(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> @@ -874,14 +874,13 @@ static int sdhci_am654_remove(struct platform_device *pdev)
>
> ret = pm_runtime_resume_and_get(&pdev->dev);
> if (ret < 0)
> - return ret;
> + return;
This is changing semantics. You shouldn't ignore errors here. This is
one of the cases where a driver leaks resources. You need something like
22f407278ea43df46f90cece6595e5e8a0d5447c here.
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] 80+ messages in thread
* [PATCH 25/58] mmc: uniphier-sd: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (22 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 24/58] mmc: sdhci_am654: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 9:09 ` Uwe Kleine-König
2023-07-13 8:07 ` [PATCH 26/58] mmc: f-sdh30: " Yangtao Li
` (33 subsequent siblings)
57 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson, Kunihiko Hayashi, Masami Hiramatsu
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/uniphier-sd.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/uniphier-sd.c b/drivers/mmc/host/uniphier-sd.c
index 61acd69fac0e..33a4d1c6ef04 100644
--- a/drivers/mmc/host/uniphier-sd.c
+++ b/drivers/mmc/host/uniphier-sd.c
@@ -727,15 +727,13 @@ static int uniphier_sd_probe(struct platform_device *pdev)
return ret;
}
-static int uniphier_sd_remove(struct platform_device *pdev)
+static void uniphier_sd_remove(struct platform_device *pdev)
{
struct tmio_mmc_host *host = platform_get_drvdata(pdev);
tmio_mmc_host_remove(host);
uniphier_sd_clk_disable(host);
tmio_mmc_host_free(host);
-
- return 0;
}
static const struct of_device_id uniphier_sd_match[] = {
@@ -757,7 +755,7 @@ MODULE_DEVICE_TABLE(of, uniphier_sd_match);
static struct platform_driver uniphier_sd_driver = {
.probe = uniphier_sd_probe,
- .remove = uniphier_sd_remove,
+ .remove_new = uniphier_sd_remove,
.driver = {
.name = "uniphier-sd",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 25/58] mmc: uniphier-sd: Convert to platform remove callback returning void
2023-07-13 8:07 ` [PATCH 25/58] mmc: uniphier-sd: " Yangtao Li
@ 2023-07-13 9:09 ` Uwe Kleine-König
0 siblings, 0 replies; 80+ messages in thread
From: Uwe Kleine-König @ 2023-07-13 9:09 UTC (permalink / raw)
To: Yangtao Li
Cc: Ulf Hansson, Kunihiko Hayashi, Masami Hiramatsu, linux-mmc,
linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 333 bytes --]
Hello,
$Subject ~= s/ / /
(maybe that's fixed automatically if picked up by git-am, but I'm not
sure and didn't test.)
Otherwise looks fine.
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] 80+ messages in thread
* [PATCH 26/58] mmc: f-sdh30: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (23 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 25/58] mmc: uniphier-sd: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 9:12 ` Uwe Kleine-König
2023-07-14 7:51 ` Adrian Hunter
2023-07-13 8:07 ` [PATCH 27/58] mmc: sdhci-of-arasan: " Yangtao Li
` (32 subsequent siblings)
57 siblings, 2 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci_f_sdh30.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci_f_sdh30.c b/drivers/mmc/host/sdhci_f_sdh30.c
index a202a69a4b08..6016e183c03c 100644
--- a/drivers/mmc/host/sdhci_f_sdh30.c
+++ b/drivers/mmc/host/sdhci_f_sdh30.c
@@ -208,7 +208,7 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)
return ret;
}
-static int sdhci_f_sdh30_remove(struct platform_device *pdev)
+static void sdhci_f_sdh30_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct f_sdhost_priv *priv = sdhci_priv(host);
@@ -222,8 +222,6 @@ static int sdhci_f_sdh30_remove(struct platform_device *pdev)
sdhci_free_host(host);
platform_set_drvdata(pdev, NULL);
-
- return 0;
}
#ifdef CONFIG_OF
@@ -252,7 +250,7 @@ static struct platform_driver sdhci_f_sdh30_driver = {
.pm = &sdhci_pltfm_pmops,
},
.probe = sdhci_f_sdh30_probe,
- .remove = sdhci_f_sdh30_remove,
+ .remove_new = sdhci_f_sdh30_remove,
};
module_platform_driver(sdhci_f_sdh30_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 26/58] mmc: f-sdh30: Convert to platform remove callback returning void
2023-07-13 8:07 ` [PATCH 26/58] mmc: f-sdh30: " Yangtao Li
@ 2023-07-13 9:12 ` Uwe Kleine-König
2023-07-14 7:51 ` Adrian Hunter
1 sibling, 0 replies; 80+ messages in thread
From: Uwe Kleine-König @ 2023-07-13 9:12 UTC (permalink / raw)
To: Yangtao Li; +Cc: Adrian Hunter, Ulf Hansson, linux-mmc, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2342 bytes --]
On Thu, Jul 13, 2023 at 04:07:35PM +0800, Yangtao Li 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> drivers/mmc/host/sdhci_f_sdh30.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci_f_sdh30.c b/drivers/mmc/host/sdhci_f_sdh30.c
> index a202a69a4b08..6016e183c03c 100644
> --- a/drivers/mmc/host/sdhci_f_sdh30.c
> +++ b/drivers/mmc/host/sdhci_f_sdh30.c
> @@ -208,7 +208,7 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int sdhci_f_sdh30_remove(struct platform_device *pdev)
> +static void sdhci_f_sdh30_remove(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct f_sdhost_priv *priv = sdhci_priv(host);
> @@ -222,8 +222,6 @@ static int sdhci_f_sdh30_remove(struct platform_device *pdev)
>
> sdhci_free_host(host);
> platform_set_drvdata(pdev, NULL);
> -
> - return 0;
> }
>
> #ifdef CONFIG_OF
> @@ -252,7 +250,7 @@ static struct platform_driver sdhci_f_sdh30_driver = {
> .pm = &sdhci_pltfm_pmops,
> },
> .probe = sdhci_f_sdh30_probe,
> - .remove = sdhci_f_sdh30_remove,
> + .remove_new = sdhci_f_sdh30_remove,
Given that the alignment of =s in sdhci_f_sdh30_driver is very
inconsistent, you might want to consider to do s/\t/ / in it for the two
remaining offenders while touching this anyhow.
With or without that adapted:
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
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] 80+ messages in thread* Re: [PATCH 26/58] mmc: f-sdh30: Convert to platform remove callback returning void
2023-07-13 8:07 ` [PATCH 26/58] mmc: f-sdh30: " Yangtao Li
2023-07-13 9:12 ` Uwe Kleine-König
@ 2023-07-14 7:51 ` Adrian Hunter
1 sibling, 0 replies; 80+ messages in thread
From: Adrian Hunter @ 2023-07-14 7:51 UTC (permalink / raw)
To: Yangtao Li, Ulf Hansson; +Cc: Uwe Kleine-König, linux-mmc, linux-kernel
On 13/07/23 11:07, Yangtao Li 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
Doesn't apply anymore. You can check against the "next" branch in:
git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git
> ---
> drivers/mmc/host/sdhci_f_sdh30.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci_f_sdh30.c b/drivers/mmc/host/sdhci_f_sdh30.c
> index a202a69a4b08..6016e183c03c 100644
> --- a/drivers/mmc/host/sdhci_f_sdh30.c
> +++ b/drivers/mmc/host/sdhci_f_sdh30.c
> @@ -208,7 +208,7 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int sdhci_f_sdh30_remove(struct platform_device *pdev)
> +static void sdhci_f_sdh30_remove(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct f_sdhost_priv *priv = sdhci_priv(host);
> @@ -222,8 +222,6 @@ static int sdhci_f_sdh30_remove(struct platform_device *pdev)
>
> sdhci_free_host(host);
> platform_set_drvdata(pdev, NULL);
> -
> - return 0;
> }
>
> #ifdef CONFIG_OF
> @@ -252,7 +250,7 @@ static struct platform_driver sdhci_f_sdh30_driver = {
> .pm = &sdhci_pltfm_pmops,
> },
> .probe = sdhci_f_sdh30_probe,
> - .remove = sdhci_f_sdh30_remove,
> + .remove_new = sdhci_f_sdh30_remove,
> };
>
> module_platform_driver(sdhci_f_sdh30_driver);
^ permalink raw reply [flat|nested] 80+ messages in thread
* [PATCH 27/58] mmc: sdhci-of-arasan: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (24 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 26/58] mmc: f-sdh30: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 28/58] mmc: sdhci-of-dwcmshc: " Yangtao Li
` (31 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Michal Simek, Adrian Hunter, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-arm-kernel, linux-mmc,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-of-arasan.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 294dd605fd2b..160bab0c437c 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -2016,7 +2016,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
return ret;
}
-static int sdhci_arasan_remove(struct platform_device *pdev)
+static void sdhci_arasan_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -2034,8 +2034,6 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
sdhci_pltfm_unregister(pdev);
clk_disable_unprepare(clk_ahb);
-
- return 0;
}
static struct platform_driver sdhci_arasan_driver = {
@@ -2046,7 +2044,7 @@ static struct platform_driver sdhci_arasan_driver = {
.pm = &sdhci_arasan_dev_pm_ops,
},
.probe = sdhci_arasan_probe,
- .remove = sdhci_arasan_remove,
+ .remove_new = sdhci_arasan_remove,
};
module_platform_driver(sdhci_arasan_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 28/58] mmc: sdhci-of-dwcmshc: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (25 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 27/58] mmc: sdhci-of-arasan: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 29/58] mmc: au1xmmc: " Yangtao Li
` (30 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-of-dwcmshc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
index e68cd87998c8..5cfd24cd33fc 100644
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -574,7 +574,7 @@ static int dwcmshc_probe(struct platform_device *pdev)
return err;
}
-static int dwcmshc_remove(struct platform_device *pdev)
+static void dwcmshc_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -589,8 +589,6 @@ static int dwcmshc_remove(struct platform_device *pdev)
clk_bulk_disable_unprepare(RK35xx_MAX_CLKS,
rk_priv->rockchip_clks);
sdhci_pltfm_free(pdev);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -657,7 +655,7 @@ static struct platform_driver sdhci_dwcmshc_driver = {
.pm = &dwcmshc_pmops,
},
.probe = dwcmshc_probe,
- .remove = dwcmshc_remove,
+ .remove_new = dwcmshc_remove,
};
module_platform_driver(sdhci_dwcmshc_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 29/58] mmc: au1xmmc: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (26 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 28/58] mmc: sdhci-of-dwcmshc: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 30/58] mmc: cavium-octeon: " Yangtao Li
` (29 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Manuel Lauss, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/au1xmmc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index 82dd0ae40305..b5a5c6a2fe8b 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -1114,7 +1114,7 @@ static int au1xmmc_probe(struct platform_device *pdev)
return ret;
}
-static int au1xmmc_remove(struct platform_device *pdev)
+static void au1xmmc_remove(struct platform_device *pdev)
{
struct au1xmmc_host *host = platform_get_drvdata(pdev);
@@ -1153,7 +1153,6 @@ static int au1xmmc_remove(struct platform_device *pdev)
mmc_free_host(host->mmc);
}
- return 0;
}
#ifdef CONFIG_PM
@@ -1185,7 +1184,7 @@ static int au1xmmc_resume(struct platform_device *pdev)
static struct platform_driver au1xmmc_driver = {
.probe = au1xmmc_probe,
- .remove = au1xmmc_remove,
+ .remove_new = au1xmmc_remove,
.suspend = au1xmmc_suspend,
.resume = au1xmmc_resume,
.driver = {
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 30/58] mmc: cavium-octeon: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (27 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 29/58] mmc: au1xmmc: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 31/58] mmc: pxamci: " Yangtao Li
` (28 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Robert Richter, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/cavium-octeon.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/cavium-octeon.c b/drivers/mmc/host/cavium-octeon.c
index 12dca91a8ef6..d526868b30f6 100644
--- a/drivers/mmc/host/cavium-octeon.c
+++ b/drivers/mmc/host/cavium-octeon.c
@@ -294,7 +294,7 @@ static int octeon_mmc_probe(struct platform_device *pdev)
return ret;
}
-static int octeon_mmc_remove(struct platform_device *pdev)
+static void octeon_mmc_remove(struct platform_device *pdev)
{
struct cvm_mmc_host *host = platform_get_drvdata(pdev);
u64 dma_cfg;
@@ -309,7 +309,6 @@ static int octeon_mmc_remove(struct platform_device *pdev)
writeq(dma_cfg, host->dma_base + MIO_EMM_DMA_CFG(host));
octeon_mmc_set_shared_power(host, 0);
- return 0;
}
static const struct of_device_id octeon_mmc_match[] = {
@@ -325,7 +324,7 @@ MODULE_DEVICE_TABLE(of, octeon_mmc_match);
static struct platform_driver octeon_mmc_driver = {
.probe = octeon_mmc_probe,
- .remove = octeon_mmc_remove,
+ .remove_new = octeon_mmc_remove,
.driver = {
.name = KBUILD_MODNAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 31/58] mmc: pxamci: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (28 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 30/58] mmc: cavium-octeon: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 32/58] mmc: moxart: " Yangtao Li
` (27 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/pxamci.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index 2a988f942b6c..af17df545582 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -784,7 +784,7 @@ static int pxamci_probe(struct platform_device *pdev)
return ret;
}
-static int pxamci_remove(struct platform_device *pdev)
+static void pxamci_remove(struct platform_device *pdev)
{
struct mmc_host *mmc = platform_get_drvdata(pdev);
@@ -808,13 +808,11 @@ static int pxamci_remove(struct platform_device *pdev)
mmc_free_host(mmc);
}
-
- return 0;
}
static struct platform_driver pxamci_driver = {
.probe = pxamci_probe,
- .remove = pxamci_remove,
+ .remove_new = pxamci_remove,
.driver = {
.name = DRIVER_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 32/58] mmc: moxart: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (29 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 31/58] mmc: pxamci: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 33/58] mmc: sdhci-omap: " Yangtao Li
` (26 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/moxart-mmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c
index 2d002c81dcf3..7d35476c9ef4 100644
--- a/drivers/mmc/host/moxart-mmc.c
+++ b/drivers/mmc/host/moxart-mmc.c
@@ -693,7 +693,7 @@ static int moxart_probe(struct platform_device *pdev)
return ret;
}
-static int moxart_remove(struct platform_device *pdev)
+static void moxart_remove(struct platform_device *pdev)
{
struct mmc_host *mmc = dev_get_drvdata(&pdev->dev);
struct moxart_host *host = mmc_priv(mmc);
@@ -711,8 +711,6 @@ static int moxart_remove(struct platform_device *pdev)
writel(readl(host->base + REG_CLOCK_CONTROL) | CLK_OFF,
host->base + REG_CLOCK_CONTROL);
mmc_free_host(mmc);
-
- return 0;
}
static const struct of_device_id moxart_mmc_match[] = {
@@ -724,7 +722,7 @@ MODULE_DEVICE_TABLE(of, moxart_mmc_match);
static struct platform_driver moxart_mmc_driver = {
.probe = moxart_probe,
- .remove = moxart_remove,
+ .remove_new = moxart_remove,
.driver = {
.name = "mmc-moxart",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 33/58] mmc: sdhci-omap: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (30 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 32/58] mmc: moxart: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 34/58] mmc: sdhci-of-aspeed: " Yangtao Li
` (25 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Adrian Hunter, Vignesh Raghavendra, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-omap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
index 8ed9256b83da..6aa77eb4a3fb 100644
--- a/drivers/mmc/host/sdhci-omap.c
+++ b/drivers/mmc/host/sdhci-omap.c
@@ -1394,7 +1394,7 @@ static int sdhci_omap_probe(struct platform_device *pdev)
return ret;
}
-static int sdhci_omap_remove(struct platform_device *pdev)
+static void sdhci_omap_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct sdhci_host *host = platform_get_drvdata(pdev);
@@ -1408,8 +1408,6 @@ static int sdhci_omap_remove(struct platform_device *pdev)
/* Ensure device gets disabled despite userspace sysfs config */
pm_runtime_force_suspend(dev);
sdhci_pltfm_free(pdev);
-
- return 0;
}
#ifdef CONFIG_PM
@@ -1478,7 +1476,7 @@ static const struct dev_pm_ops sdhci_omap_dev_pm_ops = {
static struct platform_driver sdhci_omap_driver = {
.probe = sdhci_omap_probe,
- .remove = sdhci_omap_remove,
+ .remove_new = sdhci_omap_remove,
.driver = {
.name = "sdhci-omap",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 34/58] mmc: sdhci-of-aspeed: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (31 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 33/58] mmc: sdhci-omap: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 9:13 ` Uwe Kleine-König
2023-07-13 8:07 ` [PATCH 35/58] mmc: meson-mx-sdio: " Yangtao Li
` (24 subsequent siblings)
57 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Andrew Jeffery, Adrian Hunter, Ulf Hansson, Joel Stanley
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-aspeed,
openbmc, linux-arm-kernel, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-of-aspeed.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index 25b4073f698b..42d54532cabe 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -450,22 +450,19 @@ static int aspeed_sdhci_probe(struct platform_device *pdev)
return ret;
}
-static int aspeed_sdhci_remove(struct platform_device *pdev)
+static void aspeed_sdhci_remove(struct platform_device *pdev)
{
struct sdhci_pltfm_host *pltfm_host;
struct sdhci_host *host;
- int dead = 0;
host = platform_get_drvdata(pdev);
pltfm_host = sdhci_priv(host);
- sdhci_remove_host(host, dead);
+ sdhci_remove_host(host, 0);
clk_disable_unprepare(pltfm_host->clk);
sdhci_pltfm_free(pdev);
-
- return 0;
}
static const struct aspeed_sdhci_pdata ast2400_sdhci_pdata = {
@@ -521,7 +518,7 @@ static struct platform_driver aspeed_sdhci_driver = {
.of_match_table = aspeed_sdhci_of_match,
},
.probe = aspeed_sdhci_probe,
- .remove = aspeed_sdhci_remove,
+ .remove_new = aspeed_sdhci_remove,
};
static int aspeed_sdc_probe(struct platform_device *pdev)
@@ -574,13 +571,11 @@ static int aspeed_sdc_probe(struct platform_device *pdev)
return ret;
}
-static int aspeed_sdc_remove(struct platform_device *pdev)
+static void aspeed_sdc_remove(struct platform_device *pdev)
{
struct aspeed_sdc *sdc = dev_get_drvdata(&pdev->dev);
clk_disable_unprepare(sdc->clk);
-
- return 0;
}
static const struct of_device_id aspeed_sdc_of_match[] = {
@@ -600,7 +595,7 @@ static struct platform_driver aspeed_sdc_driver = {
.of_match_table = aspeed_sdc_of_match,
},
.probe = aspeed_sdc_probe,
- .remove = aspeed_sdc_remove,
+ .remove_new = aspeed_sdc_remove,
};
#if defined(CONFIG_MMC_SDHCI_OF_ASPEED_TEST)
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 34/58] mmc: sdhci-of-aspeed: Convert to platform remove callback returning void
2023-07-13 8:07 ` [PATCH 34/58] mmc: sdhci-of-aspeed: " Yangtao Li
@ 2023-07-13 9:13 ` Uwe Kleine-König
0 siblings, 0 replies; 80+ messages in thread
From: Uwe Kleine-König @ 2023-07-13 9:13 UTC (permalink / raw)
To: Yangtao Li
Cc: Andrew Jeffery, Adrian Hunter, Ulf Hansson, Joel Stanley,
linux-mmc, linux-aspeed, openbmc, linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1868 bytes --]
On Thu, Jul 13, 2023 at 04:07:43PM +0800, Yangtao Li 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> drivers/mmc/host/sdhci-of-aspeed.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
> index 25b4073f698b..42d54532cabe 100644
> --- a/drivers/mmc/host/sdhci-of-aspeed.c
> +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> @@ -450,22 +450,19 @@ static int aspeed_sdhci_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int aspeed_sdhci_remove(struct platform_device *pdev)
> +static void aspeed_sdhci_remove(struct platform_device *pdev)
> {
> struct sdhci_pltfm_host *pltfm_host;
> struct sdhci_host *host;
> - int dead = 0;
>
> host = platform_get_drvdata(pdev);
> pltfm_host = sdhci_priv(host);
>
> - sdhci_remove_host(host, dead);
> + sdhci_remove_host(host, 0);
Please mention additional cleanups in the commit log (or split them into
separate patches).
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] 80+ messages in thread
* [PATCH 35/58] mmc: meson-mx-sdio: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (32 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 34/58] mmc: sdhci-of-aspeed: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 36/58] mmc: sdhci-sprd: " Yangtao Li
` (23 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-amlogic, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/meson-mx-sdio.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/meson-mx-sdio.c b/drivers/mmc/host/meson-mx-sdio.c
index 3a19a05ef55a..a11577f2ee69 100644
--- a/drivers/mmc/host/meson-mx-sdio.c
+++ b/drivers/mmc/host/meson-mx-sdio.c
@@ -728,7 +728,7 @@ static int meson_mx_mmc_probe(struct platform_device *pdev)
return ret;
}
-static int meson_mx_mmc_remove(struct platform_device *pdev)
+static void meson_mx_mmc_remove(struct platform_device *pdev)
{
struct meson_mx_mmc_host *host = platform_get_drvdata(pdev);
struct device *slot_dev = mmc_dev(host->mmc);
@@ -743,8 +743,6 @@ static int meson_mx_mmc_remove(struct platform_device *pdev)
clk_disable_unprepare(host->core_clk);
mmc_free_host(host->mmc);
-
- return 0;
}
static const struct of_device_id meson_mx_mmc_of_match[] = {
@@ -756,7 +754,7 @@ MODULE_DEVICE_TABLE(of, meson_mx_mmc_of_match);
static struct platform_driver meson_mx_mmc_driver = {
.probe = meson_mx_mmc_probe,
- .remove = meson_mx_mmc_remove,
+ .remove_new = meson_mx_mmc_remove,
.driver = {
.name = "meson-mx-sdio",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 36/58] mmc: sdhci-sprd: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (33 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 35/58] mmc: meson-mx-sdio: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 37/58] mmc: sdhci-tegra: " Yangtao Li
` (22 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson, Orson Zhai, Baolin Wang,
Chunyan Zhang
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-sprd.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c
index 7f4ee2e12735..379cb3892757 100644
--- a/drivers/mmc/host/sdhci-sprd.c
+++ b/drivers/mmc/host/sdhci-sprd.c
@@ -720,7 +720,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
return ret;
}
-static int sdhci_sprd_remove(struct platform_device *pdev)
+static void sdhci_sprd_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_sprd_host *sprd_host = TO_SPRD_HOST(host);
@@ -732,8 +732,6 @@ static int sdhci_sprd_remove(struct platform_device *pdev)
clk_disable_unprepare(sprd_host->clk_2x_enable);
sdhci_pltfm_free(pdev);
-
- return 0;
}
static const struct of_device_id sdhci_sprd_of_match[] = {
@@ -800,7 +798,7 @@ static const struct dev_pm_ops sdhci_sprd_pm_ops = {
static struct platform_driver sdhci_sprd_driver = {
.probe = sdhci_sprd_probe,
- .remove = sdhci_sprd_remove,
+ .remove_new = sdhci_sprd_remove,
.driver = {
.name = "sdhci_sprd_r11",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 37/58] mmc: sdhci-tegra: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (34 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 36/58] mmc: sdhci-sprd: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 38/58] mmc: sdhci-acpi: " Yangtao Li
` (21 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson, Thierry Reding, Jonathan Hunter
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-tegra,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-tegra.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index bff084f178c9..6a50413afc8d 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -1818,7 +1818,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
return rc;
}
-static int sdhci_tegra_remove(struct platform_device *pdev)
+static void sdhci_tegra_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -1834,8 +1834,6 @@ static int sdhci_tegra_remove(struct platform_device *pdev)
clk_disable_unprepare(tegra_host->tmclk);
sdhci_pltfm_free(pdev);
-
- return 0;
}
static int __maybe_unused sdhci_tegra_runtime_suspend(struct device *dev)
@@ -1933,7 +1931,7 @@ static struct platform_driver sdhci_tegra_driver = {
.pm = &sdhci_tegra_dev_pm_ops,
},
.probe = sdhci_tegra_probe,
- .remove = sdhci_tegra_remove,
+ .remove_new = sdhci_tegra_remove,
};
module_platform_driver(sdhci_tegra_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 38/58] mmc: sdhci-acpi: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (35 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 37/58] mmc: sdhci-tegra: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 39/58] mmc: sdhci-esdhc-imx: " Yangtao Li
` (20 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-acpi.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index edf2e6c14dc6..acf5fc3ad7e4 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -917,7 +917,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
return err;
}
-static int sdhci_acpi_remove(struct platform_device *pdev)
+static void sdhci_acpi_remove(struct platform_device *pdev)
{
struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
struct device *dev = &pdev->dev;
@@ -939,8 +939,6 @@ static int sdhci_acpi_remove(struct platform_device *pdev)
c->slot->free_slot(pdev);
sdhci_free_host(c->host);
-
- return 0;
}
static void __maybe_unused sdhci_acpi_reset_signal_voltage_if_needed(
@@ -1033,7 +1031,7 @@ static struct platform_driver sdhci_acpi_driver = {
.pm = &sdhci_acpi_pm_ops,
},
.probe = sdhci_acpi_probe,
- .remove = sdhci_acpi_remove,
+ .remove_new = sdhci_acpi_remove,
};
module_platform_driver(sdhci_acpi_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 39/58] mmc: sdhci-esdhc-imx: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (36 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 38/58] mmc: sdhci-acpi: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 40/58] mmc: sdhci-msm: " Yangtao Li
` (19 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Adrian Hunter, Haibo Chen, Ulf Hansson, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-esdhc-imx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index eebf94604a7f..e882067366da 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1802,7 +1802,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
return err;
}
-static int sdhci_esdhc_imx_remove(struct platform_device *pdev)
+static void sdhci_esdhc_imx_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -1824,8 +1824,6 @@ static int sdhci_esdhc_imx_remove(struct platform_device *pdev)
cpu_latency_qos_remove_request(&imx_data->pm_qos_req);
sdhci_pltfm_free(pdev);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -1986,7 +1984,7 @@ static struct platform_driver sdhci_esdhc_imx_driver = {
.pm = &sdhci_esdhc_pmops,
},
.probe = sdhci_esdhc_imx_probe,
- .remove = sdhci_esdhc_imx_remove,
+ .remove_new = sdhci_esdhc_imx_remove,
};
module_platform_driver(sdhci_esdhc_imx_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 40/58] mmc: sdhci-msm: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (37 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 39/58] mmc: sdhci-esdhc-imx: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:44 ` Konrad Dybcio
2023-07-13 8:07 ` [PATCH 41/58] mmc: alcor: " Yangtao Li
` (18 subsequent siblings)
57 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Adrian Hunter,
Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-arm-msm, linux-mmc,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-msm.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 1c935b5bafe1..80e376802ee0 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -2668,7 +2668,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
return ret;
}
-static int sdhci_msm_remove(struct platform_device *pdev)
+static void sdhci_msm_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -2687,7 +2687,6 @@ static int sdhci_msm_remove(struct platform_device *pdev)
if (!IS_ERR(msm_host->bus_clk))
clk_disable_unprepare(msm_host->bus_clk);
sdhci_pltfm_free(pdev);
- return 0;
}
static __maybe_unused int sdhci_msm_runtime_suspend(struct device *dev)
@@ -2740,7 +2739,7 @@ static const struct dev_pm_ops sdhci_msm_pm_ops = {
static struct platform_driver sdhci_msm_driver = {
.probe = sdhci_msm_probe,
- .remove = sdhci_msm_remove,
+ .remove_new = sdhci_msm_remove,
.driver = {
.name = "sdhci_msm",
.of_match_table = sdhci_msm_dt_match,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 40/58] mmc: sdhci-msm: Convert to platform remove callback returning void
2023-07-13 8:07 ` [PATCH 40/58] mmc: sdhci-msm: " Yangtao Li
@ 2023-07-13 8:44 ` Konrad Dybcio
0 siblings, 0 replies; 80+ messages in thread
From: Konrad Dybcio @ 2023-07-13 8:44 UTC (permalink / raw)
To: Yangtao Li, Andy Gross, Bjorn Andersson, Adrian Hunter,
Ulf Hansson
Cc: Uwe Kleine-König, linux-arm-msm, linux-mmc, linux-kernel
On 13.07.2023 10:07, Yangtao Li 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Konrad
> drivers/mmc/host/sdhci-msm.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index 1c935b5bafe1..80e376802ee0 100644
> --- a/drivers/mmc/host/sdhci-msm.c
> +++ b/drivers/mmc/host/sdhci-msm.c
> @@ -2668,7 +2668,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int sdhci_msm_remove(struct platform_device *pdev)
> +static void sdhci_msm_remove(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> @@ -2687,7 +2687,6 @@ static int sdhci_msm_remove(struct platform_device *pdev)
> if (!IS_ERR(msm_host->bus_clk))
> clk_disable_unprepare(msm_host->bus_clk);
> sdhci_pltfm_free(pdev);
> - return 0;
> }
>
> static __maybe_unused int sdhci_msm_runtime_suspend(struct device *dev)
> @@ -2740,7 +2739,7 @@ static const struct dev_pm_ops sdhci_msm_pm_ops = {
>
> static struct platform_driver sdhci_msm_driver = {
> .probe = sdhci_msm_probe,
> - .remove = sdhci_msm_remove,
> + .remove_new = sdhci_msm_remove,
> .driver = {
> .name = "sdhci_msm",
> .of_match_table = sdhci_msm_dt_match,
^ permalink raw reply [flat|nested] 80+ messages in thread
* [PATCH 41/58] mmc: alcor: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (38 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 40/58] mmc: sdhci-msm: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 42/58] mmc: dw_mmc: rockchip: " Yangtao Li
` (17 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/alcor.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/alcor.c b/drivers/mmc/host/alcor.c
index d01df01d4b4d..42aa43740ba8 100644
--- a/drivers/mmc/host/alcor.c
+++ b/drivers/mmc/host/alcor.c
@@ -1125,7 +1125,7 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
return ret;
}
-static int alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
+static void alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
{
struct alcor_sdmmc_host *host = dev_get_drvdata(&pdev->dev);
struct mmc_host *mmc = mmc_from_priv(host);
@@ -1136,8 +1136,6 @@ static int alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
alcor_hw_uninit(host);
mmc_remove_host(mmc);
mmc_free_host(mmc);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -1177,7 +1175,7 @@ MODULE_DEVICE_TABLE(platform, alcor_pci_sdmmc_ids);
static struct platform_driver alcor_pci_sdmmc_driver = {
.probe = alcor_pci_sdmmc_drv_probe,
- .remove = alcor_pci_sdmmc_drv_remove,
+ .remove_new = alcor_pci_sdmmc_drv_remove,
.id_table = alcor_pci_sdmmc_ids,
.driver = {
.name = DRV_NAME_ALCOR_PCI_SDMMC,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 42/58] mmc: dw_mmc: rockchip: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (39 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 41/58] mmc: alcor: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 43/58] mmc: owl: " Yangtao Li
` (16 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Jaehoon Chung, Ulf Hansson, Heiko Stuebner
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-rockchip, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/dw_mmc-rockchip.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
index 2a99f15f527f..b07190ba4b7a 100644
--- a/drivers/mmc/host/dw_mmc-rockchip.c
+++ b/drivers/mmc/host/dw_mmc-rockchip.c
@@ -371,15 +371,13 @@ static int dw_mci_rockchip_probe(struct platform_device *pdev)
return 0;
}
-static int dw_mci_rockchip_remove(struct platform_device *pdev)
+static void dw_mci_rockchip_remove(struct platform_device *pdev)
{
pm_runtime_get_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
dw_mci_pltfm_remove(pdev);
-
- return 0;
}
static const struct dev_pm_ops dw_mci_rockchip_dev_pm_ops = {
@@ -392,7 +390,7 @@ static const struct dev_pm_ops dw_mci_rockchip_dev_pm_ops = {
static struct platform_driver dw_mci_rockchip_pltfm_driver = {
.probe = dw_mci_rockchip_probe,
- .remove = dw_mci_rockchip_remove,
+ .remove_new = dw_mci_rockchip_remove,
.driver = {
.name = "dwmmc_rockchip",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 43/58] mmc: owl: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (40 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 42/58] mmc: dw_mmc: rockchip: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 44/58] mmc: wbsd: " Yangtao Li
` (15 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson, Andreas Färber, Manivannan Sadhasivam
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-actions, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/owl-mmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/owl-mmc.c b/drivers/mmc/host/owl-mmc.c
index 1bf22b08b373..a13bec42554a 100644
--- a/drivers/mmc/host/owl-mmc.c
+++ b/drivers/mmc/host/owl-mmc.c
@@ -667,7 +667,7 @@ static int owl_mmc_probe(struct platform_device *pdev)
return ret;
}
-static int owl_mmc_remove(struct platform_device *pdev)
+static void owl_mmc_remove(struct platform_device *pdev)
{
struct mmc_host *mmc = platform_get_drvdata(pdev);
struct owl_mmc_host *owl_host = mmc_priv(mmc);
@@ -676,8 +676,6 @@ static int owl_mmc_remove(struct platform_device *pdev)
disable_irq(owl_host->irq);
dma_release_channel(owl_host->dma);
mmc_free_host(mmc);
-
- return 0;
}
static const struct of_device_id owl_mmc_of_match[] = {
@@ -693,7 +691,7 @@ static struct platform_driver owl_mmc_driver = {
.of_match_table = owl_mmc_of_match,
},
.probe = owl_mmc_probe,
- .remove = owl_mmc_remove,
+ .remove_new = owl_mmc_remove,
};
module_platform_driver(owl_mmc_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 44/58] mmc: wbsd: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (41 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 43/58] mmc: owl: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 45/58] mmc: usdhi60rol0: " Yangtao Li
` (14 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Pierre Ossman, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/wbsd.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c
index 521af9251f33..f361cefcee01 100644
--- a/drivers/mmc/host/wbsd.c
+++ b/drivers/mmc/host/wbsd.c
@@ -1758,11 +1758,9 @@ static int wbsd_probe(struct platform_device *dev)
return wbsd_init(&dev->dev, param_io, param_irq, param_dma, 0);
}
-static int wbsd_remove(struct platform_device *dev)
+static void wbsd_remove(struct platform_device *dev)
{
wbsd_shutdown(&dev->dev, 0);
-
- return 0;
}
/*
@@ -1904,8 +1902,7 @@ static struct platform_device *wbsd_device;
static struct platform_driver wbsd_driver = {
.probe = wbsd_probe,
- .remove = wbsd_remove,
-
+ .remove_new = wbsd_remove,
.suspend = wbsd_platform_suspend,
.resume = wbsd_platform_resume,
.driver = {
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 45/58] mmc: usdhi60rol0: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (42 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 44/58] mmc: wbsd: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 11:44 ` Jesper Nilsson
2023-07-13 8:07 ` [PATCH 46/58] mmc: atmel-mci: " Yangtao Li
` (13 subsequent siblings)
57 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Jesper Nilsson, Lars Persson, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-arm-kernel, linux-mmc,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/usdhi6rol0.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c
index 2e17903658fc..6e421445d56c 100644
--- a/drivers/mmc/host/usdhi6rol0.c
+++ b/drivers/mmc/host/usdhi6rol0.c
@@ -1884,7 +1884,7 @@ static int usdhi6_probe(struct platform_device *pdev)
return ret;
}
-static int usdhi6_remove(struct platform_device *pdev)
+static void usdhi6_remove(struct platform_device *pdev)
{
struct usdhi6_host *host = platform_get_drvdata(pdev);
@@ -1895,13 +1895,11 @@ static int usdhi6_remove(struct platform_device *pdev)
usdhi6_dma_release(host);
clk_disable_unprepare(host->clk);
mmc_free_host(host->mmc);
-
- return 0;
}
static struct platform_driver usdhi6_driver = {
.probe = usdhi6_probe,
- .remove = usdhi6_remove,
+ .remove_new = usdhi6_remove,
.driver = {
.name = "usdhi6rol0",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 45/58] mmc: usdhi60rol0: Convert to platform remove callback returning void
2023-07-13 8:07 ` [PATCH 45/58] mmc: usdhi60rol0: " Yangtao Li
@ 2023-07-13 11:44 ` Jesper Nilsson
0 siblings, 0 replies; 80+ messages in thread
From: Jesper Nilsson @ 2023-07-13 11:44 UTC (permalink / raw)
To: Yangtao Li
Cc: Jesper Nilsson, Lars Persson, Ulf Hansson, Uwe Kleine-König,
linux-arm-kernel, linux-mmc, linux-kernel
On Thu, Jul 13, 2023 at 04:07:54PM +0800, Yangtao Li 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
/^JN - Jesper Nilsson
--
Jesper Nilsson -- jesper.nilsson@axis.com
^ permalink raw reply [flat|nested] 80+ messages in thread
* [PATCH 46/58] mmc: atmel-mci: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (43 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 45/58] mmc: usdhi60rol0: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 47/58] mmc: sdhci-st: " Yangtao Li
` (12 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ludovic Desroches, Ulf Hansson, Nicolas Ferre, Alexandre Belloni,
Claudiu Beznea
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/atmel-mci.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index dd18440a90c5..b4ae9aa939a5 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -2600,7 +2600,7 @@ static int atmci_probe(struct platform_device *pdev)
return ret;
}
-static int atmci_remove(struct platform_device *pdev)
+static void atmci_remove(struct platform_device *pdev)
{
struct atmel_mci *host = platform_get_drvdata(pdev);
unsigned int i;
@@ -2630,8 +2630,6 @@ static int atmci_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
-
- return 0;
}
#ifdef CONFIG_PM
@@ -2664,7 +2662,7 @@ static const struct dev_pm_ops atmci_dev_pm_ops = {
static struct platform_driver atmci_driver = {
.probe = atmci_probe,
- .remove = atmci_remove,
+ .remove_new = atmci_remove,
.driver = {
.name = "atmel_mci",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 47/58] mmc: sdhci-st: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (44 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 46/58] mmc: atmel-mci: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 48/58] mmc: wmt-sdmmc: " Yangtao Li
` (11 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Patrice Chotard, Adrian Hunter, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-st.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c
index 6415916fbd91..d955b5f4b7e9 100644
--- a/drivers/mmc/host/sdhci-st.c
+++ b/drivers/mmc/host/sdhci-st.c
@@ -434,7 +434,7 @@ static int sdhci_st_probe(struct platform_device *pdev)
return ret;
}
-static int sdhci_st_remove(struct platform_device *pdev)
+static void sdhci_st_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -446,8 +446,6 @@ static int sdhci_st_remove(struct platform_device *pdev)
clk_disable_unprepare(pdata->icnclk);
reset_control_assert(rstc);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -510,7 +508,7 @@ MODULE_DEVICE_TABLE(of, st_sdhci_match);
static struct platform_driver sdhci_st_driver = {
.probe = sdhci_st_probe,
- .remove = sdhci_st_remove,
+ .remove_new = sdhci_st_remove,
.driver = {
.name = "sdhci-st",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 48/58] mmc: wmt-sdmmc: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (45 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 47/58] mmc: sdhci-st: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:07 ` [PATCH 49/58] mmc: sdhci-esdhc-mcf: " Yangtao Li
` (10 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-arm-kernel, linux-mmc,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/wmt-sdmmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
index 68525d900046..74c475d071b7 100644
--- a/drivers/mmc/host/wmt-sdmmc.c
+++ b/drivers/mmc/host/wmt-sdmmc.c
@@ -880,7 +880,7 @@ static int wmt_mci_probe(struct platform_device *pdev)
return ret;
}
-static int wmt_mci_remove(struct platform_device *pdev)
+static void wmt_mci_remove(struct platform_device *pdev)
{
struct mmc_host *mmc;
struct wmt_mci_priv *priv;
@@ -918,8 +918,6 @@ static int wmt_mci_remove(struct platform_device *pdev)
mmc_free_host(mmc);
dev_info(&pdev->dev, "WMT MCI device removed\n");
-
- return 0;
}
#ifdef CONFIG_PM
@@ -989,7 +987,7 @@ static const struct dev_pm_ops wmt_mci_pm = {
static struct platform_driver wmt_mci_driver = {
.probe = wmt_mci_probe,
- .remove = wmt_mci_remove,
+ .remove_new = wmt_mci_remove,
.driver = {
.name = DRIVER_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 49/58] mmc: sdhci-esdhc-mcf: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (46 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 48/58] mmc: wmt-sdmmc: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-17 11:18 ` Angelo Dureghello
2023-07-13 8:07 ` [PATCH 50/58] mmc: sunplus-mmc: " Yangtao Li
` (9 subsequent siblings)
57 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Adrian Hunter, Angelo Dureghello, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-esdhc-mcf.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-esdhc-mcf.c b/drivers/mmc/host/sdhci-esdhc-mcf.c
index 05926bf5ecf9..a07f8333cd6b 100644
--- a/drivers/mmc/host/sdhci-esdhc-mcf.c
+++ b/drivers/mmc/host/sdhci-esdhc-mcf.c
@@ -489,7 +489,7 @@ static int sdhci_esdhc_mcf_probe(struct platform_device *pdev)
return err;
}
-static int sdhci_esdhc_mcf_remove(struct platform_device *pdev)
+static void sdhci_esdhc_mcf_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -502,8 +502,6 @@ static int sdhci_esdhc_mcf_remove(struct platform_device *pdev)
clk_disable_unprepare(mcf_data->clk_per);
sdhci_pltfm_free(pdev);
-
- return 0;
}
static struct platform_driver sdhci_esdhc_mcf_driver = {
@@ -512,7 +510,7 @@ static struct platform_driver sdhci_esdhc_mcf_driver = {
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = sdhci_esdhc_mcf_probe,
- .remove = sdhci_esdhc_mcf_remove,
+ .remove_new = sdhci_esdhc_mcf_remove,
};
module_platform_driver(sdhci_esdhc_mcf_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 49/58] mmc: sdhci-esdhc-mcf: Convert to platform remove callback returning void
2023-07-13 8:07 ` [PATCH 49/58] mmc: sdhci-esdhc-mcf: " Yangtao Li
@ 2023-07-17 11:18 ` Angelo Dureghello
0 siblings, 0 replies; 80+ messages in thread
From: Angelo Dureghello @ 2023-07-17 11:18 UTC (permalink / raw)
To: Yangtao Li
Cc: Adrian Hunter, Ulf Hansson, Uwe Kleine-König, linux-mmc,
linux-kernel
Hi Yangtao,
thanks,
Acked-by: Angelo Dureghello <angelo.dureghello@timesys.com>
On Thu, Jul 13, 2023 at 10:10 AM Yangtao Li <frank.li@vivo.com> 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> drivers/mmc/host/sdhci-esdhc-mcf.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-mcf.c b/drivers/mmc/host/sdhci-esdhc-mcf.c
> index 05926bf5ecf9..a07f8333cd6b 100644
> --- a/drivers/mmc/host/sdhci-esdhc-mcf.c
> +++ b/drivers/mmc/host/sdhci-esdhc-mcf.c
> @@ -489,7 +489,7 @@ static int sdhci_esdhc_mcf_probe(struct platform_device *pdev)
> return err;
> }
>
> -static int sdhci_esdhc_mcf_remove(struct platform_device *pdev)
> +static void sdhci_esdhc_mcf_remove(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> @@ -502,8 +502,6 @@ static int sdhci_esdhc_mcf_remove(struct platform_device *pdev)
> clk_disable_unprepare(mcf_data->clk_per);
>
> sdhci_pltfm_free(pdev);
> -
> - return 0;
> }
>
> static struct platform_driver sdhci_esdhc_mcf_driver = {
> @@ -512,7 +510,7 @@ static struct platform_driver sdhci_esdhc_mcf_driver = {
> .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> },
> .probe = sdhci_esdhc_mcf_probe,
> - .remove = sdhci_esdhc_mcf_remove,
> + .remove_new = sdhci_esdhc_mcf_remove,
> };
>
> module_platform_driver(sdhci_esdhc_mcf_driver);
> --
> 2.39.0
>
--
Angelo Dureghello
Timesys
e. angelo.dureghello@timesys.com
^ permalink raw reply [flat|nested] 80+ messages in thread
* [PATCH 50/58] mmc: sunplus-mmc: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (47 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 49/58] mmc: sdhci-esdhc-mcf: " Yangtao Li
@ 2023-07-13 8:07 ` Yangtao Li
2023-07-13 8:08 ` [PATCH 51/58] mmc: sdhci-spear: " Yangtao Li
` (8 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:07 UTC (permalink / raw)
To: Tony Huang, Li-hao Kuo, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sunplus-mmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sunplus-mmc.c b/drivers/mmc/host/sunplus-mmc.c
index db5e0dcdfa7f..a15371e98fd9 100644
--- a/drivers/mmc/host/sunplus-mmc.c
+++ b/drivers/mmc/host/sunplus-mmc.c
@@ -938,7 +938,7 @@ static int spmmc_drv_probe(struct platform_device *pdev)
return ret;
}
-static int spmmc_drv_remove(struct platform_device *dev)
+static void spmmc_drv_remove(struct platform_device *dev)
{
struct spmmc_host *host = platform_get_drvdata(dev);
@@ -949,8 +949,6 @@ static int spmmc_drv_remove(struct platform_device *dev)
pm_runtime_disable(&dev->dev);
platform_set_drvdata(dev, NULL);
mmc_free_host(host->mmc);
-
- return 0;
}
static int spmmc_pm_runtime_suspend(struct device *dev)
@@ -985,7 +983,7 @@ MODULE_DEVICE_TABLE(of, spmmc_of_table);
static struct platform_driver spmmc_driver = {
.probe = spmmc_drv_probe,
- .remove = spmmc_drv_remove,
+ .remove_new = spmmc_drv_remove,
.driver = {
.name = "spmmc",
.pm = pm_ptr(&spmmc_pm_ops),
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 51/58] mmc: sdhci-spear: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (48 preceding siblings ...)
2023-07-13 8:07 ` [PATCH 50/58] mmc: sunplus-mmc: " Yangtao Li
@ 2023-07-13 8:08 ` Yangtao Li
2023-07-13 8:24 ` Viresh Kumar
2023-07-13 8:08 ` [PATCH 52/58] mmc: mxcmmc: " Yangtao Li
` (7 subsequent siblings)
57 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:08 UTC (permalink / raw)
To: Viresh Kumar, Adrian Hunter, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-spear.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
index c79035727b20..ec6c7d8e3736 100644
--- a/drivers/mmc/host/sdhci-spear.c
+++ b/drivers/mmc/host/sdhci-spear.c
@@ -117,7 +117,7 @@ static int sdhci_probe(struct platform_device *pdev)
return ret;
}
-static int sdhci_remove(struct platform_device *pdev)
+static void sdhci_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct spear_sdhci *sdhci = sdhci_priv(host);
@@ -131,8 +131,6 @@ static int sdhci_remove(struct platform_device *pdev)
sdhci_remove_host(host, dead);
clk_disable_unprepare(sdhci->clk);
sdhci_free_host(host);
-
- return 0;
}
#ifdef CONFIG_PM_SLEEP
@@ -186,7 +184,7 @@ static struct platform_driver sdhci_driver = {
.of_match_table = of_match_ptr(sdhci_spear_id_table),
},
.probe = sdhci_probe,
- .remove = sdhci_remove,
+ .remove_new = sdhci_remove,
};
module_platform_driver(sdhci_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 51/58] mmc: sdhci-spear: Convert to platform remove callback returning void
2023-07-13 8:08 ` [PATCH 51/58] mmc: sdhci-spear: " Yangtao Li
@ 2023-07-13 8:24 ` Viresh Kumar
0 siblings, 0 replies; 80+ messages in thread
From: Viresh Kumar @ 2023-07-13 8:24 UTC (permalink / raw)
To: Yangtao Li
Cc: Viresh Kumar, Adrian Hunter, Ulf Hansson, Uwe Kleine-König,
linux-mmc, linux-kernel
On 13-07-23, 16:08, Yangtao Li 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> drivers/mmc/host/sdhci-spear.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
> index c79035727b20..ec6c7d8e3736 100644
> --- a/drivers/mmc/host/sdhci-spear.c
> +++ b/drivers/mmc/host/sdhci-spear.c
> @@ -117,7 +117,7 @@ static int sdhci_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int sdhci_remove(struct platform_device *pdev)
> +static void sdhci_remove(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct spear_sdhci *sdhci = sdhci_priv(host);
> @@ -131,8 +131,6 @@ static int sdhci_remove(struct platform_device *pdev)
> sdhci_remove_host(host, dead);
> clk_disable_unprepare(sdhci->clk);
> sdhci_free_host(host);
> -
> - return 0;
> }
>
> #ifdef CONFIG_PM_SLEEP
> @@ -186,7 +184,7 @@ static struct platform_driver sdhci_driver = {
> .of_match_table = of_match_ptr(sdhci_spear_id_table),
> },
> .probe = sdhci_probe,
> - .remove = sdhci_remove,
> + .remove_new = sdhci_remove,
> };
>
> module_platform_driver(sdhci_driver);
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 80+ messages in thread
* [PATCH 52/58] mmc: mxcmmc: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (49 preceding siblings ...)
2023-07-13 8:08 ` [PATCH 51/58] mmc: sdhci-spear: " Yangtao Li
@ 2023-07-13 8:08 ` Yangtao Li
2023-07-13 8:08 ` [PATCH 53/58] mmc: mvsdio: " Yangtao Li
` (6 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:08 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/mxcmmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index 668f865f3efb..c46276bc21cd 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -1164,7 +1164,7 @@ static int mxcmci_probe(struct platform_device *pdev)
return ret;
}
-static int mxcmci_remove(struct platform_device *pdev)
+static void mxcmci_remove(struct platform_device *pdev)
{
struct mmc_host *mmc = platform_get_drvdata(pdev);
struct mxcmci_host *host = mmc_priv(mmc);
@@ -1181,8 +1181,6 @@ static int mxcmci_remove(struct platform_device *pdev)
clk_disable_unprepare(host->clk_ipg);
mmc_free_host(mmc);
-
- return 0;
}
static int mxcmci_suspend(struct device *dev)
@@ -1216,7 +1214,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(mxcmci_pm_ops, mxcmci_suspend, mxcmci_resume);
static struct platform_driver mxcmci_driver = {
.probe = mxcmci_probe,
- .remove = mxcmci_remove,
+ .remove_new = mxcmci_remove,
.driver = {
.name = DRIVER_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 53/58] mmc: mvsdio: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (50 preceding siblings ...)
2023-07-13 8:08 ` [PATCH 52/58] mmc: mxcmmc: " Yangtao Li
@ 2023-07-13 8:08 ` Yangtao Li
2023-07-13 8:08 ` [PATCH 54/58] mmc: pwrseq_simple: " Yangtao Li
` (5 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:08 UTC (permalink / raw)
To: Nicolas Pitre, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/mvsdio.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
index b4f6a0a2fcb5..ca01b7d204ba 100644
--- a/drivers/mmc/host/mvsdio.c
+++ b/drivers/mmc/host/mvsdio.c
@@ -796,7 +796,7 @@ static int mvsd_probe(struct platform_device *pdev)
return ret;
}
-static int mvsd_remove(struct platform_device *pdev)
+static void mvsd_remove(struct platform_device *pdev)
{
struct mmc_host *mmc = platform_get_drvdata(pdev);
@@ -809,8 +809,6 @@ static int mvsd_remove(struct platform_device *pdev)
if (!IS_ERR(host->clk))
clk_disable_unprepare(host->clk);
mmc_free_host(mmc);
-
- return 0;
}
static const struct of_device_id mvsdio_dt_ids[] = {
@@ -821,7 +819,7 @@ MODULE_DEVICE_TABLE(of, mvsdio_dt_ids);
static struct platform_driver mvsd_driver = {
.probe = mvsd_probe,
- .remove = mvsd_remove,
+ .remove_new = mvsd_remove,
.driver = {
.name = DRIVER_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 54/58] mmc: pwrseq_simple: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (51 preceding siblings ...)
2023-07-13 8:08 ` [PATCH 53/58] mmc: mvsdio: " Yangtao Li
@ 2023-07-13 8:08 ` Yangtao Li
2023-07-13 8:08 ` [PATCH 55/58] mmc: pwrseq: sd8787: " Yangtao Li
` (4 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:08 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/core/pwrseq_simple.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
index 3bac1e71411b..df9588503ad0 100644
--- a/drivers/mmc/core/pwrseq_simple.c
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -142,18 +142,16 @@ static int mmc_pwrseq_simple_probe(struct platform_device *pdev)
return mmc_pwrseq_register(&pwrseq->pwrseq);
}
-static int mmc_pwrseq_simple_remove(struct platform_device *pdev)
+static void mmc_pwrseq_simple_remove(struct platform_device *pdev)
{
struct mmc_pwrseq_simple *pwrseq = platform_get_drvdata(pdev);
mmc_pwrseq_unregister(&pwrseq->pwrseq);
-
- return 0;
}
static struct platform_driver mmc_pwrseq_simple_driver = {
.probe = mmc_pwrseq_simple_probe,
- .remove = mmc_pwrseq_simple_remove,
+ .remove_new = mmc_pwrseq_simple_remove,
.driver = {
.name = "pwrseq_simple",
.of_match_table = mmc_pwrseq_simple_of_match,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 55/58] mmc: pwrseq: sd8787: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (52 preceding siblings ...)
2023-07-13 8:08 ` [PATCH 54/58] mmc: pwrseq_simple: " Yangtao Li
@ 2023-07-13 8:08 ` Yangtao Li
2023-07-13 8:08 ` [PATCH 56/58] mmc: pwrseq: " Yangtao Li
` (3 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:08 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/core/pwrseq_sd8787.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/core/pwrseq_sd8787.c b/drivers/mmc/core/pwrseq_sd8787.c
index 0c5f5e371e1f..0c5808fc3206 100644
--- a/drivers/mmc/core/pwrseq_sd8787.c
+++ b/drivers/mmc/core/pwrseq_sd8787.c
@@ -113,18 +113,16 @@ static int mmc_pwrseq_sd8787_probe(struct platform_device *pdev)
return mmc_pwrseq_register(&pwrseq->pwrseq);
}
-static int mmc_pwrseq_sd8787_remove(struct platform_device *pdev)
+static void mmc_pwrseq_sd8787_remove(struct platform_device *pdev)
{
struct mmc_pwrseq_sd8787 *pwrseq = platform_get_drvdata(pdev);
mmc_pwrseq_unregister(&pwrseq->pwrseq);
-
- return 0;
}
static struct platform_driver mmc_pwrseq_sd8787_driver = {
.probe = mmc_pwrseq_sd8787_probe,
- .remove = mmc_pwrseq_sd8787_remove,
+ .remove_new = mmc_pwrseq_sd8787_remove,
.driver = {
.name = "pwrseq_sd8787",
.of_match_table = mmc_pwrseq_sd8787_of_match,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 56/58] mmc: pwrseq: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (53 preceding siblings ...)
2023-07-13 8:08 ` [PATCH 55/58] mmc: pwrseq: sd8787: " Yangtao Li
@ 2023-07-13 8:08 ` Yangtao Li
2023-07-13 8:08 ` [PATCH 57/58] mmc: renesas_sdhi: " Yangtao Li
` (2 subsequent siblings)
57 siblings, 0 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:08 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/core/pwrseq_emmc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c
index f6dde9edd7a3..3b6d69cefb4e 100644
--- a/drivers/mmc/core/pwrseq_emmc.c
+++ b/drivers/mmc/core/pwrseq_emmc.c
@@ -90,14 +90,12 @@ static int mmc_pwrseq_emmc_probe(struct platform_device *pdev)
return mmc_pwrseq_register(&pwrseq->pwrseq);
}
-static int mmc_pwrseq_emmc_remove(struct platform_device *pdev)
+static void mmc_pwrseq_emmc_remove(struct platform_device *pdev)
{
struct mmc_pwrseq_emmc *pwrseq = platform_get_drvdata(pdev);
unregister_restart_handler(&pwrseq->reset_nb);
mmc_pwrseq_unregister(&pwrseq->pwrseq);
-
- return 0;
}
static const struct of_device_id mmc_pwrseq_emmc_of_match[] = {
@@ -109,7 +107,7 @@ MODULE_DEVICE_TABLE(of, mmc_pwrseq_emmc_of_match);
static struct platform_driver mmc_pwrseq_emmc_driver = {
.probe = mmc_pwrseq_emmc_probe,
- .remove = mmc_pwrseq_emmc_remove,
+ .remove_new = mmc_pwrseq_emmc_remove,
.driver = {
.name = "pwrseq_emmc",
.of_match_table = mmc_pwrseq_emmc_of_match,
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* [PATCH 57/58] mmc: renesas_sdhi: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (54 preceding siblings ...)
2023-07-13 8:08 ` [PATCH 56/58] mmc: pwrseq: " Yangtao Li
@ 2023-07-13 8:08 ` Yangtao Li
2023-07-13 10:18 ` Geert Uytterhoeven
2023-07-13 8:08 ` [PATCH 58/58] mmc: " Yangtao Li
2023-07-13 15:13 ` [PATCH 01/58] mmc: sunxi: " Jernej Škrabec
57 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:08 UTC (permalink / raw)
To: Wolfram Sang, Ulf Hansson
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-renesas-soc,
linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/renesas_sdhi.h | 2 +-
drivers/mmc/host/renesas_sdhi_core.c | 4 +---
drivers/mmc/host/renesas_sdhi_internal_dmac.c | 2 +-
drivers/mmc/host/renesas_sdhi_sys_dmac.c | 2 +-
4 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h
index 68da3da9e2e5..c1fb9740eab0 100644
--- a/drivers/mmc/host/renesas_sdhi.h
+++ b/drivers/mmc/host/renesas_sdhi.h
@@ -101,5 +101,5 @@ int renesas_sdhi_probe(struct platform_device *pdev,
const struct tmio_mmc_dma_ops *dma_ops,
const struct renesas_sdhi_of_data *of_data,
const struct renesas_sdhi_quirks *quirks);
-int renesas_sdhi_remove(struct platform_device *pdev);
+void renesas_sdhi_remove(struct platform_device *pdev);
#endif
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 345934e4f59e..5d3adef144d7 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -1145,15 +1145,13 @@ int renesas_sdhi_probe(struct platform_device *pdev,
}
EXPORT_SYMBOL_GPL(renesas_sdhi_probe);
-int renesas_sdhi_remove(struct platform_device *pdev)
+void renesas_sdhi_remove(struct platform_device *pdev)
{
struct tmio_mmc_host *host = platform_get_drvdata(pdev);
tmio_mmc_host_remove(host);
renesas_sdhi_clk_disable(host);
tmio_mmc_host_free(host);
-
- return 0;
}
EXPORT_SYMBOL_GPL(renesas_sdhi_remove);
diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 9ab813903b2c..d8efb8035b1f 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -609,7 +609,7 @@ static struct platform_driver renesas_internal_dmac_sdhi_driver = {
.of_match_table = renesas_sdhi_internal_dmac_of_match,
},
.probe = renesas_sdhi_internal_dmac_probe,
- .remove = renesas_sdhi_remove,
+ .remove_new = renesas_sdhi_remove,
};
module_platform_driver(renesas_internal_dmac_sdhi_driver);
diff --git a/drivers/mmc/host/renesas_sdhi_sys_dmac.c b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
index b559ad38b667..248dfeef942a 100644
--- a/drivers/mmc/host/renesas_sdhi_sys_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_sys_dmac.c
@@ -470,7 +470,7 @@ static struct platform_driver renesas_sys_dmac_sdhi_driver = {
.of_match_table = renesas_sdhi_sys_dmac_of_match,
},
.probe = renesas_sdhi_sys_dmac_probe,
- .remove = renesas_sdhi_remove,
+ .remove_new = renesas_sdhi_remove,
};
module_platform_driver(renesas_sys_dmac_sdhi_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 57/58] mmc: renesas_sdhi: Convert to platform remove callback returning void
2023-07-13 8:08 ` [PATCH 57/58] mmc: renesas_sdhi: " Yangtao Li
@ 2023-07-13 10:18 ` Geert Uytterhoeven
0 siblings, 0 replies; 80+ messages in thread
From: Geert Uytterhoeven @ 2023-07-13 10:18 UTC (permalink / raw)
To: Yangtao Li
Cc: Wolfram Sang, Ulf Hansson, Uwe Kleine-König, linux-mmc,
linux-renesas-soc, linux-kernel
On Thu, Jul 13, 2023 at 10:32 AM Yangtao Li <frank.li@vivo.com> 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 80+ messages in thread
* [PATCH 58/58] mmc: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (55 preceding siblings ...)
2023-07-13 8:08 ` [PATCH 57/58] mmc: renesas_sdhi: " Yangtao Li
@ 2023-07-13 8:08 ` Yangtao Li
2023-07-14 7:49 ` Adrian Hunter
2023-07-14 10:12 ` Florian Fainelli
2023-07-13 15:13 ` [PATCH 01/58] mmc: sunxi: " Jernej Škrabec
57 siblings, 2 replies; 80+ messages in thread
From: Yangtao Li @ 2023-07-13 8:08 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson, Florian Fainelli, Ray Jui,
Scott Branden, Broadcom internal kernel review list, Kamal Dasu,
Al Cooper, Lars Povlsen, Steen Hegelund, Daniel Machon,
UNGLinuxDriver
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-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.
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
drivers/mmc/host/sdhci-brcmstb.c | 2 +-
drivers/mmc/host/sdhci-cadence.c | 2 +-
drivers/mmc/host/sdhci-dove.c | 2 +-
drivers/mmc/host/sdhci-iproc.c | 2 +-
drivers/mmc/host/sdhci-of-esdhc.c | 2 +-
drivers/mmc/host/sdhci-of-hlwd.c | 2 +-
drivers/mmc/host/sdhci-of-sparx5.c | 2 +-
drivers/mmc/host/sdhci-pltfm.c | 4 +---
drivers/mmc/host/sdhci-pltfm.h | 2 +-
drivers/mmc/host/sdhci-pxav2.c | 2 +-
11 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/mmc/host/sdhci-bcm-kona.c b/drivers/mmc/host/sdhci-bcm-kona.c
index 6a93a54fe067..2e3736603853 100644
--- a/drivers/mmc/host/sdhci-bcm-kona.c
+++ b/drivers/mmc/host/sdhci-bcm-kona.c
@@ -319,7 +319,7 @@ static struct platform_driver sdhci_bcm_kona_driver = {
.of_match_table = sdhci_bcm_kona_of_match,
},
.probe = sdhci_bcm_kona_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
};
module_platform_driver(sdhci_bcm_kona_driver);
diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
index 4c22337199cf..a2b6d8f2eeb6 100644
--- a/drivers/mmc/host/sdhci-brcmstb.c
+++ b/drivers/mmc/host/sdhci-brcmstb.c
@@ -430,7 +430,7 @@ static struct platform_driver sdhci_brcmstb_driver = {
.of_match_table = of_match_ptr(sdhci_brcm_of_match),
},
.probe = sdhci_brcmstb_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
.shutdown = sdhci_brcmstb_shutdown,
};
diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
index d2f625054689..1702a499b36a 100644
--- a/drivers/mmc/host/sdhci-cadence.c
+++ b/drivers/mmc/host/sdhci-cadence.c
@@ -617,7 +617,7 @@ static struct platform_driver sdhci_cdns_driver = {
.of_match_table = sdhci_cdns_match,
},
.probe = sdhci_cdns_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
};
module_platform_driver(sdhci_cdns_driver);
diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c
index 5e5bf82e5976..75335dbf223c 100644
--- a/drivers/mmc/host/sdhci-dove.c
+++ b/drivers/mmc/host/sdhci-dove.c
@@ -110,7 +110,7 @@ static struct platform_driver sdhci_dove_driver = {
.of_match_table = sdhci_dove_of_match_table,
},
.probe = sdhci_dove_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
};
module_platform_driver(sdhci_dove_driver);
diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
index 86eb0045515e..0dbebcecd8fc 100644
--- a/drivers/mmc/host/sdhci-iproc.c
+++ b/drivers/mmc/host/sdhci-iproc.c
@@ -432,7 +432,7 @@ static struct platform_driver sdhci_iproc_driver = {
.pm = &sdhci_pltfm_pmops,
},
.probe = sdhci_iproc_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
.shutdown = sdhci_iproc_shutdown,
};
module_platform_driver(sdhci_iproc_driver);
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 48ca1cf15b19..5072b59f6165 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -1521,7 +1521,7 @@ static struct platform_driver sdhci_esdhc_driver = {
.pm = &esdhc_of_dev_pm_ops,
},
.probe = sdhci_esdhc_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
};
module_platform_driver(sdhci_esdhc_driver);
diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c
index 12675797b296..cba3ba48e9dc 100644
--- a/drivers/mmc/host/sdhci-of-hlwd.c
+++ b/drivers/mmc/host/sdhci-of-hlwd.c
@@ -85,7 +85,7 @@ static struct platform_driver sdhci_hlwd_driver = {
.pm = &sdhci_pltfm_pmops,
},
.probe = sdhci_hlwd_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
};
module_platform_driver(sdhci_hlwd_driver);
diff --git a/drivers/mmc/host/sdhci-of-sparx5.c b/drivers/mmc/host/sdhci-of-sparx5.c
index 28e4ee69e100..26aaab068e00 100644
--- a/drivers/mmc/host/sdhci-of-sparx5.c
+++ b/drivers/mmc/host/sdhci-of-sparx5.c
@@ -260,7 +260,7 @@ static struct platform_driver sdhci_sparx5_driver = {
.pm = &sdhci_pltfm_pmops,
},
.probe = sdhci_sparx5_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
};
module_platform_driver(sdhci_sparx5_driver);
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 673e750a8490..72d07b49b0a3 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -187,7 +187,7 @@ int sdhci_pltfm_register(struct platform_device *pdev,
}
EXPORT_SYMBOL_GPL(sdhci_pltfm_register);
-int sdhci_pltfm_unregister(struct platform_device *pdev)
+void sdhci_pltfm_unregister(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -196,8 +196,6 @@ int sdhci_pltfm_unregister(struct platform_device *pdev)
sdhci_remove_host(host, dead);
clk_disable_unprepare(pltfm_host->clk);
sdhci_pltfm_free(pdev);
-
- return 0;
}
EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index 9bd717ff784b..6e6a443dafd9 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -102,7 +102,7 @@ extern void sdhci_pltfm_free(struct platform_device *pdev);
extern int sdhci_pltfm_register(struct platform_device *pdev,
const struct sdhci_pltfm_data *pdata,
size_t priv_size);
-extern int sdhci_pltfm_unregister(struct platform_device *pdev);
+extern void sdhci_pltfm_unregister(struct platform_device *pdev);
extern unsigned int sdhci_pltfm_clk_get_max_clock(struct sdhci_host *host);
diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
index 91aca8f8d6ef..1c1e763ce209 100644
--- a/drivers/mmc/host/sdhci-pxav2.c
+++ b/drivers/mmc/host/sdhci-pxav2.c
@@ -359,7 +359,7 @@ static struct platform_driver sdhci_pxav2_driver = {
.pm = &sdhci_pltfm_pmops,
},
.probe = sdhci_pxav2_probe,
- .remove = sdhci_pltfm_unregister,
+ .remove_new = sdhci_pltfm_unregister,
};
module_platform_driver(sdhci_pxav2_driver);
--
2.39.0
^ permalink raw reply related [flat|nested] 80+ messages in thread* Re: [PATCH 58/58] mmc: Convert to platform remove callback returning void
2023-07-13 8:08 ` [PATCH 58/58] mmc: " Yangtao Li
@ 2023-07-14 7:49 ` Adrian Hunter
2023-07-25 8:13 ` Yangtao Li
2023-07-14 10:12 ` Florian Fainelli
1 sibling, 1 reply; 80+ messages in thread
From: Adrian Hunter @ 2023-07-14 7:49 UTC (permalink / raw)
To: Yangtao Li, Ulf Hansson, Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Kamal Dasu, Al Cooper,
Lars Povlsen, Steen Hegelund, Daniel Machon, UNGLinuxDriver
Cc: Uwe Kleine-König, linux-mmc, linux-kernel, linux-arm-kernel
On 13/07/23 11:08, Yangtao Li 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
> drivers/mmc/host/sdhci-brcmstb.c | 2 +-
> drivers/mmc/host/sdhci-cadence.c | 2 +-
> drivers/mmc/host/sdhci-dove.c | 2 +-
> drivers/mmc/host/sdhci-iproc.c | 2 +-
> drivers/mmc/host/sdhci-of-esdhc.c | 2 +-
> drivers/mmc/host/sdhci-of-hlwd.c | 2 +-
> drivers/mmc/host/sdhci-of-sparx5.c | 2 +-
> drivers/mmc/host/sdhci-pltfm.c | 4 +---
> drivers/mmc/host/sdhci-pltfm.h | 2 +-
> drivers/mmc/host/sdhci-pxav2.c | 2 +-
Looks like drivers/mmc/host/sdhci-npcm.c was missed
> 11 files changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-bcm-kona.c b/drivers/mmc/host/sdhci-bcm-kona.c
> index 6a93a54fe067..2e3736603853 100644
> --- a/drivers/mmc/host/sdhci-bcm-kona.c
> +++ b/drivers/mmc/host/sdhci-bcm-kona.c
> @@ -319,7 +319,7 @@ static struct platform_driver sdhci_bcm_kona_driver = {
> .of_match_table = sdhci_bcm_kona_of_match,
> },
> .probe = sdhci_bcm_kona_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> };
> module_platform_driver(sdhci_bcm_kona_driver);
>
> diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
> index 4c22337199cf..a2b6d8f2eeb6 100644
> --- a/drivers/mmc/host/sdhci-brcmstb.c
> +++ b/drivers/mmc/host/sdhci-brcmstb.c
> @@ -430,7 +430,7 @@ static struct platform_driver sdhci_brcmstb_driver = {
> .of_match_table = of_match_ptr(sdhci_brcm_of_match),
> },
> .probe = sdhci_brcmstb_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> .shutdown = sdhci_brcmstb_shutdown,
> };
>
> diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
> index d2f625054689..1702a499b36a 100644
> --- a/drivers/mmc/host/sdhci-cadence.c
> +++ b/drivers/mmc/host/sdhci-cadence.c
> @@ -617,7 +617,7 @@ static struct platform_driver sdhci_cdns_driver = {
> .of_match_table = sdhci_cdns_match,
> },
> .probe = sdhci_cdns_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> };
> module_platform_driver(sdhci_cdns_driver);
>
> diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c
> index 5e5bf82e5976..75335dbf223c 100644
> --- a/drivers/mmc/host/sdhci-dove.c
> +++ b/drivers/mmc/host/sdhci-dove.c
> @@ -110,7 +110,7 @@ static struct platform_driver sdhci_dove_driver = {
> .of_match_table = sdhci_dove_of_match_table,
> },
> .probe = sdhci_dove_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> };
>
> module_platform_driver(sdhci_dove_driver);
> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> index 86eb0045515e..0dbebcecd8fc 100644
> --- a/drivers/mmc/host/sdhci-iproc.c
> +++ b/drivers/mmc/host/sdhci-iproc.c
> @@ -432,7 +432,7 @@ static struct platform_driver sdhci_iproc_driver = {
> .pm = &sdhci_pltfm_pmops,
> },
> .probe = sdhci_iproc_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> .shutdown = sdhci_iproc_shutdown,
> };
> module_platform_driver(sdhci_iproc_driver);
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index 48ca1cf15b19..5072b59f6165 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -1521,7 +1521,7 @@ static struct platform_driver sdhci_esdhc_driver = {
> .pm = &esdhc_of_dev_pm_ops,
> },
> .probe = sdhci_esdhc_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> };
>
> module_platform_driver(sdhci_esdhc_driver);
> diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c
> index 12675797b296..cba3ba48e9dc 100644
> --- a/drivers/mmc/host/sdhci-of-hlwd.c
> +++ b/drivers/mmc/host/sdhci-of-hlwd.c
> @@ -85,7 +85,7 @@ static struct platform_driver sdhci_hlwd_driver = {
> .pm = &sdhci_pltfm_pmops,
> },
> .probe = sdhci_hlwd_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> };
>
> module_platform_driver(sdhci_hlwd_driver);
> diff --git a/drivers/mmc/host/sdhci-of-sparx5.c b/drivers/mmc/host/sdhci-of-sparx5.c
> index 28e4ee69e100..26aaab068e00 100644
> --- a/drivers/mmc/host/sdhci-of-sparx5.c
> +++ b/drivers/mmc/host/sdhci-of-sparx5.c
> @@ -260,7 +260,7 @@ static struct platform_driver sdhci_sparx5_driver = {
> .pm = &sdhci_pltfm_pmops,
> },
> .probe = sdhci_sparx5_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> };
>
> module_platform_driver(sdhci_sparx5_driver);
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index 673e750a8490..72d07b49b0a3 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -187,7 +187,7 @@ int sdhci_pltfm_register(struct platform_device *pdev,
> }
> EXPORT_SYMBOL_GPL(sdhci_pltfm_register);
>
> -int sdhci_pltfm_unregister(struct platform_device *pdev)
> +void sdhci_pltfm_unregister(struct platform_device *pdev)
> {
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> @@ -196,8 +196,6 @@ int sdhci_pltfm_unregister(struct platform_device *pdev)
> sdhci_remove_host(host, dead);
> clk_disable_unprepare(pltfm_host->clk);
> sdhci_pltfm_free(pdev);
> -
> - return 0;
> }
> EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
>
> diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
> index 9bd717ff784b..6e6a443dafd9 100644
> --- a/drivers/mmc/host/sdhci-pltfm.h
> +++ b/drivers/mmc/host/sdhci-pltfm.h
> @@ -102,7 +102,7 @@ extern void sdhci_pltfm_free(struct platform_device *pdev);
> extern int sdhci_pltfm_register(struct platform_device *pdev,
> const struct sdhci_pltfm_data *pdata,
> size_t priv_size);
> -extern int sdhci_pltfm_unregister(struct platform_device *pdev);
> +extern void sdhci_pltfm_unregister(struct platform_device *pdev);
>
> extern unsigned int sdhci_pltfm_clk_get_max_clock(struct sdhci_host *host);
>
> diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
> index 91aca8f8d6ef..1c1e763ce209 100644
> --- a/drivers/mmc/host/sdhci-pxav2.c
> +++ b/drivers/mmc/host/sdhci-pxav2.c
> @@ -359,7 +359,7 @@ static struct platform_driver sdhci_pxav2_driver = {
> .pm = &sdhci_pltfm_pmops,
> },
> .probe = sdhci_pxav2_probe,
> - .remove = sdhci_pltfm_unregister,
> + .remove_new = sdhci_pltfm_unregister,
> };
>
> module_platform_driver(sdhci_pxav2_driver);
^ permalink raw reply [flat|nested] 80+ messages in thread* Re: [PATCH 58/58] mmc: Convert to platform remove callback returning void
2023-07-14 7:49 ` Adrian Hunter
@ 2023-07-25 8:13 ` Yangtao Li
2023-07-25 11:22 ` Adrian Hunter
0 siblings, 1 reply; 80+ messages in thread
From: Yangtao Li @ 2023-07-25 8:13 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson, Florian Fainelli, Ray Jui,
Scott Branden, Broadcom internal kernel review list, Kamal Dasu,
Al Cooper, Lars Povlsen, Steen Hegelund, Daniel Machon,
UNGLinuxDriver
Cc: Uwe Kleine-König, linux-mmc, linux-kernel, linux-arm-kernel
Hi Adria,
On 2023/7/14 15:49, Adrian Hunter wrote:
> On 13/07/23 11:08, Yangtao Li 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.
>>
>> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>> Signed-off-by: Yangtao Li <frank.li@vivo.com>
>> ---
>> drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
>> drivers/mmc/host/sdhci-brcmstb.c | 2 +-
>> drivers/mmc/host/sdhci-cadence.c | 2 +-
>> drivers/mmc/host/sdhci-dove.c | 2 +-
>> drivers/mmc/host/sdhci-iproc.c | 2 +-
>> drivers/mmc/host/sdhci-of-esdhc.c | 2 +-
>> drivers/mmc/host/sdhci-of-hlwd.c | 2 +-
>> drivers/mmc/host/sdhci-of-sparx5.c | 2 +-
>> drivers/mmc/host/sdhci-pltfm.c | 4 +---
>> drivers/mmc/host/sdhci-pltfm.h | 2 +-
>> drivers/mmc/host/sdhci-pxav2.c | 2 +-
> Looks like drivers/mmc/host/sdhci-npcm.c was missed
Neither [1] nor [2] can find this driver, what am I missing?
[1]
https://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git/tree/drivers/mmc/host?h=next
[2]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mmc/host
Thx,
Yangtao
>
>> 11 files changed, 11 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-bcm-kona.c b/drivers/mmc/host/sdhci-bcm-kona.c
>> index 6a93a54fe067..2e3736603853 100644
>> --- a/drivers/mmc/host/sdhci-bcm-kona.c
>> +++ b/drivers/mmc/host/sdhci-bcm-kona.c
>> @@ -319,7 +319,7 @@ static struct platform_driver sdhci_bcm_kona_driver = {
>> .of_match_table = sdhci_bcm_kona_of_match,
>> },
>> .probe = sdhci_bcm_kona_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> };
>> module_platform_driver(sdhci_bcm_kona_driver);
>>
>> diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
>> index 4c22337199cf..a2b6d8f2eeb6 100644
>> --- a/drivers/mmc/host/sdhci-brcmstb.c
>> +++ b/drivers/mmc/host/sdhci-brcmstb.c
>> @@ -430,7 +430,7 @@ static struct platform_driver sdhci_brcmstb_driver = {
>> .of_match_table = of_match_ptr(sdhci_brcm_of_match),
>> },
>> .probe = sdhci_brcmstb_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> .shutdown = sdhci_brcmstb_shutdown,
>> };
>>
>> diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
>> index d2f625054689..1702a499b36a 100644
>> --- a/drivers/mmc/host/sdhci-cadence.c
>> +++ b/drivers/mmc/host/sdhci-cadence.c
>> @@ -617,7 +617,7 @@ static struct platform_driver sdhci_cdns_driver = {
>> .of_match_table = sdhci_cdns_match,
>> },
>> .probe = sdhci_cdns_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> };
>> module_platform_driver(sdhci_cdns_driver);
>>
>> diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c
>> index 5e5bf82e5976..75335dbf223c 100644
>> --- a/drivers/mmc/host/sdhci-dove.c
>> +++ b/drivers/mmc/host/sdhci-dove.c
>> @@ -110,7 +110,7 @@ static struct platform_driver sdhci_dove_driver = {
>> .of_match_table = sdhci_dove_of_match_table,
>> },
>> .probe = sdhci_dove_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> };
>>
>> module_platform_driver(sdhci_dove_driver);
>> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
>> index 86eb0045515e..0dbebcecd8fc 100644
>> --- a/drivers/mmc/host/sdhci-iproc.c
>> +++ b/drivers/mmc/host/sdhci-iproc.c
>> @@ -432,7 +432,7 @@ static struct platform_driver sdhci_iproc_driver = {
>> .pm = &sdhci_pltfm_pmops,
>> },
>> .probe = sdhci_iproc_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> .shutdown = sdhci_iproc_shutdown,
>> };
>> module_platform_driver(sdhci_iproc_driver);
>> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
>> index 48ca1cf15b19..5072b59f6165 100644
>> --- a/drivers/mmc/host/sdhci-of-esdhc.c
>> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
>> @@ -1521,7 +1521,7 @@ static struct platform_driver sdhci_esdhc_driver = {
>> .pm = &esdhc_of_dev_pm_ops,
>> },
>> .probe = sdhci_esdhc_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> };
>>
>> module_platform_driver(sdhci_esdhc_driver);
>> diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c
>> index 12675797b296..cba3ba48e9dc 100644
>> --- a/drivers/mmc/host/sdhci-of-hlwd.c
>> +++ b/drivers/mmc/host/sdhci-of-hlwd.c
>> @@ -85,7 +85,7 @@ static struct platform_driver sdhci_hlwd_driver = {
>> .pm = &sdhci_pltfm_pmops,
>> },
>> .probe = sdhci_hlwd_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> };
>>
>> module_platform_driver(sdhci_hlwd_driver);
>> diff --git a/drivers/mmc/host/sdhci-of-sparx5.c b/drivers/mmc/host/sdhci-of-sparx5.c
>> index 28e4ee69e100..26aaab068e00 100644
>> --- a/drivers/mmc/host/sdhci-of-sparx5.c
>> +++ b/drivers/mmc/host/sdhci-of-sparx5.c
>> @@ -260,7 +260,7 @@ static struct platform_driver sdhci_sparx5_driver = {
>> .pm = &sdhci_pltfm_pmops,
>> },
>> .probe = sdhci_sparx5_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> };
>>
>> module_platform_driver(sdhci_sparx5_driver);
>> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
>> index 673e750a8490..72d07b49b0a3 100644
>> --- a/drivers/mmc/host/sdhci-pltfm.c
>> +++ b/drivers/mmc/host/sdhci-pltfm.c
>> @@ -187,7 +187,7 @@ int sdhci_pltfm_register(struct platform_device *pdev,
>> }
>> EXPORT_SYMBOL_GPL(sdhci_pltfm_register);
>>
>> -int sdhci_pltfm_unregister(struct platform_device *pdev)
>> +void sdhci_pltfm_unregister(struct platform_device *pdev)
>> {
>> struct sdhci_host *host = platform_get_drvdata(pdev);
>> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> @@ -196,8 +196,6 @@ int sdhci_pltfm_unregister(struct platform_device *pdev)
>> sdhci_remove_host(host, dead);
>> clk_disable_unprepare(pltfm_host->clk);
>> sdhci_pltfm_free(pdev);
>> -
>> - return 0;
>> }
>> EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
>>
>> diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
>> index 9bd717ff784b..6e6a443dafd9 100644
>> --- a/drivers/mmc/host/sdhci-pltfm.h
>> +++ b/drivers/mmc/host/sdhci-pltfm.h
>> @@ -102,7 +102,7 @@ extern void sdhci_pltfm_free(struct platform_device *pdev);
>> extern int sdhci_pltfm_register(struct platform_device *pdev,
>> const struct sdhci_pltfm_data *pdata,
>> size_t priv_size);
>> -extern int sdhci_pltfm_unregister(struct platform_device *pdev);
>> +extern void sdhci_pltfm_unregister(struct platform_device *pdev);
>>
>> extern unsigned int sdhci_pltfm_clk_get_max_clock(struct sdhci_host *host);
>>
>> diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
>> index 91aca8f8d6ef..1c1e763ce209 100644
>> --- a/drivers/mmc/host/sdhci-pxav2.c
>> +++ b/drivers/mmc/host/sdhci-pxav2.c
>> @@ -359,7 +359,7 @@ static struct platform_driver sdhci_pxav2_driver = {
>> .pm = &sdhci_pltfm_pmops,
>> },
>> .probe = sdhci_pxav2_probe,
>> - .remove = sdhci_pltfm_unregister,
>> + .remove_new = sdhci_pltfm_unregister,
>> };
>>
>> module_platform_driver(sdhci_pxav2_driver);
^ permalink raw reply [flat|nested] 80+ messages in thread* Re: [PATCH 58/58] mmc: Convert to platform remove callback returning void
2023-07-25 8:13 ` Yangtao Li
@ 2023-07-25 11:22 ` Adrian Hunter
0 siblings, 0 replies; 80+ messages in thread
From: Adrian Hunter @ 2023-07-25 11:22 UTC (permalink / raw)
To: Yangtao Li, Ulf Hansson, Florian Fainelli, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Kamal Dasu, Al Cooper,
Lars Povlsen, Steen Hegelund, Daniel Machon, UNGLinuxDriver
Cc: Uwe Kleine-König, linux-mmc, linux-kernel, linux-arm-kernel
On 25/07/23 11:13, Yangtao Li wrote:
> Hi Adria,
>
> On 2023/7/14 15:49, Adrian Hunter wrote:
>> On 13/07/23 11:08, Yangtao Li 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.
>>>
>>> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>>> Signed-off-by: Yangtao Li <frank.li@vivo.com>
>>> ---
>>> drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
>>> drivers/mmc/host/sdhci-brcmstb.c | 2 +-
>>> drivers/mmc/host/sdhci-cadence.c | 2 +-
>>> drivers/mmc/host/sdhci-dove.c | 2 +-
>>> drivers/mmc/host/sdhci-iproc.c | 2 +-
>>> drivers/mmc/host/sdhci-of-esdhc.c | 2 +-
>>> drivers/mmc/host/sdhci-of-hlwd.c | 2 +-
>>> drivers/mmc/host/sdhci-of-sparx5.c | 2 +-
>>> drivers/mmc/host/sdhci-pltfm.c | 4 +---
>>> drivers/mmc/host/sdhci-pltfm.h | 2 +-
>>> drivers/mmc/host/sdhci-pxav2.c | 2 +-
>> Looks like drivers/mmc/host/sdhci-npcm.c was missed
>
>
> Neither [1] nor [2] can find this driver, what am I missing?
Sorry, it was some untracked rubbish left over in my tree.
In that case:
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
>
> [1]
>
> https://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git/tree/drivers/mmc/host?h=next
>
> [2]
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mmc/host
>
>
> Thx,
>
> Yangtao
>
>
>>
>>> 11 files changed, 11 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/drivers/mmc/host/sdhci-bcm-kona.c b/drivers/mmc/host/sdhci-bcm-kona.c
>>> index 6a93a54fe067..2e3736603853 100644
>>> --- a/drivers/mmc/host/sdhci-bcm-kona.c
>>> +++ b/drivers/mmc/host/sdhci-bcm-kona.c
>>> @@ -319,7 +319,7 @@ static struct platform_driver sdhci_bcm_kona_driver = {
>>> .of_match_table = sdhci_bcm_kona_of_match,
>>> },
>>> .probe = sdhci_bcm_kona_probe,
>>> - .remove = sdhci_pltfm_unregister,
>>> + .remove_new = sdhci_pltfm_unregister,
>>> };
>>> module_platform_driver(sdhci_bcm_kona_driver);
>>> diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
>>> index 4c22337199cf..a2b6d8f2eeb6 100644
>>> --- a/drivers/mmc/host/sdhci-brcmstb.c
>>> +++ b/drivers/mmc/host/sdhci-brcmstb.c
>>> @@ -430,7 +430,7 @@ static struct platform_driver sdhci_brcmstb_driver = {
>>> .of_match_table = of_match_ptr(sdhci_brcm_of_match),
>>> },
>>> .probe = sdhci_brcmstb_probe,
>>> - .remove = sdhci_pltfm_unregister,
>>> + .remove_new = sdhci_pltfm_unregister,
>>> .shutdown = sdhci_brcmstb_shutdown,
>>> };
>>> diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
>>> index d2f625054689..1702a499b36a 100644
>>> --- a/drivers/mmc/host/sdhci-cadence.c
>>> +++ b/drivers/mmc/host/sdhci-cadence.c
>>> @@ -617,7 +617,7 @@ static struct platform_driver sdhci_cdns_driver = {
>>> .of_match_table = sdhci_cdns_match,
>>> },
>>> .probe = sdhci_cdns_probe,
>>> - .remove = sdhci_pltfm_unregister,
>>> + .remove_new = sdhci_pltfm_unregister,
>>> };
>>> module_platform_driver(sdhci_cdns_driver);
>>> diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c
>>> index 5e5bf82e5976..75335dbf223c 100644
>>> --- a/drivers/mmc/host/sdhci-dove.c
>>> +++ b/drivers/mmc/host/sdhci-dove.c
>>> @@ -110,7 +110,7 @@ static struct platform_driver sdhci_dove_driver = {
>>> .of_match_table = sdhci_dove_of_match_table,
>>> },
>>> .probe = sdhci_dove_probe,
>>> - .remove = sdhci_pltfm_unregister,
>>> + .remove_new = sdhci_pltfm_unregister,
>>> };
>>> module_platform_driver(sdhci_dove_driver);
>>> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
>>> index 86eb0045515e..0dbebcecd8fc 100644
>>> --- a/drivers/mmc/host/sdhci-iproc.c
>>> +++ b/drivers/mmc/host/sdhci-iproc.c
>>> @@ -432,7 +432,7 @@ static struct platform_driver sdhci_iproc_driver = {
>>> .pm = &sdhci_pltfm_pmops,
>>> },
>>> .probe = sdhci_iproc_probe,
>>> - .remove = sdhci_pltfm_unregister,
>>> + .remove_new = sdhci_pltfm_unregister,
>>> .shutdown = sdhci_iproc_shutdown,
>>> };
>>> module_platform_driver(sdhci_iproc_driver);
>>> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
>>> index 48ca1cf15b19..5072b59f6165 100644
>>> --- a/drivers/mmc/host/sdhci-of-esdhc.c
>>> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
>>> @@ -1521,7 +1521,7 @@ static struct platform_driver sdhci_esdhc_driver = {
>>> .pm = &esdhc_of_dev_pm_ops,
>>> },
>>> .probe = sdhci_esdhc_probe,
>>> - .remove = sdhci_pltfm_unregister,
>>> + .remove_new = sdhci_pltfm_unregister,
>>> };
>>> module_platform_driver(sdhci_esdhc_driver);
>>> diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c
>>> index 12675797b296..cba3ba48e9dc 100644
>>> --- a/drivers/mmc/host/sdhci-of-hlwd.c
>>> +++ b/drivers/mmc/host/sdhci-of-hlwd.c
>>> @@ -85,7 +85,7 @@ static struct platform_driver sdhci_hlwd_driver = {
>>> .pm = &sdhci_pltfm_pmops,
>>> },
>>> .probe = sdhci_hlwd_probe,
>>> - .remove = sdhci_pltfm_unregister,
>>> + .remove_new = sdhci_pltfm_unregister,
>>> };
>>> module_platform_driver(sdhci_hlwd_driver);
>>> diff --git a/drivers/mmc/host/sdhci-of-sparx5.c b/drivers/mmc/host/sdhci-of-sparx5.c
>>> index 28e4ee69e100..26aaab068e00 100644
>>> --- a/drivers/mmc/host/sdhci-of-sparx5.c
>>> +++ b/drivers/mmc/host/sdhci-of-sparx5.c
>>> @@ -260,7 +260,7 @@ static struct platform_driver sdhci_sparx5_driver = {
>>> .pm = &sdhci_pltfm_pmops,
>>> },
>>> .probe = sdhci_sparx5_probe,
>>> - .remove = sdhci_pltfm_unregister,
>>> + .remove_new = sdhci_pltfm_unregister,
>>> };
>>> module_platform_driver(sdhci_sparx5_driver);
>>> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
>>> index 673e750a8490..72d07b49b0a3 100644
>>> --- a/drivers/mmc/host/sdhci-pltfm.c
>>> +++ b/drivers/mmc/host/sdhci-pltfm.c
>>> @@ -187,7 +187,7 @@ int sdhci_pltfm_register(struct platform_device *pdev,
>>> }
>>> EXPORT_SYMBOL_GPL(sdhci_pltfm_register);
>>> -int sdhci_pltfm_unregister(struct platform_device *pdev)
>>> +void sdhci_pltfm_unregister(struct platform_device *pdev)
>>> {
>>> struct sdhci_host *host = platform_get_drvdata(pdev);
>>> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>>> @@ -196,8 +196,6 @@ int sdhci_pltfm_unregister(struct platform_device *pdev)
>>> sdhci_remove_host(host, dead);
>>> clk_disable_unprepare(pltfm_host->clk);
>>> sdhci_pltfm_free(pdev);
>>> -
>>> - return 0;
>>> }
>>> EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
>>> diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
>>> index 9bd717ff784b..6e6a443dafd9 100644
>>> --- a/drivers/mmc/host/sdhci-pltfm.h
>>> +++ b/drivers/mmc/host/sdhci-pltfm.h
>>> @@ -102,7 +102,7 @@ extern void sdhci_pltfm_free(struct platform_device *pdev);
>>> extern int sdhci_pltfm_register(struct platform_device *pdev,
>>> const struct sdhci_pltfm_data *pdata,
>>> size_t priv_size);
>>> -extern int sdhci_pltfm_unregister(struct platform_device *pdev);
>>> +extern void sdhci_pltfm_unregister(struct platform_device *pdev);
>>> extern unsigned int sdhci_pltfm_clk_get_max_clock(struct sdhci_host *host);
>>> diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c
>>> index 91aca8f8d6ef..1c1e763ce209 100644
>>> --- a/drivers/mmc/host/sdhci-pxav2.c
>>> +++ b/drivers/mmc/host/sdhci-pxav2.c
>>> @@ -359,7 +359,7 @@ static struct platform_driver sdhci_pxav2_driver = {
>>> .pm = &sdhci_pltfm_pmops,
>>> },
>>> .probe = sdhci_pxav2_probe,
>>> - .remove = sdhci_pltfm_unregister,
>>> + .remove_new = sdhci_pltfm_unregister,
>>> };
>>> module_platform_driver(sdhci_pxav2_driver);
^ permalink raw reply [flat|nested] 80+ messages in thread
* Re: [PATCH 58/58] mmc: Convert to platform remove callback returning void
2023-07-13 8:08 ` [PATCH 58/58] mmc: " Yangtao Li
2023-07-14 7:49 ` Adrian Hunter
@ 2023-07-14 10:12 ` Florian Fainelli
1 sibling, 0 replies; 80+ messages in thread
From: Florian Fainelli @ 2023-07-14 10:12 UTC (permalink / raw)
To: Yangtao Li, Adrian Hunter, Ulf Hansson, Ray Jui, Scott Branden,
Broadcom internal kernel review list, Kamal Dasu, Al Cooper,
Lars Povlsen, Steen Hegelund, Daniel Machon, UNGLinuxDriver
Cc: Uwe Kleine-König, linux-mmc, linux-kernel, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 913 bytes --]
On 7/13/2023 10:08 AM, Yangtao Li 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> drivers/mmc/host/sdhci-bcm-kona.c | 2 +-
> drivers/mmc/host/sdhci-brcmstb.c | 2 +-
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com> # Broadcom
drivers
--
Florian
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]
^ permalink raw reply [flat|nested] 80+ messages in thread
* Re: [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void
2023-07-13 8:07 [PATCH 01/58] mmc: sunxi: Convert to platform remove callback returning void Yangtao Li
` (56 preceding siblings ...)
2023-07-13 8:08 ` [PATCH 58/58] mmc: " Yangtao Li
@ 2023-07-13 15:13 ` Jernej Škrabec
57 siblings, 0 replies; 80+ messages in thread
From: Jernej Škrabec @ 2023-07-13 15:13 UTC (permalink / raw)
To: Ulf Hansson, Chen-Yu Tsai, Samuel Holland, Yangtao Li
Cc: Yangtao Li, Uwe Kleine-König, linux-mmc, linux-arm-kernel,
linux-sunxi, linux-kernel
Dne četrtek, 13. julij 2023 ob 10:07:10 CEST je Yangtao Li 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.
>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
> ---
> drivers/mmc/host/sunxi-mmc.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
> index 69dcb8805e05..d3bd0ac99ec4 100644
> --- a/drivers/mmc/host/sunxi-mmc.c
> +++ b/drivers/mmc/host/sunxi-mmc.c
> @@ -1486,7 +1486,7 @@ static int sunxi_mmc_probe(struct platform_device
> *pdev) return ret;
> }
>
> -static int sunxi_mmc_remove(struct platform_device *pdev)
> +static void sunxi_mmc_remove(struct platform_device *pdev)
> {
> struct mmc_host *mmc = platform_get_drvdata(pdev);
> struct sunxi_mmc_host *host = mmc_priv(mmc);
> @@ -1499,8 +1499,6 @@ static int sunxi_mmc_remove(struct platform_device
> *pdev) }
> dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host-
>sg_dma);
> mmc_free_host(mmc);
> -
> - return 0;
> }
>
> #ifdef CONFIG_PM
> @@ -1556,7 +1554,7 @@ static struct platform_driver sunxi_mmc_driver = {
> .pm = &sunxi_mmc_pm_ops,
> },
> .probe = sunxi_mmc_probe,
> - .remove = sunxi_mmc_remove,
> + .remove_new = sunxi_mmc_remove,
> };
> module_platform_driver(sunxi_mmc_driver);
^ permalink raw reply [flat|nested] 80+ messages in thread