[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4fada863-b125-454d-97d0-efbf44ec3bc8@wanadoo.fr>
Date: Fri, 1 Nov 2024 11:17:32 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: "Peng Fan (OSS)" <peng.fan@....nxp.com>, dmitry.torokhov@...il.com
Cc: Frank.Li@....com, ping.bai@....com, linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org, Peng Fan <peng.fan@....com>
Subject: Re: [PATCH] Input: bbnsm_pwrkey - add remove hook
Le 01/11/2024 à 11:12, Peng Fan (OSS) a écrit :
> From: Peng Fan <peng.fan@....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")
> Signed-off-by: Peng Fan <peng.fan@....com>
> ---
> drivers/input/misc/nxp-bbnsm-pwrkey.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/input/misc/nxp-bbnsm-pwrkey.c b/drivers/input/misc/nxp-bbnsm-pwrkey.c
> index eb4173f9c820..847964f7ebdd 100644
> --- a/drivers/input/misc/nxp-bbnsm-pwrkey.c
> +++ b/drivers/input/misc/nxp-bbnsm-pwrkey.c
> @@ -187,6 +187,17 @@ 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);
> +
> + if (bbnsm)
IIUC, no need to test, if the remove function is called, this can't be NULL.
> + 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 +234,8 @@ static struct platform_driver bbnsm_pwrkey_driver = {
> .of_match_table = bbnsm_pwrkey_ids,
> },
> .probe = bbnsm_pwrkey_probe,
> + .remove_new = bbnsm_pwrkey_remove,
I think that .remove should be used here instead.
(see
https://elixir.bootlin.com/linux/v6.12-rc5/source/include/linux/platform_device.h#L240)
> +
> };
> module_platform_driver(bbnsm_pwrkey_driver);
>
CJ
Powered by blists - more mailing lists