* [PATCH 00/11] misc: Convert to platform remove callback returning void
@ 2024-02-21 9:53 Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 01/11] misc: atmel-ssc: " Uwe Kleine-König
` (11 more replies)
0 siblings, 12 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman
Cc: kernel, Claudiu Beznea, Nicolas Ferre, Alexandre Belloni,
linux-arm-kernel, linux-kernel, Frederic Barrat,
Andrew Donnellan, linuxppc-dev, Srinivas Kandagatla,
Amol Maheshwari, linux-arm-msm, John Stultz, Tomas Winkler,
Jiri Slaby (SUSE),
Justin Stitt, Kees Cook, Derek Kiernan, Dragan Cvetic,
Michal Simek, Appana Durga Kedareswara rao
Hello,
this series converts all drivers below drivers/misc to struct
platform_driver::remove_new(). 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 their .remove() callbacks
returned zero unconditionally.
There are no interdependencies between these patches, so they could be
picked up individually. But I'd hope that Greg or Arnd picks them up all
together.
Best regards
Uwe
Uwe Kleine-König (11):
misc: atmel-ssc: Convert to platform remove callback returning void
cxl: Convert to platform remove callback returning void
misc: fastrpc: Convert to platform remove callback returning void
misc: hisi_hikey_usb: Convert to platform remove callback returning
void
mei: vsc: Convert to platform remove callback returning void
misc: open-dice: Convert to platform remove callback returning void
misc: sram: Convert to platform remove callback returning void
misc: ti-st: st_kim: Convert to platform remove callback returning
void
misc: vcpu_stall_detector: Convert to platform remove callback
returning void
misc: xilinx_sdfec: Convert to platform remove callback returning void
misc: xilinx_tmr_inject: Convert to platform remove callback returning
void
drivers/misc/atmel-ssc.c | 6 ++----
drivers/misc/cxl/of.c | 5 ++---
drivers/misc/fastrpc.c | 6 ++----
drivers/misc/hisi_hikey_usb.c | 6 ++----
drivers/misc/mei/platform-vsc.c | 6 ++----
drivers/misc/open-dice.c | 5 ++---
drivers/misc/sram.c | 6 ++----
drivers/misc/ti-st/st_kim.c | 5 ++---
drivers/misc/vcpu_stall_detector.c | 6 ++----
drivers/misc/xilinx_sdfec.c | 5 ++---
drivers/misc/xilinx_tmr_inject.c | 5 ++---
11 files changed, 22 insertions(+), 39 deletions(-)
base-commit: 4893c639cc3659cefaa675bf1e59f4e7571afb5c
--
2.43.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 01/11] misc: atmel-ssc: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
@ 2024-02-21 9:53 ` Uwe Kleine-König
2024-02-21 13:49 ` Nicolas.Ferre
2024-02-21 9:53 ` [PATCH 02/11] cxl: " Uwe Kleine-König
` (10 subsequent siblings)
11 siblings, 1 reply; 18+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman
Cc: kernel, Claudiu Beznea, Nicolas Ferre, Alexandre Belloni,
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 ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/misc/atmel-ssc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
index ee590c4a1537..6eac0f335915 100644
--- a/drivers/misc/atmel-ssc.c
+++ b/drivers/misc/atmel-ssc.c
@@ -251,7 +251,7 @@ static int ssc_probe(struct platform_device *pdev)
return 0;
}
-static int ssc_remove(struct platform_device *pdev)
+static void ssc_remove(struct platform_device *pdev)
{
struct ssc_device *ssc = platform_get_drvdata(pdev);
@@ -260,8 +260,6 @@ static int ssc_remove(struct platform_device *pdev)
mutex_lock(&user_lock);
list_del(&ssc->list);
mutex_unlock(&user_lock);
-
- return 0;
}
static struct platform_driver ssc_driver = {
@@ -271,7 +269,7 @@ static struct platform_driver ssc_driver = {
},
.id_table = atmel_ssc_devtypes,
.probe = ssc_probe,
- .remove = ssc_remove,
+ .remove_new = ssc_remove,
};
module_platform_driver(ssc_driver);
--
2.43.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 02/11] cxl: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 01/11] misc: atmel-ssc: " Uwe Kleine-König
@ 2024-02-21 9:53 ` Uwe Kleine-König
2024-02-22 2:46 ` Andrew Donnellan
2024-02-21 9:53 ` [PATCH 03/11] misc: fastrpc: " Uwe Kleine-König
` (9 subsequent siblings)
11 siblings, 1 reply; 18+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman
Cc: kernel, Frederic Barrat, Andrew Donnellan, linuxppc-dev, 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 ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/misc/cxl/of.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c
index 25ce725035e7..bcc005dff1c0 100644
--- a/drivers/misc/cxl/of.c
+++ b/drivers/misc/cxl/of.c
@@ -431,7 +431,7 @@ int cxl_of_read_adapter_properties(struct cxl *adapter, struct device_node *np)
return 0;
}
-static int cxl_of_remove(struct platform_device *pdev)
+static void cxl_of_remove(struct platform_device *pdev)
{
struct cxl *adapter;
int afu;
@@ -441,7 +441,6 @@ static int cxl_of_remove(struct platform_device *pdev)
cxl_guest_remove_afu(adapter->afu[afu]);
cxl_guest_remove_adapter(adapter);
- return 0;
}
static void cxl_of_shutdown(struct platform_device *pdev)
@@ -501,6 +500,6 @@ struct platform_driver cxl_of_driver = {
.owner = THIS_MODULE
},
.probe = cxl_of_probe,
- .remove = cxl_of_remove,
+ .remove_new = cxl_of_remove,
.shutdown = cxl_of_shutdown,
};
--
2.43.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 03/11] misc: fastrpc: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 01/11] misc: atmel-ssc: " Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 02/11] cxl: " Uwe Kleine-König
@ 2024-02-21 9:53 ` Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 04/11] misc: hisi_hikey_usb: " Uwe Kleine-König
` (8 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman
Cc: kernel, Srinivas Kandagatla, Amol Maheshwari, linux-arm-msm,
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 ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/misc/fastrpc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 03319a1fa97f..0bfff1d42da2 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -2183,7 +2183,7 @@ static int fastrpc_cb_probe(struct platform_device *pdev)
return 0;
}
-static int fastrpc_cb_remove(struct platform_device *pdev)
+static void fastrpc_cb_remove(struct platform_device *pdev)
{
struct fastrpc_channel_ctx *cctx = dev_get_drvdata(pdev->dev.parent);
struct fastrpc_session_ctx *sess = dev_get_drvdata(&pdev->dev);
@@ -2198,8 +2198,6 @@ static int fastrpc_cb_remove(struct platform_device *pdev)
}
}
spin_unlock_irqrestore(&cctx->lock, flags);
-
- return 0;
}
static const struct of_device_id fastrpc_match_table[] = {
@@ -2209,7 +2207,7 @@ static const struct of_device_id fastrpc_match_table[] = {
static struct platform_driver fastrpc_cb_driver = {
.probe = fastrpc_cb_probe,
- .remove = fastrpc_cb_remove,
+ .remove_new = fastrpc_cb_remove,
.driver = {
.name = "qcom,fastrpc-cb",
.of_match_table = fastrpc_match_table,
--
2.43.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 04/11] misc: hisi_hikey_usb: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
` (2 preceding siblings ...)
2024-02-21 9:53 ` [PATCH 03/11] misc: fastrpc: " Uwe Kleine-König
@ 2024-02-21 9:53 ` Uwe Kleine-König
2024-02-21 19:16 ` John Stultz
2024-02-21 9:53 ` [PATCH 05/11] mei: vsc: " Uwe Kleine-König
` (7 subsequent siblings)
11 siblings, 1 reply; 18+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman; +Cc: kernel, John Stultz, 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 ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/misc/hisi_hikey_usb.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/hisi_hikey_usb.c b/drivers/misc/hisi_hikey_usb.c
index 2165ec35a343..8f55db8938e6 100644
--- a/drivers/misc/hisi_hikey_usb.c
+++ b/drivers/misc/hisi_hikey_usb.c
@@ -239,7 +239,7 @@ static int hisi_hikey_usb_probe(struct platform_device *pdev)
return 0;
}
-static int hisi_hikey_usb_remove(struct platform_device *pdev)
+static void hisi_hikey_usb_remove(struct platform_device *pdev)
{
struct hisi_hikey_usb *hisi_hikey_usb = platform_get_drvdata(pdev);
@@ -251,8 +251,6 @@ static int hisi_hikey_usb_remove(struct platform_device *pdev)
} else {
hub_power_ctrl(hisi_hikey_usb, HUB_VBUS_POWER_OFF);
}
-
- return 0;
}
static const struct of_device_id id_table_hisi_hikey_usb[] = {
@@ -263,7 +261,7 @@ MODULE_DEVICE_TABLE(of, id_table_hisi_hikey_usb);
static struct platform_driver hisi_hikey_usb_driver = {
.probe = hisi_hikey_usb_probe,
- .remove = hisi_hikey_usb_remove,
+ .remove_new = hisi_hikey_usb_remove,
.driver = {
.name = DEVICE_DRIVER_NAME,
.of_match_table = id_table_hisi_hikey_usb,
--
2.43.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 05/11] mei: vsc: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
` (3 preceding siblings ...)
2024-02-21 9:53 ` [PATCH 04/11] misc: hisi_hikey_usb: " Uwe Kleine-König
@ 2024-02-21 9:53 ` Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 06/11] misc: open-dice: " Uwe Kleine-König
` (6 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman; +Cc: kernel, Tomas Winkler, 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 ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/misc/mei/platform-vsc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/mei/platform-vsc.c b/drivers/misc/mei/platform-vsc.c
index 8d303c6c0000..6c9f00bcb94b 100644
--- a/drivers/misc/mei/platform-vsc.c
+++ b/drivers/misc/mei/platform-vsc.c
@@ -384,7 +384,7 @@ static int mei_vsc_probe(struct platform_device *pdev)
return ret;
}
-static int mei_vsc_remove(struct platform_device *pdev)
+static void mei_vsc_remove(struct platform_device *pdev)
{
struct mei_device *mei_dev = platform_get_drvdata(pdev);
@@ -395,8 +395,6 @@ static int mei_vsc_remove(struct platform_device *pdev)
mei_disable_interrupts(mei_dev);
mei_deregister(mei_dev);
-
- return 0;
}
static int mei_vsc_suspend(struct device *dev)
@@ -433,7 +431,7 @@ MODULE_DEVICE_TABLE(platform, mei_vsc_id_table);
static struct platform_driver mei_vsc_drv = {
.probe = mei_vsc_probe,
- .remove = mei_vsc_remove,
+ .remove_new = mei_vsc_remove,
.id_table = mei_vsc_id_table,
.driver = {
.name = MEI_VSC_DRV_NAME,
--
2.43.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 06/11] misc: open-dice: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
` (4 preceding siblings ...)
2024-02-21 9:53 ` [PATCH 05/11] mei: vsc: " Uwe Kleine-König
@ 2024-02-21 9:53 ` Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 07/11] misc: sram: " Uwe Kleine-König
` (5 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman; +Cc: 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 ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/misc/open-dice.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/open-dice.c b/drivers/misc/open-dice.c
index d279a4f195e2..1e3eb2aa44d9 100644
--- a/drivers/misc/open-dice.c
+++ b/drivers/misc/open-dice.c
@@ -165,12 +165,11 @@ static int __init open_dice_probe(struct platform_device *pdev)
return 0;
}
-static int open_dice_remove(struct platform_device *pdev)
+static void open_dice_remove(struct platform_device *pdev)
{
struct open_dice_drvdata *drvdata = platform_get_drvdata(pdev);
misc_deregister(&drvdata->misc);
- return 0;
}
static const struct of_device_id open_dice_of_match[] = {
@@ -179,7 +178,7 @@ static const struct of_device_id open_dice_of_match[] = {
};
static struct platform_driver open_dice_driver = {
- .remove = open_dice_remove,
+ .remove_new = open_dice_remove,
.driver = {
.name = DRIVER_NAME,
.of_match_table = open_dice_of_match,
--
2.43.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 07/11] misc: sram: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
` (5 preceding siblings ...)
2024-02-21 9:53 ` [PATCH 06/11] misc: open-dice: " Uwe Kleine-König
@ 2024-02-21 9:53 ` Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 08/11] misc: ti-st: st_kim: " Uwe Kleine-König
` (4 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman; +Cc: 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 ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/misc/sram.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index e248c0a8882f..546eb06a40d0 100644
--- a/drivers/misc/sram.c
+++ b/drivers/misc/sram.c
@@ -435,7 +435,7 @@ static int sram_probe(struct platform_device *pdev)
return ret;
}
-static int sram_remove(struct platform_device *pdev)
+static void sram_remove(struct platform_device *pdev)
{
struct sram_dev *sram = platform_get_drvdata(pdev);
@@ -443,8 +443,6 @@ static int sram_remove(struct platform_device *pdev)
if (sram->pool && gen_pool_avail(sram->pool) < gen_pool_size(sram->pool))
dev_err(sram->dev, "removed while SRAM allocated\n");
-
- return 0;
}
static struct platform_driver sram_driver = {
@@ -453,7 +451,7 @@ static struct platform_driver sram_driver = {
.of_match_table = sram_dt_ids,
},
.probe = sram_probe,
- .remove = sram_remove,
+ .remove_new = sram_remove,
};
static int __init sram_init(void)
--
2.43.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 08/11] misc: ti-st: st_kim: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
` (6 preceding siblings ...)
2024-02-21 9:53 ` [PATCH 07/11] misc: sram: " Uwe Kleine-König
@ 2024-02-21 9:53 ` Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 09/11] misc: vcpu_stall_detector: " Uwe Kleine-König
` (3 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman
Cc: kernel, Jiri Slaby (SUSE), Justin Stitt, Kees Cook, 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 ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/misc/ti-st/st_kim.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index 4b1be0bb6ac0..47ebe80bf849 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -774,7 +774,7 @@ static int kim_probe(struct platform_device *pdev)
return err;
}
-static int kim_remove(struct platform_device *pdev)
+static void kim_remove(struct platform_device *pdev)
{
/* free the GPIOs requested */
struct ti_st_plat_data *pdata = pdev->dev.platform_data;
@@ -798,7 +798,6 @@ static int kim_remove(struct platform_device *pdev)
kfree(kim_gdata);
kim_gdata = NULL;
- return 0;
}
static int kim_suspend(struct platform_device *pdev, pm_message_t state)
@@ -825,7 +824,7 @@ static int kim_resume(struct platform_device *pdev)
/* entry point for ST KIM module, called in from ST Core */
static struct platform_driver kim_platform_driver = {
.probe = kim_probe,
- .remove = kim_remove,
+ .remove_new = kim_remove,
.suspend = kim_suspend,
.resume = kim_resume,
.driver = {
--
2.43.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 09/11] misc: vcpu_stall_detector: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
` (7 preceding siblings ...)
2024-02-21 9:53 ` [PATCH 08/11] misc: ti-st: st_kim: " Uwe Kleine-König
@ 2024-02-21 9:53 ` Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 10/11] misc: xilinx_sdfec: " Uwe Kleine-König
` (2 subsequent siblings)
11 siblings, 0 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman; +Cc: 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 ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/misc/vcpu_stall_detector.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/vcpu_stall_detector.c b/drivers/misc/vcpu_stall_detector.c
index 6479c962da1a..e2015c87f03f 100644
--- a/drivers/misc/vcpu_stall_detector.c
+++ b/drivers/misc/vcpu_stall_detector.c
@@ -187,7 +187,7 @@ static int vcpu_stall_detect_probe(struct platform_device *pdev)
return ret;
}
-static int vcpu_stall_detect_remove(struct platform_device *pdev)
+static void vcpu_stall_detect_remove(struct platform_device *pdev)
{
int cpu;
@@ -195,8 +195,6 @@ static int vcpu_stall_detect_remove(struct platform_device *pdev)
for_each_possible_cpu(cpu)
stop_stall_detector_cpu(cpu);
-
- return 0;
}
static const struct of_device_id vcpu_stall_detect_of_match[] = {
@@ -208,7 +206,7 @@ MODULE_DEVICE_TABLE(of, vcpu_stall_detect_of_match);
static struct platform_driver vcpu_stall_detect_driver = {
.probe = vcpu_stall_detect_probe,
- .remove = vcpu_stall_detect_remove,
+ .remove_new = vcpu_stall_detect_remove,
.driver = {
.name = KBUILD_MODNAME,
.of_match_table = vcpu_stall_detect_of_match,
--
2.43.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 10/11] misc: xilinx_sdfec: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
` (8 preceding siblings ...)
2024-02-21 9:53 ` [PATCH 09/11] misc: vcpu_stall_detector: " Uwe Kleine-König
@ 2024-02-21 9:53 ` Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 11/11] misc: xilinx_tmr_inject: " Uwe Kleine-König
2024-02-21 13:52 ` [PATCH 00/11] misc: " Arnd Bergmann
11 siblings, 0 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman
Cc: kernel, Derek Kiernan, Dragan Cvetic, Michal Simek,
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 ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/misc/xilinx_sdfec.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
index 94a0ee19bf20..ea433695f4c4 100644
--- a/drivers/misc/xilinx_sdfec.c
+++ b/drivers/misc/xilinx_sdfec.c
@@ -1420,7 +1420,7 @@ static int xsdfec_probe(struct platform_device *pdev)
return err;
}
-static int xsdfec_remove(struct platform_device *pdev)
+static void xsdfec_remove(struct platform_device *pdev)
{
struct xsdfec_dev *xsdfec;
@@ -1428,7 +1428,6 @@ static int xsdfec_remove(struct platform_device *pdev)
misc_deregister(&xsdfec->miscdev);
ida_free(&dev_nrs, xsdfec->dev_id);
xsdfec_disable_all_clks(&xsdfec->clks);
- return 0;
}
static const struct of_device_id xsdfec_of_match[] = {
@@ -1445,7 +1444,7 @@ static struct platform_driver xsdfec_driver = {
.of_match_table = xsdfec_of_match,
},
.probe = xsdfec_probe,
- .remove = xsdfec_remove,
+ .remove_new = xsdfec_remove,
};
module_platform_driver(xsdfec_driver);
--
2.43.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 11/11] misc: xilinx_tmr_inject: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
` (9 preceding siblings ...)
2024-02-21 9:53 ` [PATCH 10/11] misc: xilinx_sdfec: " Uwe Kleine-König
@ 2024-02-21 9:53 ` Uwe Kleine-König
2024-02-21 13:52 ` [PATCH 00/11] misc: " Arnd Bergmann
11 siblings, 0 replies; 18+ messages in thread
From: Uwe Kleine-König @ 2024-02-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman
Cc: kernel, Appana Durga Kedareswara rao, Michal Simek,
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 ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/misc/xilinx_tmr_inject.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/xilinx_tmr_inject.c b/drivers/misc/xilinx_tmr_inject.c
index 9fc5835bfebc..73c6da7d0963 100644
--- a/drivers/misc/xilinx_tmr_inject.c
+++ b/drivers/misc/xilinx_tmr_inject.c
@@ -143,11 +143,10 @@ static int xtmr_inject_probe(struct platform_device *pdev)
return 0;
}
-static int xtmr_inject_remove(struct platform_device *pdev)
+static void xtmr_inject_remove(struct platform_device *pdev)
{
debugfs_remove_recursive(dbgfs_root);
dbgfs_root = NULL;
- return 0;
}
static const struct of_device_id xtmr_inject_of_match[] = {
@@ -164,7 +163,7 @@ static struct platform_driver xtmr_inject_driver = {
.of_match_table = xtmr_inject_of_match,
},
.probe = xtmr_inject_probe,
- .remove = xtmr_inject_remove,
+ .remove_new = xtmr_inject_remove,
};
module_platform_driver(xtmr_inject_driver);
MODULE_AUTHOR("Advanced Micro Devices, Inc");
--
2.43.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 01/11] misc: atmel-ssc: Convert to platform remove callback returning void
2024-02-21 9:53 ` [PATCH 01/11] misc: atmel-ssc: " Uwe Kleine-König
@ 2024-02-21 13:49 ` Nicolas.Ferre
0 siblings, 0 replies; 18+ messages in thread
From: Nicolas.Ferre @ 2024-02-21 13:49 UTC (permalink / raw)
To: u.kleine-koenig, arnd, gregkh
Cc: kernel, claudiu.beznea, alexandre.belloni, linux-arm-kernel,
linux-kernel
On 21/02/2024 at 10:53, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
>
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
>
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Thanks Uwe.
> ---
> drivers/misc/atmel-ssc.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
> index ee590c4a1537..6eac0f335915 100644
> --- a/drivers/misc/atmel-ssc.c
> +++ b/drivers/misc/atmel-ssc.c
> @@ -251,7 +251,7 @@ static int ssc_probe(struct platform_device *pdev)
> return 0;
> }
>
> -static int ssc_remove(struct platform_device *pdev)
> +static void ssc_remove(struct platform_device *pdev)
> {
> struct ssc_device *ssc = platform_get_drvdata(pdev);
>
> @@ -260,8 +260,6 @@ static int ssc_remove(struct platform_device *pdev)
> mutex_lock(&user_lock);
> list_del(&ssc->list);
> mutex_unlock(&user_lock);
> -
> - return 0;
> }
>
> static struct platform_driver ssc_driver = {
> @@ -271,7 +269,7 @@ static struct platform_driver ssc_driver = {
> },
> .id_table = atmel_ssc_devtypes,
> .probe = ssc_probe,
> - .remove = ssc_remove,
> + .remove_new = ssc_remove,
> };
> module_platform_driver(ssc_driver);
>
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 00/11] misc: Convert to platform remove callback returning void
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
` (10 preceding siblings ...)
2024-02-21 9:53 ` [PATCH 11/11] misc: xilinx_tmr_inject: " Uwe Kleine-König
@ 2024-02-21 13:52 ` Arnd Bergmann
2024-03-04 22:36 ` Uwe Kleine-König
11 siblings, 1 reply; 18+ messages in thread
From: Arnd Bergmann @ 2024-02-21 13:52 UTC (permalink / raw)
To: Uwe Kleine-König, Greg Kroah-Hartman
Cc: Alexandre Belloni, derek.kiernan, Andrew Donnellan, Jiri Slaby,
linux-arm-msm, linux-kernel, Claudiu Beznea, Michal Simek,
Srinivas Kandagatla, dragan.cvetic, Pengutronix Kernel Team,
Justin Stitt, Frederic Barrat, John Stultz, Tomas Winkler,
Amol Maheshwari, linuxppc-dev, Appana Durga Kedareswara rao,
linux-arm-kernel, Kees Cook
On Wed, Feb 21, 2024, at 10:53, Uwe Kleine-König wrote:
> Hello,
>
> this series converts all drivers below drivers/misc to struct
> platform_driver::remove_new(). 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 their .remove() callbacks
> returned zero unconditionally.
>
> There are no interdependencies between these patches, so they could be
> picked up individually. But I'd hope that Greg or Arnd picks them up all
> together.
These all look good to me, whole series
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 04/11] misc: hisi_hikey_usb: Convert to platform remove callback returning void
2024-02-21 9:53 ` [PATCH 04/11] misc: hisi_hikey_usb: " Uwe Kleine-König
@ 2024-02-21 19:16 ` John Stultz
0 siblings, 0 replies; 18+ messages in thread
From: John Stultz @ 2024-02-21 19:16 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Arnd Bergmann, Greg Kroah-Hartman, kernel, linux-kernel,
Yongqin Liu, Sumit Semwal
On Wed, Feb 21, 2024 at 1:54 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> 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 ignored (apart
> from emitting a warning) and this typically results in resource leaks.
>
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
>
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Looks fine to me.
Acked-by: John Stultz <jstultz@google.com>
CC'ing YongQin as he still has hardware to test with.
thanks
-john
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 02/11] cxl: Convert to platform remove callback returning void
2024-02-21 9:53 ` [PATCH 02/11] cxl: " Uwe Kleine-König
@ 2024-02-22 2:46 ` Andrew Donnellan
0 siblings, 0 replies; 18+ messages in thread
From: Andrew Donnellan @ 2024-02-22 2:46 UTC (permalink / raw)
To: Uwe Kleine-König, Arnd Bergmann, Greg Kroah-Hartman
Cc: kernel, Frederic Barrat, linuxppc-dev, linux-kernel
On Wed, 2024-02-21 at 10:53 +0100, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which
> makes
> many driver authors wrongly assume it's possible to do error handling
> by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource
> leaks.
>
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all
> drivers
> are converted, .remove_new() will be renamed to .remove().
>
> Trivially convert this driver from always returning zero in the
> remove
> callback to the void returning variant.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
> ---
> drivers/misc/cxl/of.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c
> index 25ce725035e7..bcc005dff1c0 100644
> --- a/drivers/misc/cxl/of.c
> +++ b/drivers/misc/cxl/of.c
> @@ -431,7 +431,7 @@ int cxl_of_read_adapter_properties(struct cxl
> *adapter, struct device_node *np)
> return 0;
> }
>
> -static int cxl_of_remove(struct platform_device *pdev)
> +static void cxl_of_remove(struct platform_device *pdev)
> {
> struct cxl *adapter;
> int afu;
> @@ -441,7 +441,6 @@ static int cxl_of_remove(struct platform_device
> *pdev)
> cxl_guest_remove_afu(adapter->afu[afu]);
>
> cxl_guest_remove_adapter(adapter);
> - return 0;
> }
>
> static void cxl_of_shutdown(struct platform_device *pdev)
> @@ -501,6 +500,6 @@ struct platform_driver cxl_of_driver = {
> .owner = THIS_MODULE
> },
> .probe = cxl_of_probe,
> - .remove = cxl_of_remove,
> + .remove_new = cxl_of_remove,
> .shutdown = cxl_of_shutdown,
> };
--
Andrew Donnellan OzLabs, ADL Canberra
ajd@linux.ibm.com IBM Australia Limited
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 00/11] misc: Convert to platform remove callback returning void
2024-02-21 13:52 ` [PATCH 00/11] misc: " Arnd Bergmann
@ 2024-03-04 22:36 ` Uwe Kleine-König
2024-03-04 23:42 ` Greg Kroah-Hartman
0 siblings, 1 reply; 18+ messages in thread
From: Uwe Kleine-König @ 2024-03-04 22:36 UTC (permalink / raw)
To: Arnd Bergmann, Greg Kroah-Hartman
Cc: Alexandre Belloni, derek.kiernan, Kees Cook, linux-arm-msm,
linuxppc-dev, linux-kernel, Claudiu Beznea, John Stultz,
Michal Simek, dragan.cvetic, Pengutronix Kernel Team,
Justin Stitt, Frederic Barrat, Srinivas Kandagatla,
Tomas Winkler, Amol Maheshwari, Jiri Slaby,
Appana Durga Kedareswara rao, linux-arm-kernel, Andrew Donnellan
[-- Attachment #1: Type: text/plain, Size: 1128 bytes --]
Hello Arnd, hello Greg,
On Wed, Feb 21, 2024 at 02:52:29PM +0100, Arnd Bergmann wrote:
> On Wed, Feb 21, 2024, at 10:53, Uwe Kleine-König wrote:
> > Hello,
> >
> > this series converts all drivers below drivers/misc to struct
> > platform_driver::remove_new(). 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 their .remove() callbacks
> > returned zero unconditionally.
> >
> > There are no interdependencies between these patches, so they could be
> > picked up individually. But I'd hope that Greg or Arnd picks them up all
> > together.
>
> These all look good to me, whole series
>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
Thanks.
You (= Arnd and Greg) are the listed maintainers for drivers/misc/. How
is this series supposed to be merged? Would a pull request help?
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] 18+ messages in thread
* Re: [PATCH 00/11] misc: Convert to platform remove callback returning void
2024-03-04 22:36 ` Uwe Kleine-König
@ 2024-03-04 23:42 ` Greg Kroah-Hartman
0 siblings, 0 replies; 18+ messages in thread
From: Greg Kroah-Hartman @ 2024-03-04 23:42 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Arnd Bergmann, Alexandre Belloni, derek.kiernan, Kees Cook,
linux-arm-msm, linuxppc-dev, linux-kernel, Claudiu Beznea,
John Stultz, Michal Simek, dragan.cvetic,
Pengutronix Kernel Team, Justin Stitt, Frederic Barrat,
Srinivas Kandagatla, Tomas Winkler, Amol Maheshwari, Jiri Slaby,
Appana Durga Kedareswara rao, linux-arm-kernel, Andrew Donnellan
On Mon, Mar 04, 2024 at 11:36:23PM +0100, Uwe Kleine-König wrote:
> Hello Arnd, hello Greg,
>
> On Wed, Feb 21, 2024 at 02:52:29PM +0100, Arnd Bergmann wrote:
> > On Wed, Feb 21, 2024, at 10:53, Uwe Kleine-König wrote:
> > > Hello,
> > >
> > > this series converts all drivers below drivers/misc to struct
> > > platform_driver::remove_new(). 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 their .remove() callbacks
> > > returned zero unconditionally.
> > >
> > > There are no interdependencies between these patches, so they could be
> > > picked up individually. But I'd hope that Greg or Arnd picks them up all
> > > together.
> >
> > These all look good to me, whole series
> >
> > Acked-by: Arnd Bergmann <arnd@arndb.de>
>
> Thanks.
>
> You (= Arnd and Greg) are the listed maintainers for drivers/misc/. How
> is this series supposed to be merged? Would a pull request help?
I can take the patchset, let me catch up...
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2024-03-04 23:42 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-21 9:53 [PATCH 00/11] misc: Convert to platform remove callback returning void Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 01/11] misc: atmel-ssc: " Uwe Kleine-König
2024-02-21 13:49 ` Nicolas.Ferre
2024-02-21 9:53 ` [PATCH 02/11] cxl: " Uwe Kleine-König
2024-02-22 2:46 ` Andrew Donnellan
2024-02-21 9:53 ` [PATCH 03/11] misc: fastrpc: " Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 04/11] misc: hisi_hikey_usb: " Uwe Kleine-König
2024-02-21 19:16 ` John Stultz
2024-02-21 9:53 ` [PATCH 05/11] mei: vsc: " Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 06/11] misc: open-dice: " Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 07/11] misc: sram: " Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 08/11] misc: ti-st: st_kim: " Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 09/11] misc: vcpu_stall_detector: " Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 10/11] misc: xilinx_sdfec: " Uwe Kleine-König
2024-02-21 9:53 ` [PATCH 11/11] misc: xilinx_tmr_inject: " Uwe Kleine-König
2024-02-21 13:52 ` [PATCH 00/11] misc: " Arnd Bergmann
2024-03-04 22:36 ` Uwe Kleine-König
2024-03-04 23:42 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®