ata: Convert to platform remove callback returning void
Subsystems (6)
cover ata: Convert to platform remove callback returning void
Hello,
this series adapts the platform drivers below drivers/ata to use the .remove_new() callback. Compared to the traditional .remove() callback .remove_new() returns no value. This is a good thing because the driver core doesn't (and cannot) cope for errors during remove. The only effect of a non-zero return value in .remove() is that the driver core emits a warning. The device is removed anyhow and an early return from .remove() usually yields a resource leak.
By changing the remove callback to return void driver authors cannot reasonably assume any more that there is some kind of cleanup later.
All drivers touched here returned zero unconditionally in their remove callback, so they could all be converted trivially to .remove_new().
Once all drivers are converted to .remove_new(), .remove() will be changed to match today's .remove_new(). Then the drivers here will be converted back trivially using s/remove_new/remove/. Given the amount of platform drivers this is still a bit in the future, though.
Best regards
Uwe
Uwe Kleine-König (12):
ata/pata_arasan_cf: Convert to platform remove callback returning void ata/pata_ep93xx: Convert to platform remove callback returning void ata/pata_ftide010: Convert to platform remove callback returning void ata/pata_imx: Convert to platform remove callback returning void ata/pata_mpc52xx: Convert to platform remove callback returning void ata/pata_pxa: Convert to platform remove callback returning void ata/pata_rb532_cf: Convert to platform remove callback returning void ata/sata_dwc_460ex: Convert to platform remove callback returning void ata/sata_fsl: Convert to platform remove callback returning void ata/sata_gemini: Convert to platform remove callback returning void ata/sata_mv: Convert to platform remove callback returning void ata/sata_rcar: Convert to platform remove callback returning void
drivers/ata/pata_arasan_cf.c | 6 ++---- drivers/ata/pata_ep93xx.c | 5 ++--- drivers/ata/pata_ftide010.c | 6 ++---- drivers/ata/pata_imx.c | 6 ++---- drivers/ata/pata_mpc52xx.c | 6 ++---- drivers/ata/pata_pxa.c | 6 ++---- drivers/ata/pata_rb532_cf.c | 6 ++---- drivers/ata/sata_dwc_460ex.c | 5 ++--- drivers/ata/sata_fsl.c | 6 ++---- drivers/ata/sata_gemini.c | 6 ++---- drivers/ata/sata_mv.c | 5 ++--- drivers/ata/sata_rcar.c | 6 ++---- 12 files changed, 24 insertions(+), 45 deletions(-)
base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
Signature · 7 lines
2.39.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/12 ata/pata_arasan_cf: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/ata/pata_arasan_cf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/ata/pata_arasan_cf.c +2 -4
@@ -916,15 +916,13 @@ static int arasan_cf_probe(struct platform_device *pdev)return ret; } -static int arasan_cf_remove (struct platform_device *pdev) +static void arasan_cf_remove (struct platform_device *pdev) {struct ata_host *host =platform_get_drvdata (pdev);struct arasan_cf_dev *acdev = host->ports[0 ]->private_data;ata_host_detach (host);cf_exit (acdev); - -return 0 ; }#ifdef CONFIG_PM_SLEEP
@@ -965,7 +963,7 @@ MODULE_DEVICE_TABLE(of, arasan_cf_id_table);static struct platform_driver arasan_cf_driver = { .probe = arasan_cf_probe, - .remove = arasan_cf_remove, + .remove_new = arasan_cf_remove, .driver = { .name =DRIVER_NAME , .pm = &arasan_cf_pm_ops,
Signature · 1 line
2.39.2
Re: [PATCH 01/12] ata/pata_arasan_cf: Convert to platform remove callback returning void
Quoted 39 lines · Uwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/ata/pata_arasan_cf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/ata/pata_arasan_cf.c +1
-3@@ -916,15 +916,13 @@ static int arasan_cf_probe(struct platform_device *pdev)return ret; } -static int arasan_cf_remove (struct platform_device *pdev) +static void arasan_cf_remove (struct platform_device *pdev) {struct ata_host *host =platform_get_drvdata (pdev);struct arasan_cf_dev *acdev = host->ports[0 ]->private_data;ata_host_detach (host);cf_exit (acdev); - -return 0 ; }#ifdef CONFIG_PM_SLEEP
drivers/ata/pata_arasan_cf.c MODULE_DEVICE_TABLE(of, arasan_cf_id_table); · line 969
Quoted 8 lines
drivers/ata/pata_arasan_cf.c +1
-1@@ -965,7 +963,7 @@ MODULE_DEVICE_TABLE(of, arasan_cf_id_table);static struct platform_driver arasan_cf_driver = { .probe = arasan_cf_probe, - .remove = arasan_cf_remove, + .remove_new = arasan_cf_remove, .driver = { .name =DRIVER_NAME , .pm = &arasan_cf_pm_ops,
Signature · 1 line
viresh
Re: [PATCH 01/12] ata/pata_arasan_cf: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigQuoted 9 lines · Uwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Quoted 4 lines
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Signed-off-by Uwe Kleine-König <[email protected]>
[...]
MBR, Sergey
PATCH 2/12 ata/pata_ep93xx: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/ata/pata_ep93xx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/ata/pata_ep93xx.c +2 -3
@@ -1004,7 +1004,7 @@ static int ep93xx_pata_probe(struct platform_device *pdev)return err; } -static int ep93xx_pata_remove (struct platform_device *pdev) +static void ep93xx_pata_remove (struct platform_device *pdev) {struct ata_host *host =platform_get_drvdata (pdev);struct ep93xx_pata_data *drv_data = host->private_data;
@@ -1013,7 +1013,6 @@ static int ep93xx_pata_remove(struct platform_device *pdev)ep93xx_pata_release_dma (drv_data);ep93xx_pata_clear_regs (drv_data->ide_base);ep93xx_ide_release_gpio (pdev); -return 0 ; }static struct platform_driver ep93xx_pata_platform_driver = {
@@ -1021,7 +1020,7 @@ static struct platform_driver ep93xx_pata_platform_driver = { .name = DRV_NAME, }, .probe = ep93xx_pata_probe, - .remove = ep93xx_pata_remove, + .remove_new = ep93xx_pata_remove, };module_platform_driver (ep93xx_pata_platform_driver);
Signature · 1 line
2.39.2
Re: [PATCH 02/12] ata/pata_ep93xx: Convert to platform remove callback returning void
Quoted 9 lines · Uwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Quoted 4 lines
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Signed-off-by Uwe Kleine-König <[email protected]>
[...]
MBR, Sergey
PATCH 3/12 ata/pata_ftide010: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/ata/pata_ftide010.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/ata/pata_ftide010.c +2 -4
@@ -541,15 +541,13 @@ static int pata_ftide010_probe(struct platform_device *pdev)return ret; } -static int pata_ftide010_remove (struct platform_device *pdev) +static void pata_ftide010_remove (struct platform_device *pdev) {struct ata_host *host =platform_get_drvdata (pdev);struct ftide010 *ftide = host->private_data;ata_host_detach (ftide->host);clk_disable_unprepare (ftide->pclk); - -return 0 ; }static const struct of_device_id pata_ftide010_of_match[] = {
@@ -563,7 +561,7 @@ static struct platform_driver pata_ftide010_driver = { .of_match_table = pata_ftide010_of_match, }, .probe = pata_ftide010_probe, - .remove = pata_ftide010_remove, + .remove_new = pata_ftide010_remove, };module_platform_driver (pata_ftide010_driver);
Signature · 1 line
2.39.2
Re: [PATCH 03/12] ata/pata_ftide010: Convert to platform remove callback returning void
Quoted 9 lines · Uwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Quoted 4 lines
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Signed-off-by Uwe Kleine-König <[email protected]>
[...]
MBR, Sergey
PATCH 4/12 ata/pata_imx: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/ata/pata_imx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/ata/pata_imx.c +2 -4
@@ -204,7 +204,7 @@ static int pata_imx_probe(struct platform_device *pdev)return ret; } -static int pata_imx_remove (struct platform_device *pdev) +static void pata_imx_remove (struct platform_device *pdev) {struct ata_host *host =platform_get_drvdata (pdev);struct pata_imx_priv *priv = host->private_data;
@@ -214,8 +214,6 @@ static int pata_imx_remove(struct platform_device *pdev)__raw_writel (0 , priv->host_regs +PATA_IMX_ATA_INT_EN );clk_disable_unprepare (priv->clk); - -return 0 ; }#ifdef CONFIG_PM_SLEEP
@@ -266,7 +264,7 @@ MODULE_DEVICE_TABLE(of, imx_pata_dt_ids);static struct platform_driver pata_imx_driver = { .probe = pata_imx_probe, - .remove = pata_imx_remove, + .remove_new = pata_imx_remove, .driver = { .name =DRV_NAME , .of_match_table = imx_pata_dt_ids,
Signature · 7 lines
2.39.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 04/12] ata/pata_imx: Convert to platform remove callback returning void
Quoted 9 lines · Uwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Quoted 4 lines
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Signed-off-by Uwe Kleine-König <[email protected]>
[...]
MBR, Sergey
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 5/12 ata/pata_mpc52xx: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/ata/pata_mpc52xx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/ata/pata_mpc52xx.c +2 -4
@@ -800,7 +800,7 @@ static int mpc52xx_ata_probe(struct platform_device *op)return rv; } -static int +static void mpc52xx_ata_remove (struct platform_device *op) {struct ata_host *host =platform_get_drvdata (op);
@@ -815,8 +815,6 @@ mpc52xx_ata_remove(struct platform_device *op)irq_dispose_mapping (task_irq);bcom_ata_release (priv->dmatsk);irq_dispose_mapping (priv->ata_irq); - -return 0 ; }#ifdef CONFIG_PM_SLEEP
@@ -857,7 +855,7 @@ static const struct of_device_id mpc52xx_ata_of_match[] = {static struct platform_driver mpc52xx_ata_of_platform_driver = { .probe = mpc52xx_ata_probe, - .remove = mpc52xx_ata_remove, + .remove_new = mpc52xx_ata_remove, #ifdef CONFIG_PM_SLEEP .suspend = mpc52xx_ata_suspend, .resume = mpc52xx_ata_resume,
Signature · 1 line
2.39.2
Damien Le Moal
maintainerRe: [PATCH 05/12] ata/pata_mpc52xx: Convert to platform remove callback returning void
Quoted 22 lines · Uwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/ata/pata_mpc52xx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/ata/pata_mpc52xx.c +0
-0
drivers/ata/pata_mpc52xx.c static int mpc52xx_ata_probe(struct platform_device *op) · line 804
Quoted 6 lines
drivers/ata/pata_mpc52xx.c +1
-1@@ -800,7 +800,7 @@ static int mpc52xx_ata_probe(struct platform_device *op)return rv; } -static int +static void mpc52xx_ata_remove (struct platform_device *op)
While at it, it would be nice to remove the unusual line break here. Will do that when applying.
Quoted 20 lines
drivers/ata/pata_mpc52xx.c +1
-3{struct ata_host *host =platform_get_drvdata (op);@@ -815,8 +815,6 @@ mpc52xx_ata_remove(struct platform_device *op)irq_dispose_mapping (task_irq);bcom_ata_release (priv->dmatsk);irq_dispose_mapping (priv->ata_irq); - -return 0 ; }#ifdef CONFIG_PM_SLEEP @@ -857,7 +855,7 @@ static const struct of_device_id mpc52xx_ata_of_match[] = {static struct platform_driver mpc52xx_ata_of_platform_driver = { .probe = mpc52xx_ata_probe, - .remove = mpc52xx_ata_remove, + .remove_new = mpc52xx_ata_remove, #ifdef CONFIG_PM_SLEEP .suspend = mpc52xx_ata_suspend, .resume = mpc52xx_ata_resume,
Signature · 2 lines
Damien Le Moal Western Digital Research
Re: [PATCH 05/12] ata/pata_mpc52xx: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigQuoted 9 lines · Uwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Quoted 4 lines
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Signed-off-by Uwe Kleine-König <[email protected]>
[...]
MBR, Sergey
PATCH 6/12 ata/pata_pxa: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/ata/pata_pxa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/ata/pata_pxa.c +2 -4
@@ -295,7 +295,7 @@ static int pxa_ata_probe(struct platform_device *pdev)return ret; } -static int pxa_ata_remove (struct platform_device *pdev) +static void pxa_ata_remove (struct platform_device *pdev) {struct ata_host *host =platform_get_drvdata (pdev);struct pata_pxa_data *data = host->ports[0 ]->private_data;
@@ -303,13 +303,11 @@ static int pxa_ata_remove(struct platform_device *pdev)dma_release_channel (data->dma_chan);ata_host_detach (host); - -return 0 ; }static struct platform_driver pxa_ata_driver = { .probe = pxa_ata_probe, - .remove = pxa_ata_remove, + .remove_new = pxa_ata_remove, .driver = { .name =DRV_NAME , },
Signature · 1 line
2.39.2
Re: [PATCH 06/12] ata/pata_pxa: Convert to platform remove callback returning void
Quoted 9 lines · Uwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Quoted 4 lines
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Signed-off-by Uwe Kleine-König <[email protected]>
[...]
MBR, Sergey
PATCH 7/12 ata/pata_rb532_cf: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/ata/pata_rb532_cf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/ata/pata_rb532_cf.c +2 -4
@@ -155,18 +155,16 @@ static int rb532_pata_driver_probe(struct platform_device *pdev)return 0 ; } -static int rb532_pata_driver_remove (struct platform_device *pdev) +static void rb532_pata_driver_remove (struct platform_device *pdev) {struct ata_host *ah =platform_get_drvdata (pdev);ata_host_detach (ah); - -return 0 ; }static struct platform_driver rb532_pata_platform_driver = { .probe = rb532_pata_driver_probe, - .remove = rb532_pata_driver_remove, + .remove_new = rb532_pata_driver_remove, .driver = { .name =DRV_NAME , },
Signature · 1 line
2.39.2
Re: [PATCH 07/12] ata/pata_rb532_cf: Convert to platform remove callback returning void
Quoted 9 lines · Uwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Quoted 4 lines
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Signed-off-by Uwe Kleine-König <[email protected]>
[...]
MBR, Sergey
PATCH 8/12 ata/sata_dwc_460ex: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/ata/sata_dwc_460ex.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/ata/sata_dwc_460ex.c +2 -3
@@ -1211,7 +1211,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)return err; } -static int sata_dwc_remove (struct platform_device *ofdev) +static void sata_dwc_remove (struct platform_device *ofdev) {struct device *dev = &ofdev->dev;struct ata_host *host =dev_get_drvdata (dev);
@@ -1227,7 +1227,6 @@ static int sata_dwc_remove(struct platform_device *ofdev)#endif dev_dbg (dev,"done\n" ); -return 0 ; }static const struct of_device_id sata_dwc_match[] = {
@@ -1242,7 +1241,7 @@ static struct platform_driver sata_dwc_driver = { .of_match_table = sata_dwc_match, }, .probe = sata_dwc_probe, - .remove = sata_dwc_remove, + .remove_new = sata_dwc_remove, };module_platform_driver (sata_dwc_driver);
Signature · 1 line
2.39.2
PATCH 9/12 ata/sata_fsl: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/ata/sata_fsl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/ata/sata_fsl.c +2 -4
@@ -1526,7 +1526,7 @@ static int sata_fsl_probe(struct platform_device *ofdev)return retval; } -static int sata_fsl_remove (struct platform_device *ofdev) +static void sata_fsl_remove (struct platform_device *ofdev) {struct ata_host *host =platform_get_drvdata (ofdev);struct sata_fsl_host_priv *host_priv = host->private_data;
@@ -1535,8 +1535,6 @@ static int sata_fsl_remove(struct platform_device *ofdev)device_remove_file (&ofdev->dev, &host_priv->rx_watermark);ata_host_detach (host); - -return 0 ; }#ifdef CONFIG_PM_SLEEP
@@ -1591,7 +1589,7 @@ static struct platform_driver fsl_sata_driver = { .of_match_table = fsl_sata_match, }, .probe = sata_fsl_probe, - .remove = sata_fsl_remove, + .remove_new = sata_fsl_remove, #ifdef CONFIG_PM_SLEEP .suspend = sata_fsl_suspend, .resume = sata_fsl_resume,
Signature · 1 line
2.39.2
PATCH 10/12 ata/sata_gemini: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/ata/sata_gemini.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/ata/sata_gemini.c +2 -4
@@ -400,7 +400,7 @@ static int gemini_sata_probe(struct platform_device *pdev)return ret; } -static int gemini_sata_remove (struct platform_device *pdev) +static void gemini_sata_remove (struct platform_device *pdev) {struct sata_gemini *sg =platform_get_drvdata (pdev);
@@ -409,8 +409,6 @@ static int gemini_sata_remove(struct platform_device *pdev)clk_unprepare (sg->sata0_pclk); } sg_singleton =NULL ; - -return 0 ; }static const struct of_device_id gemini_sata_of_match[] = {
@@ -424,7 +422,7 @@ static struct platform_driver gemini_sata_driver = { .of_match_table = gemini_sata_of_match, }, .probe = gemini_sata_probe, - .remove = gemini_sata_remove, + .remove_new = gemini_sata_remove, };module_platform_driver (gemini_sata_driver);
Signature · 1 line
2.39.2
Re: [PATCH 10/12] ata/sata_gemini: Convert to platform remove callback returning void
Quoted 9 lines · Uwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Quoted 4 lines
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Signed-off-by Uwe Kleine-König <[email protected]>
Yours,
Linus Walleij
PATCH 11/12 ata/sata_mv: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/ata/sata_mv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/ata/sata_mv.c +2 -3
@@ -4210,7 +4210,7 @@ static int mv_platform_probe(struct platform_device *pdev)* A platform bus SATA device has been unplugged. Perform the needed * cleanup. Also called on module unload for any active devices. */ -static int mv_platform_remove (struct platform_device *pdev) +static void mv_platform_remove (struct platform_device *pdev) {struct ata_host *host =platform_get_drvdata (pdev);struct mv_host_priv *hpriv = host->private_data;
@@ -4228,7 +4228,6 @@ static int mv_platform_remove(struct platform_device *pdev) }phy_power_off (hpriv->port_phys[port]); } -return 0 ; }#ifdef CONFIG_PM_SLEEP
@@ -4284,7 +4283,7 @@ MODULE_DEVICE_TABLE(of, mv_sata_dt_ids);static struct platform_driver mv_platform_driver = { .probe = mv_platform_probe, - .remove = mv_platform_remove, + .remove_new = mv_platform_remove, .suspend = mv_platform_suspend, .resume = mv_platform_resume, .driver = {
Signature · 1 line
2.39.2
PATCH 12/12 ata/sata_rcar: Convert to platform remove callback returning void
In reply to Uwe Kleine-KönigThe .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- drivers/ata/sata_rcar.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/ata/sata_rcar.c +2 -4
@@ -914,7 +914,7 @@ static int sata_rcar_probe(struct platform_device *pdev)return ret; } -static int sata_rcar_remove (struct platform_device *pdev) +static void sata_rcar_remove (struct platform_device *pdev) {struct ata_host *host =platform_get_drvdata (pdev);struct sata_rcar_priv *priv = host->private_data;
@@ -930,8 +930,6 @@ static int sata_rcar_remove(struct platform_device *pdev)pm_runtime_put (&pdev->dev);pm_runtime_disable (&pdev->dev); - -return 0 ; }#ifdef CONFIG_PM_SLEEP
@@ -1016,7 +1014,7 @@ static const struct dev_pm_ops sata_rcar_pm_ops = {static struct platform_driver sata_rcar_driver = { .probe = sata_rcar_probe, - .remove = sata_rcar_remove, + .remove_new = sata_rcar_remove, .driver = { .name =DRV_NAME , .of_match_table = sata_rcar_match,
Signature · 1 line
2.39.2
Re: [PATCH 12/12] ata/sata_rcar: Convert to platform remove callback returning void
Quoted 9 lines · Uwe Kleine-König
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove().
Quoted 4 lines
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Signed-off-by Uwe Kleine-König <[email protected]>
[...]
MBR, Sergey
Quoted 13 lines · Uwe Kleine-König
Hello,
this series adapts the platform drivers below
drivers/atato use the .remove_new() callback. Compared to the traditional .remove() callback .remove_new() returns no value. This is a good thing because the driver core doesn't (and cannot) cope for errors during remove. The only effect of a non-zero return value in .remove() is that the driver core emits a warning. The device is removed anyhow and an early return from .remove() usually yields a resource leak.By changing the remove callback to return void driver authors cannot reasonably assume any more that there is some kind of cleanup later.
Quoted 7 lines
All drivers touched here returned zero unconditionally in their remove callback, so they could all be converted trivially to .remove_new().
Once all drivers are converted to .remove_new(), .remove() will be changed to match today's .remove_new(). Then the drivers here will be converted back trivially using s/remove_new/remove/. Given the amount of platform drivers this is still a bit in the future, though.
Applied to for-6.6 with minor tweaks to the patch titles prefix. Thanks !
Signature · 2 lines
Damien Le Moal Western Digital Research