mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
soc: imx8m: Unregister cpufreq and soc dev in cleanup path
[ Upstream commit cf7139aac463880cbd5c5e999c118fbe91631411 ]
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>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
296d16538d
commit
e4ab889d8b
@@ -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) : \
|
devm_kasprintf((dev), GFP_KERNEL, "%d.%d", ((soc_rev) >> 4) & 0xf, (soc_rev) & 0xf) : \
|
||||||
"unknown"
|
"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)
|
static int imx8m_soc_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct soc_device_attribute *soc_dev_attr;
|
struct soc_device_attribute *soc_dev_attr;
|
||||||
|
struct platform_device *cpufreq_dev;
|
||||||
const struct imx8_soc_data *data;
|
const struct imx8_soc_data *data;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
const struct of_device_id *id;
|
const struct of_device_id *id;
|
||||||
@@ -239,11 +250,22 @@ static int imx8m_soc_probe(struct platform_device *pdev)
|
|||||||
if (IS_ERR(soc_dev))
|
if (IS_ERR(soc_dev))
|
||||||
return PTR_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,
|
pr_info("SoC: %s revision %s\n", soc_dev_attr->soc_id,
|
||||||
soc_dev_attr->revision);
|
soc_dev_attr->revision);
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_ARM_IMX_CPUFREQ_DT))
|
if (IS_ENABLED(CONFIG_ARM_IMX_CPUFREQ_DT)) {
|
||||||
platform_device_register_simple("imx-cpufreq-dt", -1, NULL, 0);
|
cpufreq_dev = platform_device_register_simple("imx-cpufreq-dt", -1, NULL, 0);
|
||||||
|
if (IS_ERR(cpufreq_dev))
|
||||||
|
return dev_err_probe(dev, PTR_ERR(cpufreq_dev),
|
||||||
|
"Failed to register imx-cpufreq-dev device\n");
|
||||||
|
ret = devm_add_action(dev, imx8m_unregister_cpufreq, cpufreq_dev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user