From: Peng Fan <peng.fan@oss.nxp.com>
To: shawnguo@kernel.org, s.hauer@pengutronix.de
Cc: kernel@pengutronix.de, festevam@gmail.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, marex@denx.de,
Peng Fan <peng.fan@nxp.com>,
Marco Felsch <m.felsch@pengutronix.de>
Subject: Re: [PATCH V3] soc: imx8m: Unregister cpufreq and soc dev in cleanup path
Date: Fri, 14 Feb 2025 11:49:24 +0800 [thread overview]
Message-ID: <20250214034923.GA20275@localhost.localdomain> (raw)
In-Reply-To: <20241219145029.1776006-1-peng.fan@oss.nxp.com>
Hi Shawn,
On Thu, Dec 19, 2024 at 10:50:29PM +0800, Peng Fan (OSS) wrote:
>From: Peng Fan <peng.fan@nxp.com>
>
>Unregister the cpufreq device and soc device when resource unwinding,
>otherwise there will be warning when do removing test:
>sysfs: cannot create duplicate filename '/devices/platform/imx-cpufreq-dt'
>CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.13.0-rc1-next-20241204
>Hardware name: NXP i.MX8MPlus EVK board (DT)
>
>Fixes: 9cc832d37799 ("soc: imx8m: Probe the SoC driver as platform driver")
>Cc: Marco Felsch <m.felsch@pengutronix.de>
>Signed-off-by: Peng Fan <peng.fan@nxp.com>
>---
Any comments?
Thanks,
Peng
>
>V3:
> Per Marco, drop remove function, use devm_add_action and update the patch
> title accordingly.
>
>V2:
> Add err check when create the cpufreq platform device
> https://lore.kernel.org/all/20241217015826.1374497-1-peng.fan@oss.nxp.com/
>
> drivers/soc/imx/soc-imx8m.c | 23 +++++++++++++++++++++--
> 1 file changed, 21 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/soc/imx/soc-imx8m.c b/drivers/soc/imx/soc-imx8m.c
>index 8ac7658e3d52..585631b7ae44 100644
>--- a/drivers/soc/imx/soc-imx8m.c
>+++ b/drivers/soc/imx/soc-imx8m.c
>@@ -192,9 +192,20 @@ static __maybe_unused const struct of_device_id imx8_soc_match[] = {
> devm_kasprintf((dev), GFP_KERNEL, "%d.%d", ((soc_rev) >> 4) & 0xf, (soc_rev) & 0xf) : \
> "unknown"
>
>+static void imx8m_unregister_soc(void *data)
>+{
>+ soc_device_unregister(data);
>+}
>+
>+static void imx8m_unregister_cpufreq(void *data)
>+{
>+ platform_device_unregister(data);
>+}
>+
> static int imx8m_soc_probe(struct platform_device *pdev)
> {
> struct soc_device_attribute *soc_dev_attr;
>+ struct platform_device *cpufreq_dev;
> const struct imx8_soc_data *data;
> struct device *dev = &pdev->dev;
> const struct of_device_id *id;
>@@ -239,11 +250,19 @@ static int imx8m_soc_probe(struct platform_device *pdev)
> if (IS_ERR(soc_dev))
> return PTR_ERR(soc_dev);
>
>+ ret = devm_add_action(dev, imx8m_unregister_soc, soc_dev);
>+ if (ret)
>+ return ret;
>+
> pr_info("SoC: %s revision %s\n", soc_dev_attr->soc_id,
> soc_dev_attr->revision);
>
>- if (IS_ENABLED(CONFIG_ARM_IMX_CPUFREQ_DT))
>- platform_device_register_simple("imx-cpufreq-dt", -1, NULL, 0);
>+ if (IS_ENABLED(CONFIG_ARM_IMX_CPUFREQ_DT)) {
>+ cpufreq_dev = platform_device_register_simple("imx-cpufreq-dt", -1, NULL, 0);
>+ ret = devm_add_action(dev, imx8m_unregister_cpufreq, cpufreq_dev);
>+ if (ret)
>+ return ret;
>+ }
>
> return 0;
> }
>--
>2.37.1
>
>
next prev parent reply other threads:[~2025-02-14 3:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-19 14:50 [PATCH V3] soc: imx8m: Unregister cpufreq and soc dev in cleanup path Peng Fan (OSS)
2025-02-14 3:49 ` Peng Fan [this message]
2025-02-14 6:30 ` Marco Felsch
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=20250214034923.GA20275@localhost.localdomain \
--to=peng.fan@oss.nxp.com \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.felsch@pengutronix.de \
--cc=marex@denx.de \
--cc=peng.fan@nxp.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).