input: use devm_pm_set_wake_irq
Subsystems (2)
cover input: use devm_pm_set_wake_irq
This is a pick-up of patch 2-5 from patchset [1]
Since devm_pm_set_wake_irq is in 6.14, so resend the input parts.
[1] https://lore.kernel.org/all/CAJZ5v0jb=0c5m=FeA-W-aG30H4706Ay_xCHTsiC1S-7MuGxqTQ@mail.gmail.com/#r
---
Peng Fan (4):
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
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 ++++++++++--------------------- 4 files changed, 21 insertions(+), 53 deletions(-)
---
base-commit: 40b8e93e17bff4a4e0cc129e04f9fdf5daa5397e
change-id: 20250205-input-cleanup-219afcebf38a
Best regards,
Signature · 1 line
Peng Fan <[email protected]>
PATCH 1/4 input: keyboard: ep93xx_keypad: Use devm_pm_set_wake_irq
From: Peng Fan <[email protected]>
Use devm_pm_set_wake_irq, then the 'driver.remove()' could be cleaned up.
--- drivers/input/keyboard/ep93xx_keypad.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/input/keyboard/ep93xx_keypad.c +1 -7
@@ -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);
Signature · 1 line
2.37.1
PATCH 2/4 input: keyboard: omap4_keypad: Use devm_pm_set_wake_irq
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Use devm_pm_set_wake_irq, then the 'driver.remove()' could be cleaned up.
--- drivers/input/keyboard/omap4-keypad.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/input/keyboard/omap4-keypad.c +1 -7
@@ -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,
Signature · 1 line
2.37.1
PATCH 3/4 input: misc: nxp-bbnsm-pwrkey: Use resource managed API to simplify code
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Use devm_pm_set_wake_irq and devm_device_init_wakeup to cleanup the 'driver.remove()' hook.
--- drivers/input/misc/nxp-bbnsm-pwrkey.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/input/misc/nxp-bbnsm-pwrkey.c +5 -10
@@ -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);
Signature · 1 line
2.37.1
PATCH 4/4 input: touchscreen: ti_am335x_tsc: Use resource managed API to simplify code
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Use devm_input_allocate_device/devm_kzalloc/devm_request_irq to simplify code
--- drivers/input/touchscreen/ti_am335x_tsc.c | 43 ++++++++++--------------------- 1 file changed, 14 insertions(+), 29 deletions(-)
drivers/input/touchscreen/ti_am335x_tsc.c +14 -29
@@ -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)
Signature · 1 line
2.37.1
Hi Dmitry,
Quoted 3 lines · Peng Fan (OSS)
This is a pick-up of patch 2-5 from patchset [1]
Since
devm_pm_set_wake_irqis in 6.14, so resend the input parts.
Do you have time to give a look on this patchset?
Thanks,
Peng
Quoted 25 lines
[1] https://lore.kernel.org/all/CAJZ5v0jb=0c5m=FeA-W-aG30H4706Ay_xCHTsiC1S-7MuGxqTQ@mail.gmail.com/#r
Signed-off-by Peng Fan <[email protected]>---
Peng Fan (4):
input: keyboard:ep93xx_keypad: Usedevm_pm_set_wake_irq
input: keyboard:omap4_keypad: Usedevm_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 codedrivers/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 ++++++++++--------------------- 4 files changed, 21 insertions(+), 53 deletions(-)---
base-commit:40b8e93e17bff4a4e0cc129e04f9fdf5daa5397e
change-id: 20250205-input-cleanup-219afcebf38aBest regards,
Signature · 1 line
Peng Fan <[email protected]>
Dmitry Torokhov
maintainerQuoted 6 lines · Peng Fan (OSS)
This is a pick-up of patch 2-5 from patchset [1]
Since
devm_pm_set_wake_irqis in 6.14, so resend the input parts.[1] https://lore.kernel.org/all/CAJZ5v0jb=0c5m=FeA-W-aG30H4706Ay_xCHTsiC1S-7MuGxqTQ@mail.gmail.com/#r
Quoted 7 lines
Signed-off-by Peng Fan <[email protected]>---
Peng Fan (4):
input: keyboard:ep93xx_keypad: Usedevm_pm_set_wake_irq
input: keyboard:omap4_keypad: Usedevm_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
Applied with minor changes to patch #4, thank you.
Signature · 1 line
Dmitry