* [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq
@ 2024-12-28 1:14 Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 01/12] PM: sleep: wakeirq: Introduce device-managed variant of dev_pm_set_wake_irq Peng Fan (OSS)
` (12 more replies)
0 siblings, 13 replies; 19+ messages in thread
From: Peng Fan (OSS) @ 2024-12-28 1:14 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Linus Walleij, Conor Dooley, Daire McNamara
Cc: linux-pm, linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
This was a retry to address [1][2], to let common code handle
dev_pm_clear_wake_irq. Then no need to call dev_pm_clear_wake_irq
in each driver.remove() hook and error handling path.
In this patchset, I include input and rtc patches to show the usage
to avoid that introducing an API without users. There are still
other places using dev_pm_clear_wake_irq. If this patchset is
good for you, I could start to clean up other drivers such as mmc and
etc.
[1] https://lore.kernel.org/all/20241111092131.1693319-1-peng.fan@oss.nxp.com/
[2] https://lore.kernel.org/all/ZymxvLMkkktRoCXZ@google.com/
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Peng Fan (12):
PM: sleep: wakeirq: Introduce device-managed variant of dev_pm_set_wake_irq
input: keyboard: ep93xx_keypad: Use devm_pm_set_wake_irq
input: keyboard: omap4_keypad: Use devm_pm_set_wake_irq
input: misc: nxp-bbnsm-pwrkey: Use resource managed API to simplify code
input: touchscreen: ti_am335x_tsc: Use resource managed API to simplify code
rtc: stm32: Use resource managed API to simplify code
rtc: nxp-bbnsm: Use resource managed API to simplify code
rtc: ds1343: Use devm_pm_set_wake_irq
rtc: pm8xxx: Use devm_pm_set_wake_irq
rtc: ab8500: Use resource managed API to simplify code
rtc: mpfs: Use devm_pm_set_wake_irq
rtc: pl031: Use resource managed API to simplify code
drivers/base/power/wakeirq.c | 25 ++++++++++++++++++
drivers/input/keyboard/ep93xx_keypad.c | 8 +-----
drivers/input/keyboard/omap4-keypad.c | 8 +-----
drivers/input/misc/nxp-bbnsm-pwrkey.c | 15 ++++-------
drivers/input/touchscreen/ti_am335x_tsc.c | 43 ++++++++++---------------------
drivers/rtc/rtc-ab8500.c | 11 ++------
drivers/rtc/rtc-ds1343.c | 8 +-----
drivers/rtc/rtc-mpfs.c | 8 +-----
drivers/rtc/rtc-nxp-bbnsm.c | 29 +++++++--------------
drivers/rtc/rtc-pl031.c | 6 ++---
drivers/rtc/rtc-pm8xxx.c | 12 +--------
drivers/rtc/rtc-stm32.c | 10 ++-----
include/linux/pm_wakeirq.h | 6 +++++
13 files changed, 70 insertions(+), 119 deletions(-)
---
base-commit: 8155b4ef3466f0e289e8fcc9e6e62f3f4dceeac2
change-id: 20241227-wake_irq-b68d604dd902
Best regards,
--
Peng Fan <peng.fan@nxp.com>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 01/12] PM: sleep: wakeirq: Introduce device-managed variant of dev_pm_set_wake_irq
2024-12-28 1:14 [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
@ 2024-12-28 1:14 ` Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 02/12] input: keyboard: ep93xx_keypad: Use devm_pm_set_wake_irq Peng Fan (OSS)
` (11 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Peng Fan (OSS) @ 2024-12-28 1:14 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Linus Walleij, Conor Dooley, Daire McNamara
Cc: linux-pm, linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add device-managed variant of dev_pm_set_wake_irq which automatically
clear the wake irq on device destruction to simplify error handling
and resource management in drivers.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/base/power/wakeirq.c | 25 +++++++++++++++++++++++++
include/linux/pm_wakeirq.h | 6 ++++++
2 files changed, 31 insertions(+)
diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c
index 5a5a9e978e85f3fc9d89cb7d43527dc1dd42a9b1..cdc445189f68479c54f85e84be09ae4f488df1b5 100644
--- a/drivers/base/power/wakeirq.c
+++ b/drivers/base/power/wakeirq.c
@@ -103,6 +103,31 @@ void dev_pm_clear_wake_irq(struct device *dev)
}
EXPORT_SYMBOL_GPL(dev_pm_clear_wake_irq);
+static void devm_pm_clear_wake_irq(void *dev)
+{
+ dev_pm_clear_wake_irq(dev);
+}
+
+/**
+ * devm_pm_set_wake_irq - device-managed variant of dev_pm_set_wake_irq
+ * @dev: Device entry
+ * @irq: Device IO interrupt
+ *
+ *
+ * Attach a device IO interrupt as a wake IRQ, same with dev_pm_set_wake_irq,
+ * but the device will be auto clear wake capability on driver detach.
+ */
+int devm_pm_set_wake_irq(struct device *dev, int irq)
+{
+ int ret;
+
+ ret = dev_pm_set_wake_irq(dev, irq);
+ if (ret)
+ return ret;
+
+ return devm_add_action_or_reset(dev, devm_pm_clear_wake_irq, dev);
+}
+
/**
* handle_threaded_wake_irq - Handler for dedicated wake-up interrupts
* @irq: Device specific dedicated wake-up interrupt
diff --git a/include/linux/pm_wakeirq.h b/include/linux/pm_wakeirq.h
index d9642c6cf85211af603ce39e280a5b4de6617ee5..25b63ed51b765c2c6919f259668a12675330835e 100644
--- a/include/linux/pm_wakeirq.h
+++ b/include/linux/pm_wakeirq.h
@@ -10,6 +10,7 @@ extern int dev_pm_set_wake_irq(struct device *dev, int irq);
extern int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq);
extern int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq);
extern void dev_pm_clear_wake_irq(struct device *dev);
+extern int devm_pm_set_wake_irq(struct device *dev, int irq);
#else /* !CONFIG_PM */
@@ -32,5 +33,10 @@ static inline void dev_pm_clear_wake_irq(struct device *dev)
{
}
+static inline int devm_pm_set_wake_irq(struct device *dev, int irq)
+{
+ return 0;
+}
+
#endif /* CONFIG_PM */
#endif /* _LINUX_PM_WAKEIRQ_H */
--
2.37.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 02/12] input: keyboard: ep93xx_keypad: Use devm_pm_set_wake_irq
2024-12-28 1:14 [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 01/12] PM: sleep: wakeirq: Introduce device-managed variant of dev_pm_set_wake_irq Peng Fan (OSS)
@ 2024-12-28 1:14 ` Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 03/12] input: keyboard: omap4_keypad: " Peng Fan (OSS)
` (10 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Peng Fan (OSS) @ 2024-12-28 1:14 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Linus Walleij, Conor Dooley, Daire McNamara
Cc: linux-pm, linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use devm_pm_set_wake_irq, then the 'driver.remove()' could be cleaned up.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/input/keyboard/ep93xx_keypad.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c
index 817c23438f6e5176431e1f736bb511f9919b67de..6e3cbe3ca72dbd43485c23f6042b4fba007ff5e6 100644
--- a/drivers/input/keyboard/ep93xx_keypad.c
+++ b/drivers/input/keyboard/ep93xx_keypad.c
@@ -260,18 +260,13 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, keypad);
device_init_wakeup(&pdev->dev, 1);
- err = dev_pm_set_wake_irq(&pdev->dev, keypad->irq);
+ err = devm_pm_set_wake_irq(&pdev->dev, keypad->irq);
if (err)
dev_warn(&pdev->dev, "failed to set up wakeup irq: %d\n", err);
return 0;
}
-static void ep93xx_keypad_remove(struct platform_device *pdev)
-{
- dev_pm_clear_wake_irq(&pdev->dev);
-}
-
static const struct of_device_id ep93xx_keypad_of_ids[] = {
{ .compatible = "cirrus,ep9307-keypad" },
{ /* sentinel */ }
@@ -285,7 +280,6 @@ static struct platform_driver ep93xx_keypad_driver = {
.of_match_table = ep93xx_keypad_of_ids,
},
.probe = ep93xx_keypad_probe,
- .remove = ep93xx_keypad_remove,
};
module_platform_driver(ep93xx_keypad_driver);
--
2.37.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 03/12] input: keyboard: omap4_keypad: Use devm_pm_set_wake_irq
2024-12-28 1:14 [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 01/12] PM: sleep: wakeirq: Introduce device-managed variant of dev_pm_set_wake_irq Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 02/12] input: keyboard: ep93xx_keypad: Use devm_pm_set_wake_irq Peng Fan (OSS)
@ 2024-12-28 1:14 ` Peng Fan (OSS)
2024-12-28 5:11 ` kernel test robot
2024-12-28 1:14 ` [PATCH 04/12] input: misc: nxp-bbnsm-pwrkey: Use resource managed API to simplify code Peng Fan (OSS)
` (9 subsequent siblings)
12 siblings, 1 reply; 19+ messages in thread
From: Peng Fan (OSS) @ 2024-12-28 1:14 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Linus Walleij, Conor Dooley, Daire McNamara
Cc: linux-pm, linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use devm_pm_set_wake_irq, then the 'driver.remove()' could be cleaned up.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/input/keyboard/omap4-keypad.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index bffe89c0717adf9ebe5b33892efa4dc30b158f83..b7bd649d1628a6bf10db4135f73778f62db92647 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -465,18 +465,13 @@ static int omap4_keypad_probe(struct platform_device *pdev)
}
device_init_wakeup(dev, true);
- error = dev_pm_set_wake_irq(dev, keypad_data->irq);
+ error = devm_pm_set_wake_irq(dev, keypad_data->irq);
if (error)
dev_warn(dev, "failed to set up wakeup irq: %d\n", error);
return 0;
}
-static void omap4_keypad_remove(struct platform_device *pdev)
-{
- dev_pm_clear_wake_irq(&pdev->dev);
-}
-
static const struct of_device_id omap_keypad_dt_match[] = {
{ .compatible = "ti,omap4-keypad" },
{},
@@ -485,7 +480,6 @@ MODULE_DEVICE_TABLE(of, omap_keypad_dt_match);
static struct platform_driver omap4_keypad_driver = {
.probe = omap4_keypad_probe,
- .remove = omap4_keypad_remove,
.driver = {
.name = "omap4-keypad",
.of_match_table = omap_keypad_dt_match,
--
2.37.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 04/12] input: misc: nxp-bbnsm-pwrkey: Use resource managed API to simplify code
2024-12-28 1:14 [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
` (2 preceding siblings ...)
2024-12-28 1:14 ` [PATCH 03/12] input: keyboard: omap4_keypad: " Peng Fan (OSS)
@ 2024-12-28 1:14 ` Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 05/12] input: touchscreen: ti_am335x_tsc: " Peng Fan (OSS)
` (8 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Peng Fan (OSS) @ 2024-12-28 1:14 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Linus Walleij, Conor Dooley, Daire McNamara
Cc: linux-pm, linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use devm_pm_set_wake_irq and devm_device_init_wakeup to cleanup the
'driver.remove()' hook.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/input/misc/nxp-bbnsm-pwrkey.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/input/misc/nxp-bbnsm-pwrkey.c b/drivers/input/misc/nxp-bbnsm-pwrkey.c
index 7ba8d166d68c18b396e616f6f9074ae98c4629b7..5faad2c98af35c52dcacbf25728dbaf2cbb3c625 100644
--- a/drivers/input/misc/nxp-bbnsm-pwrkey.c
+++ b/drivers/input/misc/nxp-bbnsm-pwrkey.c
@@ -179,20 +179,17 @@ static int bbnsm_pwrkey_probe(struct platform_device *pdev)
return error;
}
- device_init_wakeup(&pdev->dev, true);
- error = dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq);
+ error = devm_device_init_wakeup(&pdev->dev);
+ if (error)
+ return error;
+
+ error = devm_pm_set_wake_irq(&pdev->dev, bbnsm->irq);
if (error)
dev_warn(&pdev->dev, "irq wake enable failed.\n");
return 0;
}
-static void bbnsm_pwrkey_remove(struct platform_device *pdev)
-{
- dev_pm_clear_wake_irq(&pdev->dev);
- device_init_wakeup(&pdev->dev, false);
-}
-
static int __maybe_unused bbnsm_pwrkey_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
@@ -229,8 +226,6 @@ static struct platform_driver bbnsm_pwrkey_driver = {
.of_match_table = bbnsm_pwrkey_ids,
},
.probe = bbnsm_pwrkey_probe,
- .remove = bbnsm_pwrkey_remove,
-
};
module_platform_driver(bbnsm_pwrkey_driver);
--
2.37.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 05/12] input: touchscreen: ti_am335x_tsc: Use resource managed API to simplify code
2024-12-28 1:14 [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
` (3 preceding siblings ...)
2024-12-28 1:14 ` [PATCH 04/12] input: misc: nxp-bbnsm-pwrkey: Use resource managed API to simplify code Peng Fan (OSS)
@ 2024-12-28 1:14 ` Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 06/12] rtc: stm32: " Peng Fan (OSS)
` (7 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Peng Fan (OSS) @ 2024-12-28 1:14 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Linus Walleij, Conor Dooley, Daire McNamara
Cc: linux-pm, linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use devm_input_allocate_device/devm_kzalloc/devm_request_irq to simplify
code
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/input/touchscreen/ti_am335x_tsc.c | 43 ++++++++++---------------------
1 file changed, 14 insertions(+), 29 deletions(-)
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index 93d659ff90aa94ecbd7000fe05e0eef8ab3546ba..aef38b2e4e464e3b76395de5991a0f41b4f852f4 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -418,12 +418,11 @@ static int titsc_probe(struct platform_device *pdev)
int err;
/* Allocate memory for device */
- ts_dev = kzalloc(sizeof(*ts_dev), GFP_KERNEL);
- input_dev = input_allocate_device();
+ ts_dev = devm_kzalloc(&pdev->dev, sizeof(*ts_dev), GFP_KERNEL);
+ input_dev = devm_input_allocate_device(&pdev->dev);
if (!ts_dev || !input_dev) {
dev_err(&pdev->dev, "failed to allocate memory.\n");
- err = -ENOMEM;
- goto err_free_mem;
+ return -ENOMEM;
}
tscadc_dev->tsc = ts_dev;
@@ -435,18 +434,21 @@ static int titsc_probe(struct platform_device *pdev)
err = titsc_parse_dt(pdev, ts_dev);
if (err) {
dev_err(&pdev->dev, "Could not find valid DT data.\n");
- goto err_free_mem;
+ return err;
}
- err = request_irq(ts_dev->irq, titsc_irq,
- IRQF_SHARED, pdev->dev.driver->name, ts_dev);
+ err = devm_request_irq(&pdev->dev, ts_dev->irq, titsc_irq, IRQF_SHARED,
+ pdev->dev.driver->name, ts_dev);
if (err) {
dev_err(&pdev->dev, "failed to allocate irq.\n");
- goto err_free_mem;
+ return err;
}
- device_init_wakeup(&pdev->dev, true);
- err = dev_pm_set_wake_irq(&pdev->dev, ts_dev->irq);
+ err = devm_device_init_wakeup(&pdev->dev);
+ if (err)
+ dev_err(&pdev->dev, "device init wakeup failed.\n");
+
+ err = devm_pm_set_wake_irq(&pdev->dev, ts_dev->irq);
if (err)
dev_err(&pdev->dev, "irq wake enable failed.\n");
@@ -456,7 +458,7 @@ static int titsc_probe(struct platform_device *pdev)
err = titsc_config_wires(ts_dev);
if (err) {
dev_err(&pdev->dev, "wrong i/p wire configuration\n");
- goto err_free_irq;
+ return err;
}
titsc_step_config(ts_dev);
titsc_writel(ts_dev, REG_FIFO0THR,
@@ -475,19 +477,10 @@ static int titsc_probe(struct platform_device *pdev)
/* register to the input system */
err = input_register_device(input_dev);
if (err)
- goto err_free_irq;
+ return err;
platform_set_drvdata(pdev, ts_dev);
return 0;
-
-err_free_irq:
- dev_pm_clear_wake_irq(&pdev->dev);
- device_init_wakeup(&pdev->dev, false);
- free_irq(ts_dev->irq, ts_dev);
-err_free_mem:
- input_free_device(input_dev);
- kfree(ts_dev);
- return err;
}
static void titsc_remove(struct platform_device *pdev)
@@ -495,18 +488,10 @@ static void titsc_remove(struct platform_device *pdev)
struct titsc *ts_dev = platform_get_drvdata(pdev);
u32 steps;
- dev_pm_clear_wake_irq(&pdev->dev);
- device_init_wakeup(&pdev->dev, false);
- free_irq(ts_dev->irq, ts_dev);
-
/* total steps followed by the enable mask */
steps = 2 * ts_dev->coordinate_readouts + 2;
steps = (1 << steps) - 1;
am335x_tsc_se_clr(ts_dev->mfd_tscadc, steps);
-
- input_unregister_device(ts_dev->input);
-
- kfree(ts_dev);
}
static int titsc_suspend(struct device *dev)
--
2.37.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 06/12] rtc: stm32: Use resource managed API to simplify code
2024-12-28 1:14 [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
` (4 preceding siblings ...)
2024-12-28 1:14 ` [PATCH 05/12] input: touchscreen: ti_am335x_tsc: " Peng Fan (OSS)
@ 2024-12-28 1:14 ` Peng Fan (OSS)
2024-12-28 5:43 ` kernel test robot
2024-12-28 1:14 ` [PATCH 07/12] rtc: nxp-bbnsm: " Peng Fan (OSS)
` (6 subsequent siblings)
12 siblings, 1 reply; 19+ messages in thread
From: Peng Fan (OSS) @ 2024-12-28 1:14 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Linus Walleij, Conor Dooley, Daire McNamara
Cc: linux-pm, linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use devm_pm_set_wake_irq and devm_device_init_wakeup to cleanup the
error handling code and 'driver.remove()' hook.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/rtc/rtc-stm32.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c
index 9f1a019ec8afa57245c6d40d378ec50fdcd64deb..183017b0d33d10481f94891de24cf2eee95893f5 100644
--- a/drivers/rtc/rtc-stm32.c
+++ b/drivers/rtc/rtc-stm32.c
@@ -1151,11 +1151,11 @@ static int stm32_rtc_probe(struct platform_device *pdev)
goto err;
}
- ret = device_init_wakeup(&pdev->dev, true);
+ ret = devm_device_init_wakeup(&pdev->dev);
if (ret)
goto err;
- ret = dev_pm_set_wake_irq(&pdev->dev, rtc->irq_alarm);
+ ret = devm_pm_set_wake_irq(&pdev->dev, rtc->irq_alarm);
if (ret)
goto err;
@@ -1216,9 +1216,6 @@ static int stm32_rtc_probe(struct platform_device *pdev)
if (rtc->data->need_dbp)
regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0);
- dev_pm_clear_wake_irq(&pdev->dev);
- device_init_wakeup(&pdev->dev, false);
-
return ret;
}
@@ -1245,9 +1242,6 @@ static void stm32_rtc_remove(struct platform_device *pdev)
/* Enable backup domain write protection if needed */
if (rtc->data->need_dbp)
regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0);
-
- dev_pm_clear_wake_irq(&pdev->dev);
- device_init_wakeup(&pdev->dev, false);
}
static int stm32_rtc_suspend(struct device *dev)
--
2.37.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 07/12] rtc: nxp-bbnsm: Use resource managed API to simplify code
2024-12-28 1:14 [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
` (5 preceding siblings ...)
2024-12-28 1:14 ` [PATCH 06/12] rtc: stm32: " Peng Fan (OSS)
@ 2024-12-28 1:14 ` Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 08/12] rtc: ds1343: Use devm_pm_set_wake_irq Peng Fan (OSS)
` (5 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Peng Fan (OSS) @ 2024-12-28 1:14 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Linus Walleij, Conor Dooley, Daire McNamara
Cc: linux-pm, linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use devm_pm_set_wake_irq and devm_device_init_wakeup to cleanup the
error handling code and 'driver.remove()' hook.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/rtc/rtc-nxp-bbnsm.c | 29 +++++++++--------------------
1 file changed, 9 insertions(+), 20 deletions(-)
diff --git a/drivers/rtc/rtc-nxp-bbnsm.c b/drivers/rtc/rtc-nxp-bbnsm.c
index fa3b0328c7a255ff8a902a58d61a4b0e59eac493..d4fc9dc583d317d4852b7d897a6c45cfff6961a2 100644
--- a/drivers/rtc/rtc-nxp-bbnsm.c
+++ b/drivers/rtc/rtc-nxp-bbnsm.c
@@ -189,36 +189,26 @@ static int bbnsm_rtc_probe(struct platform_device *pdev)
/* clear all the pending events */
regmap_write(bbnsm->regmap, BBNSM_EVENTS, 0x7A);
- device_init_wakeup(&pdev->dev, true);
- dev_pm_set_wake_irq(&pdev->dev, bbnsm->irq);
+ ret = devm_device_init_wakeup(&pdev->dev);
+ if (ret)
+ dev_err(&pdev->dev, "failed to init wakeup, %d\n", ret);
+
+ ret = devm_pm_set_wake_irq(&pdev->dev, bbnsm->irq);
+ if (ret)
+ dev_err(&pdev->dev, "failed to set wake irq, %d\n", ret);
ret = devm_request_irq(&pdev->dev, bbnsm->irq, bbnsm_rtc_irq_handler,
IRQF_SHARED, "rtc alarm", &pdev->dev);
if (ret) {
dev_err(&pdev->dev, "failed to request irq %d: %d\n",
bbnsm->irq, ret);
- goto err;
+ return ret;
}
bbnsm->rtc->ops = &bbnsm_rtc_ops;
bbnsm->rtc->range_max = U32_MAX;
- ret = devm_rtc_register_device(bbnsm->rtc);
- if (ret)
- goto err;
-
- return 0;
-
-err:
- dev_pm_clear_wake_irq(&pdev->dev);
- device_init_wakeup(&pdev->dev, false);
- return ret;
-}
-
-static void bbnsm_rtc_remove(struct platform_device *pdev)
-{
- dev_pm_clear_wake_irq(&pdev->dev);
- device_init_wakeup(&pdev->dev, false);
+ return devm_rtc_register_device(bbnsm->rtc);
}
static const struct of_device_id bbnsm_dt_ids[] = {
@@ -233,7 +223,6 @@ static struct platform_driver bbnsm_rtc_driver = {
.of_match_table = bbnsm_dt_ids,
},
.probe = bbnsm_rtc_probe,
- .remove = bbnsm_rtc_remove,
};
module_platform_driver(bbnsm_rtc_driver);
--
2.37.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 08/12] rtc: ds1343: Use devm_pm_set_wake_irq
2024-12-28 1:14 [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
` (6 preceding siblings ...)
2024-12-28 1:14 ` [PATCH 07/12] rtc: nxp-bbnsm: " Peng Fan (OSS)
@ 2024-12-28 1:14 ` Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 09/12] rtc: pm8xxx: " Peng Fan (OSS)
` (4 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Peng Fan (OSS) @ 2024-12-28 1:14 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Linus Walleij, Conor Dooley, Daire McNamara
Cc: linux-pm, linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use devm_pm_set_wake_irq, then the 'driver.remove()' could be cleaned up.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/rtc/rtc-ds1343.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/rtc/rtc-ds1343.c b/drivers/rtc/rtc-ds1343.c
index ed5a6ba89a3eeb2a0b9d6dea3c8b3d40aa2cf317..aa9500791b7e0300b150bd654b69c74f3e5e6e6b 100644
--- a/drivers/rtc/rtc-ds1343.c
+++ b/drivers/rtc/rtc-ds1343.c
@@ -427,18 +427,13 @@ static int ds1343_probe(struct spi_device *spi)
"unable to request irq for rtc ds1343\n");
} else {
device_init_wakeup(&spi->dev, true);
- dev_pm_set_wake_irq(&spi->dev, spi->irq);
+ devm_pm_set_wake_irq(&spi->dev, spi->irq);
}
}
return 0;
}
-static void ds1343_remove(struct spi_device *spi)
-{
- dev_pm_clear_wake_irq(&spi->dev);
-}
-
#ifdef CONFIG_PM_SLEEP
static int ds1343_suspend(struct device *dev)
@@ -471,7 +466,6 @@ static struct spi_driver ds1343_driver = {
.pm = &ds1343_pm,
},
.probe = ds1343_probe,
- .remove = ds1343_remove,
.id_table = ds1343_id,
};
--
2.37.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 09/12] rtc: pm8xxx: Use devm_pm_set_wake_irq
2024-12-28 1:14 [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
` (7 preceding siblings ...)
2024-12-28 1:14 ` [PATCH 08/12] rtc: ds1343: Use devm_pm_set_wake_irq Peng Fan (OSS)
@ 2024-12-28 1:14 ` Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 10/12] rtc: ab8500: Use resource managed API to simplify code Peng Fan (OSS)
` (3 subsequent siblings)
12 siblings, 0 replies; 19+ messages in thread
From: Peng Fan (OSS) @ 2024-12-28 1:14 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Linus Walleij, Conor Dooley, Daire McNamara
Cc: linux-pm, linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use devm_pm_set_wake_irq, then the 'driver.remove()' could be cleaned up.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/rtc/rtc-pm8xxx.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index 2f32187ecc8d3276a451a317ab83446b7b04ecc8..f1b620b168fcca8c640e4beaaf7e8c17776c5ed9 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -523,21 +523,11 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
if (rc)
return rc;
- rc = dev_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
- if (rc)
- return rc;
-
- return 0;
-}
-
-static void pm8xxx_remove(struct platform_device *pdev)
-{
- dev_pm_clear_wake_irq(&pdev->dev);
+ return devm_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
}
static struct platform_driver pm8xxx_rtc_driver = {
.probe = pm8xxx_rtc_probe,
- .remove = pm8xxx_remove,
.driver = {
.name = "rtc-pm8xxx",
.of_match_table = pm8xxx_id_table,
--
2.37.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 10/12] rtc: ab8500: Use resource managed API to simplify code
2024-12-28 1:14 [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
` (8 preceding siblings ...)
2024-12-28 1:14 ` [PATCH 09/12] rtc: pm8xxx: " Peng Fan (OSS)
@ 2024-12-28 1:14 ` Peng Fan (OSS)
2024-12-28 22:55 ` Linus Walleij
2024-12-28 1:14 ` [PATCH 11/12] rtc: mpfs: Use devm_pm_set_wake_irq Peng Fan (OSS)
` (2 subsequent siblings)
12 siblings, 1 reply; 19+ messages in thread
From: Peng Fan (OSS) @ 2024-12-28 1:14 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Linus Walleij, Conor Dooley, Daire McNamara
Cc: linux-pm, linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use devm_pm_set_wake_irq and devm_device_init_wakeup to cleanup the
error handling code and 'driver.remove()' hook.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/rtc/rtc-ab8500.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c
index 2dcda96f4a8ef727514c751322b84d8d2b382b75..ed2b6b8bb3bf8f99fef9f8bee9676f71f8a86d2a 100644
--- a/drivers/rtc/rtc-ab8500.c
+++ b/drivers/rtc/rtc-ab8500.c
@@ -361,7 +361,7 @@ static int ab8500_rtc_probe(struct platform_device *pdev)
return -ENODEV;
}
- device_init_wakeup(&pdev->dev, true);
+ devm_device_init_wakeup(&pdev->dev);
rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc))
@@ -375,7 +375,7 @@ static int ab8500_rtc_probe(struct platform_device *pdev)
if (err < 0)
return err;
- dev_pm_set_wake_irq(&pdev->dev, irq);
+ devm_pm_set_wake_irq(&pdev->dev, irq);
platform_set_drvdata(pdev, rtc);
set_bit(RTC_FEATURE_ALARM_RES_MINUTE, rtc->features);
@@ -392,18 +392,11 @@ static int ab8500_rtc_probe(struct platform_device *pdev)
return devm_rtc_register_device(rtc);
}
-static void ab8500_rtc_remove(struct platform_device *pdev)
-{
- dev_pm_clear_wake_irq(&pdev->dev);
- device_init_wakeup(&pdev->dev, false);
-}
-
static struct platform_driver ab8500_rtc_driver = {
.driver = {
.name = "ab8500-rtc",
},
.probe = ab8500_rtc_probe,
- .remove = ab8500_rtc_remove,
.id_table = ab85xx_rtc_ids,
};
--
2.37.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 11/12] rtc: mpfs: Use devm_pm_set_wake_irq
2024-12-28 1:14 [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
` (9 preceding siblings ...)
2024-12-28 1:14 ` [PATCH 10/12] rtc: ab8500: Use resource managed API to simplify code Peng Fan (OSS)
@ 2024-12-28 1:14 ` Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 12/12] rtc: pl031: Use resource managed API to simplify code Peng Fan (OSS)
2024-12-28 10:10 ` [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Alexandre Belloni
12 siblings, 0 replies; 19+ messages in thread
From: Peng Fan (OSS) @ 2024-12-28 1:14 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Linus Walleij, Conor Dooley, Daire McNamara
Cc: linux-pm, linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use devm_pm_set_wake_irq, then the 'driver.remove()' could be cleaned up.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/rtc/rtc-mpfs.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/rtc/rtc-mpfs.c b/drivers/rtc/rtc-mpfs.c
index 3892b0f9917fa7bc4f732cfe2c2b2f548ba7429f..5a38649cbd43b3c6f2fec5db95c4f0013deb2a08 100644
--- a/drivers/rtc/rtc-mpfs.c
+++ b/drivers/rtc/rtc-mpfs.c
@@ -267,18 +267,13 @@ static int mpfs_rtc_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "prescaler set to: %lu\n", prescaler);
device_init_wakeup(&pdev->dev, true);
- ret = dev_pm_set_wake_irq(&pdev->dev, wakeup_irq);
+ ret = devm_pm_set_wake_irq(&pdev->dev, wakeup_irq);
if (ret)
dev_err(&pdev->dev, "failed to enable irq wake\n");
return devm_rtc_register_device(rtcdev->rtc);
}
-static void mpfs_rtc_remove(struct platform_device *pdev)
-{
- dev_pm_clear_wake_irq(&pdev->dev);
-}
-
static const struct of_device_id mpfs_rtc_of_match[] = {
{ .compatible = "microchip,mpfs-rtc" },
{ }
@@ -288,7 +283,6 @@ MODULE_DEVICE_TABLE(of, mpfs_rtc_of_match);
static struct platform_driver mpfs_rtc_driver = {
.probe = mpfs_rtc_probe,
- .remove = mpfs_rtc_remove,
.driver = {
.name = "mpfs_rtc",
.of_match_table = mpfs_rtc_of_match,
--
2.37.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 12/12] rtc: pl031: Use resource managed API to simplify code
2024-12-28 1:14 [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
` (10 preceding siblings ...)
2024-12-28 1:14 ` [PATCH 11/12] rtc: mpfs: Use devm_pm_set_wake_irq Peng Fan (OSS)
@ 2024-12-28 1:14 ` Peng Fan (OSS)
2024-12-28 22:55 ` Linus Walleij
2024-12-28 10:10 ` [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Alexandre Belloni
12 siblings, 1 reply; 19+ messages in thread
From: Peng Fan (OSS) @ 2024-12-28 1:14 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Linus Walleij, Conor Dooley, Daire McNamara
Cc: linux-pm, linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use devm_pm_set_wake_irq and devm_device_init_wakeup to cleanup the
error handling code and 'driver.remove()' hook.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/rtc/rtc-pl031.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index bad6a5d9c6839ca70905e3d46286b9729c1fd435..47bfc5395e5908b7722b98276399120f1ba65af0 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -284,8 +284,6 @@ static void pl031_remove(struct amba_device *adev)
{
struct pl031_local *ldata = dev_get_drvdata(&adev->dev);
- dev_pm_clear_wake_irq(&adev->dev);
- device_init_wakeup(&adev->dev, false);
if (adev->irq[0])
free_irq(adev->irq[0], ldata);
amba_release_regions(adev);
@@ -350,7 +348,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
}
}
- device_init_wakeup(&adev->dev, true);
+ devm_device_init_wakeup(&adev->dev);
ldata->rtc = devm_rtc_allocate_device(&adev->dev);
if (IS_ERR(ldata->rtc)) {
ret = PTR_ERR(ldata->rtc);
@@ -373,7 +371,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
vendor->irqflags, "rtc-pl031", ldata);
if (ret)
goto out;
- dev_pm_set_wake_irq(&adev->dev, adev->irq[0]);
+ devm_pm_set_wake_irq(&adev->dev, adev->irq[0]);
}
return 0;
--
2.37.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 03/12] input: keyboard: omap4_keypad: Use devm_pm_set_wake_irq
2024-12-28 1:14 ` [PATCH 03/12] input: keyboard: omap4_keypad: " Peng Fan (OSS)
@ 2024-12-28 5:11 ` kernel test robot
0 siblings, 0 replies; 19+ messages in thread
From: kernel test robot @ 2024-12-28 5:11 UTC (permalink / raw)
To: Peng Fan (OSS), Rafael J. Wysocki, Len Brown, Pavel Machek,
Greg Kroah-Hartman, Dmitry Torokhov, Alexandre Belloni,
Maxime Coquelin, Alexandre Torgue, Linus Walleij, Conor Dooley,
Daire McNamara
Cc: llvm, oe-kbuild-all, linux-pm, linux-kernel, linux-input,
linux-rtc, linux-stm32, linux-arm-kernel, linux-arm-msm,
linux-riscv, Peng Fan
Hi Peng,
kernel test robot noticed the following build errors:
[auto build test ERROR on 8155b4ef3466f0e289e8fcc9e6e62f3f4dceeac2]
url: https://github.com/intel-lab-lkp/linux/commits/Peng-Fan-OSS/PM-sleep-wakeirq-Introduce-device-managed-variant-of-dev_pm_set_wake_irq/20241228-091859
base: 8155b4ef3466f0e289e8fcc9e6e62f3f4dceeac2
patch link: https://lore.kernel.org/r/20241228-wake_irq-v1-3-09cfca77cd47%40nxp.com
patch subject: [PATCH 03/12] input: keyboard: omap4_keypad: Use devm_pm_set_wake_irq
config: i386-buildonly-randconfig-002-20241228 (https://download.01.org/0day-ci/archive/20241228/202412281211.h6tPLOqJ-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241228/202412281211.h6tPLOqJ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412281211.h6tPLOqJ-lkp@intel.com/
All errors (new ones prefixed by >>, old ones prefixed by <<):
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/zlib_inflate/zlib_inflate.o
>> ERROR: modpost: "devm_pm_set_wake_irq" [drivers/input/keyboard/omap4-keypad.ko] undefined!
WARNING: modpost: module snd-compress uses symbol dma_buf_fd from namespace DMA_BUF, but does not import it.
WARNING: modpost: module snd-compress uses symbol dma_buf_get from namespace DMA_BUF, but does not import it.
WARNING: modpost: module snd-compress uses symbol dma_buf_put from namespace DMA_BUF, but does not import it.
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 06/12] rtc: stm32: Use resource managed API to simplify code
2024-12-28 1:14 ` [PATCH 06/12] rtc: stm32: " Peng Fan (OSS)
@ 2024-12-28 5:43 ` kernel test robot
0 siblings, 0 replies; 19+ messages in thread
From: kernel test robot @ 2024-12-28 5:43 UTC (permalink / raw)
To: Peng Fan (OSS), Rafael J. Wysocki, Len Brown, Pavel Machek,
Greg Kroah-Hartman, Dmitry Torokhov, Alexandre Belloni,
Maxime Coquelin, Alexandre Torgue, Linus Walleij, Conor Dooley,
Daire McNamara
Cc: oe-kbuild-all, linux-pm, linux-kernel, linux-input, linux-rtc,
linux-stm32, linux-arm-kernel, linux-arm-msm, linux-riscv,
Peng Fan
Hi Peng,
kernel test robot noticed the following build errors:
[auto build test ERROR on 8155b4ef3466f0e289e8fcc9e6e62f3f4dceeac2]
url: https://github.com/intel-lab-lkp/linux/commits/Peng-Fan-OSS/PM-sleep-wakeirq-Introduce-device-managed-variant-of-dev_pm_set_wake_irq/20241228-091859
base: 8155b4ef3466f0e289e8fcc9e6e62f3f4dceeac2
patch link: https://lore.kernel.org/r/20241228-wake_irq-v1-6-09cfca77cd47%40nxp.com
patch subject: [PATCH 06/12] rtc: stm32: Use resource managed API to simplify code
config: arm64-randconfig-003-20241228 (https://download.01.org/0day-ci/archive/20241228/202412281302.N1Bd2W48-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241228/202412281302.N1Bd2W48-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412281302.N1Bd2W48-lkp@intel.com/
All errors (new ones prefixed by >>, old ones prefixed by <<):
WARNING: modpost: missing MODULE_DESCRIPTION() in mm/kasan/kasan_test.o
ERROR: modpost: "devm_pm_set_wake_irq" [drivers/input/touchscreen/ti_am335x_tsc.ko] undefined!
>> ERROR: modpost: "devm_pm_set_wake_irq" [drivers/rtc/rtc-stm32.ko] undefined!
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq
2024-12-28 1:14 [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
` (11 preceding siblings ...)
2024-12-28 1:14 ` [PATCH 12/12] rtc: pl031: Use resource managed API to simplify code Peng Fan (OSS)
@ 2024-12-28 10:10 ` Alexandre Belloni
2024-12-29 9:31 ` Peng Fan
12 siblings, 1 reply; 19+ messages in thread
From: Alexandre Belloni @ 2024-12-28 10:10 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Maxime Coquelin, Alexandre Torgue, Linus Walleij,
Conor Dooley, Daire McNamara, linux-pm, linux-kernel, linux-input,
linux-rtc, linux-stm32, linux-arm-kernel, linux-arm-msm,
linux-riscv, Peng Fan
On 28/12/2024 09:14:36+0800, Peng Fan (OSS) wrote:
> This was a retry to address [1][2], to let common code handle
> dev_pm_clear_wake_irq. Then no need to call dev_pm_clear_wake_irq
> in each driver.remove() hook and error handling path.
>
> In this patchset, I include input and rtc patches to show the usage
> to avoid that introducing an API without users. There are still
> other places using dev_pm_clear_wake_irq. If this patchset is
> good for you, I could start to clean up other drivers such as mmc and
> etc.
>
> [1] https://lore.kernel.org/all/20241111092131.1693319-1-peng.fan@oss.nxp.com/
> [2] https://lore.kernel.org/all/ZymxvLMkkktRoCXZ@google.com/
It seems your patchset depends on devm_device_init_wakeup which did not
make it yet.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> Peng Fan (12):
> PM: sleep: wakeirq: Introduce device-managed variant of dev_pm_set_wake_irq
> input: keyboard: ep93xx_keypad: Use devm_pm_set_wake_irq
> input: keyboard: omap4_keypad: Use devm_pm_set_wake_irq
> input: misc: nxp-bbnsm-pwrkey: Use resource managed API to simplify code
> input: touchscreen: ti_am335x_tsc: Use resource managed API to simplify code
> rtc: stm32: Use resource managed API to simplify code
> rtc: nxp-bbnsm: Use resource managed API to simplify code
> rtc: ds1343: Use devm_pm_set_wake_irq
> rtc: pm8xxx: Use devm_pm_set_wake_irq
> rtc: ab8500: Use resource managed API to simplify code
> rtc: mpfs: Use devm_pm_set_wake_irq
> rtc: pl031: Use resource managed API to simplify code
>
> drivers/base/power/wakeirq.c | 25 ++++++++++++++++++
> drivers/input/keyboard/ep93xx_keypad.c | 8 +-----
> drivers/input/keyboard/omap4-keypad.c | 8 +-----
> drivers/input/misc/nxp-bbnsm-pwrkey.c | 15 ++++-------
> drivers/input/touchscreen/ti_am335x_tsc.c | 43 ++++++++++---------------------
> drivers/rtc/rtc-ab8500.c | 11 ++------
> drivers/rtc/rtc-ds1343.c | 8 +-----
> drivers/rtc/rtc-mpfs.c | 8 +-----
> drivers/rtc/rtc-nxp-bbnsm.c | 29 +++++++--------------
> drivers/rtc/rtc-pl031.c | 6 ++---
> drivers/rtc/rtc-pm8xxx.c | 12 +--------
> drivers/rtc/rtc-stm32.c | 10 ++-----
> include/linux/pm_wakeirq.h | 6 +++++
> 13 files changed, 70 insertions(+), 119 deletions(-)
> ---
> base-commit: 8155b4ef3466f0e289e8fcc9e6e62f3f4dceeac2
> change-id: 20241227-wake_irq-b68d604dd902
>
> Best regards,
> --
> Peng Fan <peng.fan@nxp.com>
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 10/12] rtc: ab8500: Use resource managed API to simplify code
2024-12-28 1:14 ` [PATCH 10/12] rtc: ab8500: Use resource managed API to simplify code Peng Fan (OSS)
@ 2024-12-28 22:55 ` Linus Walleij
0 siblings, 0 replies; 19+ messages in thread
From: Linus Walleij @ 2024-12-28 22:55 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Conor Dooley, Daire McNamara, linux-pm,
linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
On Sat, Dec 28, 2024 at 2:16 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Use devm_pm_set_wake_irq and devm_device_init_wakeup to cleanup the
> error handling code and 'driver.remove()' hook.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
This looks very nice provided the core code is merged.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 12/12] rtc: pl031: Use resource managed API to simplify code
2024-12-28 1:14 ` [PATCH 12/12] rtc: pl031: Use resource managed API to simplify code Peng Fan (OSS)
@ 2024-12-28 22:55 ` Linus Walleij
0 siblings, 0 replies; 19+ messages in thread
From: Linus Walleij @ 2024-12-28 22:55 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Alexandre Belloni, Maxime Coquelin,
Alexandre Torgue, Conor Dooley, Daire McNamara, linux-pm,
linux-kernel, linux-input, linux-rtc, linux-stm32,
linux-arm-kernel, linux-arm-msm, linux-riscv, Peng Fan
On Sat, Dec 28, 2024 at 2:16 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Use devm_pm_set_wake_irq and devm_device_init_wakeup to cleanup the
> error handling code and 'driver.remove()' hook.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq
2024-12-28 10:10 ` [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Alexandre Belloni
@ 2024-12-29 9:31 ` Peng Fan
0 siblings, 0 replies; 19+ messages in thread
From: Peng Fan @ 2024-12-29 9:31 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman,
Dmitry Torokhov, Maxime Coquelin, Alexandre Torgue, Linus Walleij,
Conor Dooley, Daire McNamara, linux-pm, linux-kernel, linux-input,
linux-rtc, linux-stm32, linux-arm-kernel, linux-arm-msm,
linux-riscv, Peng Fan
On Sat, Dec 28, 2024 at 11:10:46AM +0100, Alexandre Belloni wrote:
>On 28/12/2024 09:14:36+0800, Peng Fan (OSS) wrote:
>> This was a retry to address [1][2], to let common code handle
>> dev_pm_clear_wake_irq. Then no need to call dev_pm_clear_wake_irq
>> in each driver.remove() hook and error handling path.
>>
>> In this patchset, I include input and rtc patches to show the usage
>> to avoid that introducing an API without users. There are still
>> other places using dev_pm_clear_wake_irq. If this patchset is
>> good for you, I could start to clean up other drivers such as mmc and
>> etc.
>>
>> [1] https://lore.kernel.org/all/20241111092131.1693319-1-peng.fan@oss.nxp.com/
>> [2] https://lore.kernel.org/all/ZymxvLMkkktRoCXZ@google.com/
>
>It seems your patchset depends on devm_device_init_wakeup which did not
>make it yet.
The devm_device_init_wakeup patch in linux-next/master
commit b317268368546d6401af788648668f82e3ba1bd3
Author: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Date: Wed Dec 18 13:09:35 2024 +0900
PM: wakeup: implement devm_device_init_wakeup() helper
Some drivers that enable device wakeup fail to properly disable it
during their cleanup, which results in a memory leak.
To address this, introduce devm_device_init_wakeup(), a managed variant
of device_init_wakeup(dev, true).
With this managed helper, wakeup functionality will be automatically
disabled when the device is released, ensuring a more reliable cleanup
process.
This need for this addition arose during a previous discussion [1].
Link: https://lore.kernel.org/linux-rtc/20241212100403.3799667-1-joe@pf.is.s.u-tokyo.ac.jp/ [1]
Suggested-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Link: https://patch.msgid.link/20241218040935.1921416-1-joe@pf.is.s.u-tokyo.ac.jp
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Thanks,
Peng.
>
>>
>> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> ---
>> Peng Fan (12):
>> PM: sleep: wakeirq: Introduce device-managed variant of dev_pm_set_wake_irq
>> input: keyboard: ep93xx_keypad: Use devm_pm_set_wake_irq
>> input: keyboard: omap4_keypad: Use devm_pm_set_wake_irq
>> input: misc: nxp-bbnsm-pwrkey: Use resource managed API to simplify code
>> input: touchscreen: ti_am335x_tsc: Use resource managed API to simplify code
>> rtc: stm32: Use resource managed API to simplify code
>> rtc: nxp-bbnsm: Use resource managed API to simplify code
>> rtc: ds1343: Use devm_pm_set_wake_irq
>> rtc: pm8xxx: Use devm_pm_set_wake_irq
>> rtc: ab8500: Use resource managed API to simplify code
>> rtc: mpfs: Use devm_pm_set_wake_irq
>> rtc: pl031: Use resource managed API to simplify code
>>
>> drivers/base/power/wakeirq.c | 25 ++++++++++++++++++
>> drivers/input/keyboard/ep93xx_keypad.c | 8 +-----
>> drivers/input/keyboard/omap4-keypad.c | 8 +-----
>> drivers/input/misc/nxp-bbnsm-pwrkey.c | 15 ++++-------
>> drivers/input/touchscreen/ti_am335x_tsc.c | 43 ++++++++++---------------------
>> drivers/rtc/rtc-ab8500.c | 11 ++------
>> drivers/rtc/rtc-ds1343.c | 8 +-----
>> drivers/rtc/rtc-mpfs.c | 8 +-----
>> drivers/rtc/rtc-nxp-bbnsm.c | 29 +++++++--------------
>> drivers/rtc/rtc-pl031.c | 6 ++---
>> drivers/rtc/rtc-pm8xxx.c | 12 +--------
>> drivers/rtc/rtc-stm32.c | 10 ++-----
>> include/linux/pm_wakeirq.h | 6 +++++
>> 13 files changed, 70 insertions(+), 119 deletions(-)
>> ---
>> base-commit: 8155b4ef3466f0e289e8fcc9e6e62f3f4dceeac2
>> change-id: 20241227-wake_irq-b68d604dd902
>>
>> Best regards,
>> --
>> Peng Fan <peng.fan@nxp.com>
>>
>
>--
>Alexandre Belloni, co-owner and COO, Bootlin
>Embedded Linux and Kernel engineering
>https://bootlin.com
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2024-12-29 8:25 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-28 1:14 [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 01/12] PM: sleep: wakeirq: Introduce device-managed variant of dev_pm_set_wake_irq Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 02/12] input: keyboard: ep93xx_keypad: Use devm_pm_set_wake_irq Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 03/12] input: keyboard: omap4_keypad: " Peng Fan (OSS)
2024-12-28 5:11 ` kernel test robot
2024-12-28 1:14 ` [PATCH 04/12] input: misc: nxp-bbnsm-pwrkey: Use resource managed API to simplify code Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 05/12] input: touchscreen: ti_am335x_tsc: " Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 06/12] rtc: stm32: " Peng Fan (OSS)
2024-12-28 5:43 ` kernel test robot
2024-12-28 1:14 ` [PATCH 07/12] rtc: nxp-bbnsm: " Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 08/12] rtc: ds1343: Use devm_pm_set_wake_irq Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 09/12] rtc: pm8xxx: " Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 10/12] rtc: ab8500: Use resource managed API to simplify code Peng Fan (OSS)
2024-12-28 22:55 ` Linus Walleij
2024-12-28 1:14 ` [PATCH 11/12] rtc: mpfs: Use devm_pm_set_wake_irq Peng Fan (OSS)
2024-12-28 1:14 ` [PATCH 12/12] rtc: pl031: Use resource managed API to simplify code Peng Fan (OSS)
2024-12-28 22:55 ` Linus Walleij
2024-12-28 10:10 ` [PATCH 00/12] pm: Introduce devm_pm_set_wake_irq Alexandre Belloni
2024-12-29 9:31 ` Peng Fan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).