soc: imx8m: don't access of_root directly

Don't access of_root directly as it reduces the build test coverage for
this driver with COMPILE_TEST=y and OF=n. Use existing helper functions
to retrieve the relevant information.

Suggested-by: Rob Herring <robh@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20260223-soc-of-root-v2-6-b45da45903c8@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Bartosz Golaszewski 2026-02-23 14:37:21 +01:00 committed by Greg Kroah-Hartman
parent db0622ef4e
commit 2524b293a5

View File

@ -226,7 +226,6 @@ static int imx8m_soc_probe(struct platform_device *pdev)
const struct imx8_soc_data *data; const struct imx8_soc_data *data;
struct imx8_soc_drvdata *drvdata; struct imx8_soc_drvdata *drvdata;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const struct of_device_id *id;
struct soc_device *soc_dev; struct soc_device *soc_dev;
u32 soc_rev = 0; u32 soc_rev = 0;
u64 soc_uid[2] = {0, 0}; u64 soc_uid[2] = {0, 0};
@ -244,15 +243,11 @@ static int imx8m_soc_probe(struct platform_device *pdev)
soc_dev_attr->family = "Freescale i.MX"; soc_dev_attr->family = "Freescale i.MX";
ret = of_property_read_string(of_root, "model", &soc_dev_attr->machine); ret = soc_attr_read_machine(soc_dev_attr);
if (ret) if (ret)
return ret; return ret;
id = of_match_node(imx8_soc_match, of_root); data = device_get_match_data(dev);
if (!id)
return -ENODEV;
data = id->data;
if (data) { if (data) {
soc_dev_attr->soc_id = data->name; soc_dev_attr->soc_id = data->name;
ret = imx8m_soc_prepare(pdev, data->ocotp_compatible); ret = imx8m_soc_prepare(pdev, data->ocotp_compatible);
@ -326,7 +321,7 @@ static int __init imx8_soc_init(void)
int ret; int ret;
/* No match means this is non-i.MX8M hardware, do nothing. */ /* No match means this is non-i.MX8M hardware, do nothing. */
if (!of_match_node(imx8_soc_match, of_root)) if (!of_machine_device_match(imx8_soc_match))
return 0; return 0;
ret = platform_driver_register(&imx8m_soc_driver); ret = platform_driver_register(&imx8m_soc_driver);