sparc: Convert to platform remove callback returning void
cover sparc: Convert to platform remove callback returning void
Hello,
this series converts the two platform drivers that have a remove callback below arch/sparc to implement remove_new instead. See commit 5c5a7680e67b ("platform: Provide a remove callback that returns no value") for an extended explanation and the eventual goal.
All conversations are trivial, because the driver's .remove() callbacks returned zero unconditionally already.
There are no interdependencies between the two patches, so they could be picked up individually if need be. This is merge window material.
Best regards
Uwe
Uwe Kleine-König (2):
sparc: parport: Convert to platform remove callback returning void
sparc: chmc: Convert to platform remove callback returning void
arch/sparc/include/asm/parport_64.h | 6 ++---- arch/sparc/kernel/chmc.c | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-)
base-commit: 6ebf211bb11dfc004a2ff73a9de5386fa309c430
Signature · 1 line
2.43.0
PATCH 1/2 sparc: parport: 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() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- arch/sparc/include/asm/parport_64.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/sparc/include/asm/parport_64.h +2 -4
@@ -196,7 +196,7 @@ static int ecpp_probe(struct platform_device *op)return err; } -static int ecpp_remove (struct platform_device *op) +static void ecpp_remove (struct platform_device *op) {struct parport *p =dev_get_drvdata (&op->dev);int slot = p->dma;
@@ -216,8 +216,6 @@ static int ecpp_remove(struct platform_device *op) d_len);clear_bit (slot, dma_slot_map); } - -return 0 ; }static const struct of_device_id ecpp_match[] = {
@@ -245,7 +243,7 @@ static struct platform_driver ecpp_driver = { .of_match_table = ecpp_match, }, .probe = ecpp_probe, - .remove = ecpp_remove, + .remove_new = ecpp_remove, };static int parport_pc_find_nonpci_ports (int autoirq,int autodma)
Signature · 1 line
2.43.0
PATCH 2/2 sparc: chmc: 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() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
--- arch/sparc/kernel/chmc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/sparc/kernel/chmc.c +2 -3
@@ -788,7 +788,7 @@ static void jbusmc_destroy(struct platform_device *op, struct jbusmc *p)kfree (p); } -static int us3mc_remove (struct platform_device *op) +static void us3mc_remove (struct platform_device *op) {void *p =dev_get_drvdata (&op->dev);
@@ -798,7 +798,6 @@ static int us3mc_remove(struct platform_device *op)else if (mc_type ==MC_TYPE_JBUS )jbusmc_destroy (op, p); } -return 0 ; }static const struct of_device_id us3mc_match[] = {
@@ -815,7 +814,7 @@ static struct platform_driver us3mc_driver = { .of_match_table = us3mc_match, }, .probe = us3mc_probe, - .remove = us3mc_remove, + .remove_new = us3mc_remove, };static inline bool us3mc_platform (void )
Signature · 1 line
2.43.0
Quoted 20 lines · Uwe Kleine-König
Hello,
this series converts the two platform drivers that have a remove callback below
arch/sparcto implementremove_newinstead. See commit5c5a7680e67b("platform: Provide a remove callback that returns no value") for an extended explanation and the eventual goal.All conversations are trivial, because the driver's .remove() callbacks returned zero unconditionally already.
There are no interdependencies between the two patches, so they could be picked up individually if need be. This is merge window material.
Best regards
UweUwe Kleine-König (2):
sparc: parport: Convert to platform remove callback returning void
sparc: chmc: Convert to platform remove callback returning void
Quoted 5 lines
arch/sparc/include/asm/parport_64.h | 6 ++---- arch/sparc/kernel/chmc.c | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-)base-commit:
6ebf211bb11dfc004a2ff73a9de5386fa309c430
Picking the series up to my for-next
Thanks,
Andreas