public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V4] Input: bbnsm_pwrkey - add remove hook
@ 2024-12-12  3:03 Peng Fan (OSS)
  2024-12-16 17:33 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Fan (OSS) @ 2024-12-12  3:03 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: Frank.Li, ping.bai, linux-input, linux-kernel, Peng Fan,
	Christophe JAILLET

From: Peng Fan <peng.fan@nxp.com>

Without remove hook to clear wake irq, there will be kernel dump when
doing module test.
"bbnsm_pwrkey 44440000.bbnsm:pwrkey: wake irq already initialized"

Add remove hook to clear wake irq and set wakeup to false.

Fixes: 40e40fdfec3f ("Input: bbnsm_pwrkey - add bbnsm power key support")
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---

V4:
 Fix build warning

V3:
 I tried to dev_pm_clear_wake_irq in common code, but Greg rejected:
 https://lore.kernel.org/all/2024111213-eradicate-puma-3592@gregkh/
 So post v3 with input_unregister_device dropped

V2:
Per Christophe JAILLET
 Use remove, not remove_new
 Drop checking bbnsm pointer in remove

 drivers/input/misc/nxp-bbnsm-pwrkey.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/input/misc/nxp-bbnsm-pwrkey.c b/drivers/input/misc/nxp-bbnsm-pwrkey.c
index eb4173f9c820..7ba8d166d68c 100644
--- a/drivers/input/misc/nxp-bbnsm-pwrkey.c
+++ b/drivers/input/misc/nxp-bbnsm-pwrkey.c
@@ -187,6 +187,12 @@ static int bbnsm_pwrkey_probe(struct platform_device *pdev)
 	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);
@@ -223,6 +229,8 @@ 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] 2+ messages in thread

* Re: [PATCH V4] Input: bbnsm_pwrkey - add remove hook
  2024-12-12  3:03 [PATCH V4] Input: bbnsm_pwrkey - add remove hook Peng Fan (OSS)
@ 2024-12-16 17:33 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2024-12-16 17:33 UTC (permalink / raw)
  To: Peng Fan (OSS)
  Cc: Frank.Li, ping.bai, linux-input, linux-kernel, Peng Fan,
	Christophe JAILLET

On Thu, Dec 12, 2024 at 11:03:22AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> Without remove hook to clear wake irq, there will be kernel dump when
> doing module test.
> "bbnsm_pwrkey 44440000.bbnsm:pwrkey: wake irq already initialized"
> 
> Add remove hook to clear wake irq and set wakeup to false.
> 
> Fixes: 40e40fdfec3f ("Input: bbnsm_pwrkey - add bbnsm power key support")
> Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> 
> V4:
>  Fix build warning
> 
> V3:
>  I tried to dev_pm_clear_wake_irq in common code, but Greg rejected:
>  https://lore.kernel.org/all/2024111213-eradicate-puma-3592@gregkh/
>  So post v3 with input_unregister_device dropped

Greg did not reject the patch, he asked for a better justification.
Please answer his questions (we clear a lot of resources in remove() to
reduce boilerplate in the drivers), in the meantime I will apply this
patch to fix the pressing issue.

Thanks.

-- 
Dmitry

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

end of thread, other threads:[~2024-12-16 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12  3:03 [PATCH V4] Input: bbnsm_pwrkey - add remove hook Peng Fan (OSS)
2024-12-16 17:33 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox