mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Jacky Bai <ping.bai@nxp.com>, Peng Fan <peng.fan@nxp.com>,
	"open list:REAL TIME CLOCK (RTC) SUBSYSTEM"
	<linux-rtc@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] rtc: bbnsm: add remove hook
Date: Fri, 1 Nov 2024 11:12:30 +0100	[thread overview]
Message-ID: <f22fc806-7816-4da9-8cac-a84db22d96fd@wanadoo.fr> (raw)
In-Reply-To: <20241101101032.1446992-1-peng.fan@oss.nxp.com>

Le 01/11/2024 à 11:10, Peng Fan (OSS) a écrit :
> From: Peng Fan <peng.fan@nxp.com>
> 
> Without remove hook to clear wake irq, there will be kernel dump when
> doing module test.
> "bbnsm_rtc 44440000.bbnsm:rtc: wake irq already initialized"
> 
> Add remove hook to clear wake irq and set wakeup to false.
> 
> Fixes: eb7b85853c38 ("rtc: bbnsm: Add the bbnsm rtc support")
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>   drivers/rtc/rtc-nxp-bbnsm.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-nxp-bbnsm.c b/drivers/rtc/rtc-nxp-bbnsm.c
> index acbfbeb8b070..fa88fd8ffadf 100644
> --- a/drivers/rtc/rtc-nxp-bbnsm.c
> +++ b/drivers/rtc/rtc-nxp-bbnsm.c
> @@ -206,6 +206,12 @@ static int bbnsm_rtc_probe(struct platform_device *pdev)
>   	return devm_rtc_register_device(bbnsm->rtc);
>   }
>   
> +static void bbnsm_rtc_remove(struct platform_device *pdev)
> +{
> +	dev_pm_clear_wake_irq(&pdev->dev);
> +	device_init_wakeup(&pdev->dev, false);

I think that an error handling path in the probe should also be added 
with such calls.

> +}
> +
>   static const struct of_device_id bbnsm_dt_ids[] = {
>   	{ .compatible = "nxp,imx93-bbnsm-rtc" },
>   	{ /* sentinel */ },
> @@ -218,6 +224,7 @@ static struct platform_driver bbnsm_rtc_driver = {
>   		.of_match_table = bbnsm_dt_ids,
>   	},
>   	.probe = bbnsm_rtc_probe,
> +	.remove_new = bbnsm_rtc_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_rtc_driver);
>   

CJ

WARNING: multiple messages have this Message-ID
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: bbnsm: add remove hook
Date: Fri, 1 Nov 2024 11:12:30 +0100	[thread overview]
Message-ID: <f22fc806-7816-4da9-8cac-a84db22d96fd@wanadoo.fr> (raw)
Message-ID: <20241101101230.tszQaCnY7hXR6aLStE_xgoIDMK13jlSzKKSCHCVCy_k@z> (raw)
In-Reply-To: <20241101101032.1446992-1-peng.fan@oss.nxp.com>

Le 01/11/2024 à 11:10, Peng Fan (OSS) a écrit :
> From: Peng Fan <peng.fan@nxp.com>
> 
> Without remove hook to clear wake irq, there will be kernel dump when
> doing module test.
> "bbnsm_rtc 44440000.bbnsm:rtc: wake irq already initialized"
> 
> Add remove hook to clear wake irq and set wakeup to false.
> 
> Fixes: eb7b85853c38 ("rtc: bbnsm: Add the bbnsm rtc support")
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>   drivers/rtc/rtc-nxp-bbnsm.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-nxp-bbnsm.c b/drivers/rtc/rtc-nxp-bbnsm.c
> index acbfbeb8b070..fa88fd8ffadf 100644
> --- a/drivers/rtc/rtc-nxp-bbnsm.c
> +++ b/drivers/rtc/rtc-nxp-bbnsm.c
> @@ -206,6 +206,12 @@ static int bbnsm_rtc_probe(struct platform_device *pdev)
>   	return devm_rtc_register_device(bbnsm->rtc);
>   }
>   
> +static void bbnsm_rtc_remove(struct platform_device *pdev)
> +{
> +	dev_pm_clear_wake_irq(&pdev->dev);
> +	device_init_wakeup(&pdev->dev, false);

I think that an error handling path in the probe should also be added 
with such calls.

> +}
> +
>   static const struct of_device_id bbnsm_dt_ids[] = {
>   	{ .compatible = "nxp,imx93-bbnsm-rtc" },
>   	{ /* sentinel */ },
> @@ -218,6 +224,7 @@ static struct platform_driver bbnsm_rtc_driver = {
>   		.of_match_table = bbnsm_dt_ids,
>   	},
>   	.probe = bbnsm_rtc_probe,
> +	.remove_new = bbnsm_rtc_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_rtc_driver);
>   

CJ


  reply	other threads:[~2024-11-01 10:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-01 10:10 Peng Fan (OSS)
2024-11-01 10:12 ` Christophe JAILLET [this message]
2024-11-01 10:12   ` Christophe JAILLET

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f22fc806-7816-4da9-8cac-a84db22d96fd@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=peng.fan@oss.nxp.com \
    --cc=ping.bai@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®