* [PATCH V2] Input: bbnsm_pwrkey - add remove hook
@ 2024-11-04 3:15 Peng Fan (OSS)
2024-11-05 5:48 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Peng Fan (OSS) @ 2024-11-04 3:15 UTC (permalink / raw)
To: Dmitry Torokhov, Peng Fan, Frank Li, Jacky Bai, Jason Liu,
open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
open list
Cc: 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>
---
V2:
Per Christophe JAILLET
Use remove, not remove_new
Drop checking bbnsm pointer in remove
drivers/input/misc/nxp-bbnsm-pwrkey.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/input/misc/nxp-bbnsm-pwrkey.c b/drivers/input/misc/nxp-bbnsm-pwrkey.c
index eb4173f9c820..f0bf119309dd 100644
--- a/drivers/input/misc/nxp-bbnsm-pwrkey.c
+++ b/drivers/input/misc/nxp-bbnsm-pwrkey.c
@@ -187,6 +187,16 @@ static int bbnsm_pwrkey_probe(struct platform_device *pdev)
return 0;
}
+static void bbnsm_pwrkey_remove(struct platform_device *pdev)
+{
+ struct bbnsm_pwrkey *bbnsm = platform_get_drvdata(pdev);
+
+ dev_pm_clear_wake_irq(&pdev->dev);
+ device_init_wakeup(&pdev->dev, false);
+
+ input_unregister_device(bbnsm->input);
+}
+
static int __maybe_unused bbnsm_pwrkey_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
@@ -223,6 +233,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] 3+ messages in thread
* Re: [PATCH V2] Input: bbnsm_pwrkey - add remove hook
2024-11-04 3:15 [PATCH V2] Input: bbnsm_pwrkey - add remove hook Peng Fan (OSS)
@ 2024-11-05 5:48 ` Dmitry Torokhov
2024-11-05 15:09 ` Peng Fan
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2024-11-05 5:48 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Peng Fan, Frank Li, Jacky Bai, Jason Liu,
open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
open list, Christophe JAILLET
Hi Peng,
On Mon, Nov 04, 2024 at 11:15:51AM +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>
> ---
>
> V2:
> Per Christophe JAILLET
> Use remove, not remove_new
> Drop checking bbnsm pointer in remove
>
> drivers/input/misc/nxp-bbnsm-pwrkey.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/input/misc/nxp-bbnsm-pwrkey.c b/drivers/input/misc/nxp-bbnsm-pwrkey.c
> index eb4173f9c820..f0bf119309dd 100644
> --- a/drivers/input/misc/nxp-bbnsm-pwrkey.c
> +++ b/drivers/input/misc/nxp-bbnsm-pwrkey.c
> @@ -187,6 +187,16 @@ static int bbnsm_pwrkey_probe(struct platform_device *pdev)
> return 0;
> }
>
> +static void bbnsm_pwrkey_remove(struct platform_device *pdev)
> +{
> + struct bbnsm_pwrkey *bbnsm = platform_get_drvdata(pdev);
> +
> + dev_pm_clear_wake_irq(&pdev->dev);
I wonder, could we have this done in the driver core instead of
individual drivers?
> + device_init_wakeup(&pdev->dev, false);
> +
> + input_unregister_device(bbnsm->input);
No need to call unregister here, it should happen automatically.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH V2] Input: bbnsm_pwrkey - add remove hook
2024-11-05 5:48 ` Dmitry Torokhov
@ 2024-11-05 15:09 ` Peng Fan
0 siblings, 0 replies; 3+ messages in thread
From: Peng Fan @ 2024-11-05 15:09 UTC (permalink / raw)
To: Dmitry Torokhov, Peng Fan (OSS)
Cc: Frank Li, Jacky Bai, Jason Liu,
open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,
open list, Christophe JAILLET
Hi Dmitry,
> Subject: Re: [PATCH V2] Input: bbnsm_pwrkey - add remove hook
>
> Hi Peng,
>
> On Mon, Nov 04, 2024 at 11:15:51AM +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>
> > ---
> >
> > V2:
> > Per Christophe JAILLET
> > Use remove, not remove_new
> > Drop checking bbnsm pointer in remove
> >
> > drivers/input/misc/nxp-bbnsm-pwrkey.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/input/misc/nxp-bbnsm-pwrkey.c
> > b/drivers/input/misc/nxp-bbnsm-pwrkey.c
> > index eb4173f9c820..f0bf119309dd 100644
> > --- a/drivers/input/misc/nxp-bbnsm-pwrkey.c
> > +++ b/drivers/input/misc/nxp-bbnsm-pwrkey.c
> > @@ -187,6 +187,16 @@ static int bbnsm_pwrkey_probe(struct
> platform_device *pdev)
> > return 0;
> > }
> >
> > +static void bbnsm_pwrkey_remove(struct platform_device *pdev) {
> > + struct bbnsm_pwrkey *bbnsm = platform_get_drvdata(pdev);
> > +
> > + dev_pm_clear_wake_irq(&pdev->dev);
>
> I wonder, could we have this done in the driver core instead of
> individual drivers?
I will give a look to see whether possible to make it in
device_unbind_cleanup. But as a bug fix, I still need
to do this in remove. In future, if clear wake irq
could be in driver core, it could be remove in the
individual driver remove path. How do you think?
>
> > + device_init_wakeup(&pdev->dev, false);
> > +
> > + input_unregister_device(bbnsm->input);
>
> No need to call unregister here, it should happen automatically.
sure. I will remove this line.
Thanks,
Peng.
>
> Thanks.
>
> --
> Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-05 15:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-04 3:15 [PATCH V2] Input: bbnsm_pwrkey - add remove hook Peng Fan (OSS)
2024-11-05 5:48 ` Dmitry Torokhov
2024-11-05 15:09 ` 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).