linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] input: use devm_pm_set_wake_irq
@ 2025-02-05  0:45 Peng Fan (OSS)
  2025-02-05  0:45 ` [PATCH 1/4] input: keyboard: ep93xx_keypad: Use devm_pm_set_wake_irq Peng Fan (OSS)
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Peng Fan (OSS) @ 2025-02-05  0:45 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, Peng Fan

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

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
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,
-- 
Peng Fan <peng.fan@nxp.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] input: keyboard: ep93xx_keypad: Use devm_pm_set_wake_irq
  2025-02-05  0:45 [PATCH 0/4] input: use devm_pm_set_wake_irq Peng Fan (OSS)
@ 2025-02-05  0:45 ` Peng Fan (OSS)
  2025-02-05  0:45 ` [PATCH 2/4] input: keyboard: omap4_keypad: " Peng Fan (OSS)
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Peng Fan (OSS) @ 2025-02-05  0:45 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, 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] 6+ messages in thread

* [PATCH 2/4] input: keyboard: omap4_keypad: Use devm_pm_set_wake_irq
  2025-02-05  0:45 [PATCH 0/4] input: use devm_pm_set_wake_irq Peng Fan (OSS)
  2025-02-05  0:45 ` [PATCH 1/4] input: keyboard: ep93xx_keypad: Use devm_pm_set_wake_irq Peng Fan (OSS)
@ 2025-02-05  0:45 ` Peng Fan (OSS)
  2025-02-05  0:45 ` [PATCH 3/4] input: misc: nxp-bbnsm-pwrkey: Use resource managed API to simplify code Peng Fan (OSS)
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Peng Fan (OSS) @ 2025-02-05  0:45 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, 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] 6+ messages in thread

* [PATCH 3/4] input: misc: nxp-bbnsm-pwrkey: Use resource managed API to simplify code
  2025-02-05  0:45 [PATCH 0/4] input: use devm_pm_set_wake_irq Peng Fan (OSS)
  2025-02-05  0:45 ` [PATCH 1/4] input: keyboard: ep93xx_keypad: Use devm_pm_set_wake_irq Peng Fan (OSS)
  2025-02-05  0:45 ` [PATCH 2/4] input: keyboard: omap4_keypad: " Peng Fan (OSS)
@ 2025-02-05  0:45 ` Peng Fan (OSS)
  2025-02-05  0:45 ` [PATCH 4/4] input: touchscreen: ti_am335x_tsc: " Peng Fan (OSS)
  2025-03-04  1:51 ` [PATCH 0/4] input: use devm_pm_set_wake_irq Peng Fan
  4 siblings, 0 replies; 6+ messages in thread
From: Peng Fan (OSS) @ 2025-02-05  0:45 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, 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] 6+ messages in thread

* [PATCH 4/4] input: touchscreen: ti_am335x_tsc: Use resource managed API to simplify code
  2025-02-05  0:45 [PATCH 0/4] input: use devm_pm_set_wake_irq Peng Fan (OSS)
                   ` (2 preceding siblings ...)
  2025-02-05  0:45 ` [PATCH 3/4] input: misc: nxp-bbnsm-pwrkey: Use resource managed API to simplify code Peng Fan (OSS)
@ 2025-02-05  0:45 ` Peng Fan (OSS)
  2025-03-04  1:51 ` [PATCH 0/4] input: use devm_pm_set_wake_irq Peng Fan
  4 siblings, 0 replies; 6+ messages in thread
From: Peng Fan (OSS) @ 2025-02-05  0:45 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, 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] 6+ messages in thread

* Re: [PATCH 0/4] input: use devm_pm_set_wake_irq
  2025-02-05  0:45 [PATCH 0/4] input: use devm_pm_set_wake_irq Peng Fan (OSS)
                   ` (3 preceding siblings ...)
  2025-02-05  0:45 ` [PATCH 4/4] input: touchscreen: ti_am335x_tsc: " Peng Fan (OSS)
@ 2025-03-04  1:51 ` Peng Fan
  4 siblings, 0 replies; 6+ messages in thread
From: Peng Fan @ 2025-03-04  1:51 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, Peng Fan

Hi Dmitry,

On Wed, Feb 05, 2025 at 08:45:13AM +0800, Peng Fan (OSS) wrote:
>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.

Do you have time to give a look on this patchset?

Thanks,
Peng

>
>[1] https://lore.kernel.org/all/CAJZ5v0jb=0c5m=FeA-W-aG30H4706Ay_xCHTsiC1S-7MuGxqTQ@mail.gmail.com/#r
>
>Signed-off-by: Peng Fan <peng.fan@nxp.com>
>---
>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,
>-- 
>Peng Fan <peng.fan@nxp.com>
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-03-04  0:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-05  0:45 [PATCH 0/4] input: use devm_pm_set_wake_irq Peng Fan (OSS)
2025-02-05  0:45 ` [PATCH 1/4] input: keyboard: ep93xx_keypad: Use devm_pm_set_wake_irq Peng Fan (OSS)
2025-02-05  0:45 ` [PATCH 2/4] input: keyboard: omap4_keypad: " Peng Fan (OSS)
2025-02-05  0:45 ` [PATCH 3/4] input: misc: nxp-bbnsm-pwrkey: Use resource managed API to simplify code Peng Fan (OSS)
2025-02-05  0:45 ` [PATCH 4/4] input: touchscreen: ti_am335x_tsc: " Peng Fan (OSS)
2025-03-04  1:51 ` [PATCH 0/4] input: use devm_pm_set_wake_irq 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).