summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx/cpu.c
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2020-05-20 13:51:27 +0800
committerShawn Guo <shawnguo@kernel.org>2020-05-20 23:03:42 +0800
commitd2199b34871b859d33cd08398af5f1530241cb4e (patch)
tree3f70f844fa1c817d1aedcc13792f5ba970130b4a /arch/arm/mach-imx/cpu.c
parent64d7bf58e72be362ce2f2682e1250dcf2e61a1e6 (diff)
ARM: imx: use device_initcall for imx_soc_device_init
This is preparation to move imx_soc_device_init to drivers/soc/imx/ There is no reason to must put dt devices under /sys/devices/soc0, they could also be under /sys/devices/platform, so we could pass NULL as parent when calling of_platform_default_populate. Following soc-imx8.c soc-imx-scu.c using device_initcall, need to change return type to int type for imx_soc_device_init. Signed-off-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Diffstat (limited to 'arch/arm/mach-imx/cpu.c')
-rw-r--r--arch/arm/mach-imx/cpu.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index e3d12b21d6f6..75ffcba9f878 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -83,7 +83,7 @@ void __init imx_aips_allow_unprivileged_access(
}
}
-struct device * __init imx_soc_device_init(void)
+static int __init imx_soc_device_init(void)
{
struct soc_device_attribute *soc_dev_attr;
const char *ocotp_compat = NULL;
@@ -97,7 +97,7 @@ struct device * __init imx_soc_device_init(void)
soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
if (!soc_dev_attr)
- return NULL;
+ return -ENOMEM;
soc_dev_attr->family = "Freescale i.MX";
@@ -224,18 +224,24 @@ struct device * __init imx_soc_device_init(void)
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d.%d",
(imx_soc_revision >> 4) & 0xf,
imx_soc_revision & 0xf);
- if (!soc_dev_attr->revision)
+ if (!soc_dev_attr->revision) {
+ ret = -ENOMEM;
goto free_soc;
+ }
soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", soc_uid);
- if (!soc_dev_attr->serial_number)
+ if (!soc_dev_attr->serial_number) {
+ ret = -ENOMEM;
goto free_rev;
+ }
soc_dev = soc_device_register(soc_dev_attr);
- if (IS_ERR(soc_dev))
+ if (IS_ERR(soc_dev)) {
+ ret = PTR_ERR(soc_dev);
goto free_serial_number;
+ }
- return soc_device_to_device(soc_dev);
+ return 0;
free_serial_number:
kfree(soc_dev_attr->serial_number);
@@ -243,5 +249,6 @@ free_rev:
kfree(soc_dev_attr->revision);
free_soc:
kfree(soc_dev_attr);
- return NULL;
+ return ret;
}
+device_initcall(imx_soc_device_init);