Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Bartosz Golaszewski and committed by
Greg Kroah-Hartman
2524b293 db0622ef

+3 -8
+3 -8
drivers/soc/imx/soc-imx8m.c
··· 226 226 const struct imx8_soc_data *data; 227 227 struct imx8_soc_drvdata *drvdata; 228 228 struct device *dev = &pdev->dev; 229 - const struct of_device_id *id; 230 229 struct soc_device *soc_dev; 231 230 u32 soc_rev = 0; 232 231 u64 soc_uid[2] = {0, 0}; ··· 243 244 244 245 soc_dev_attr->family = "Freescale i.MX"; 245 246 246 - ret = of_property_read_string(of_root, "model", &soc_dev_attr->machine); 247 + ret = soc_attr_read_machine(soc_dev_attr); 247 248 if (ret) 248 249 return ret; 249 250 250 - id = of_match_node(imx8_soc_match, of_root); 251 - if (!id) 252 - return -ENODEV; 253 - 254 - data = id->data; 251 + data = device_get_match_data(dev); 255 252 if (data) { 256 253 soc_dev_attr->soc_id = data->name; 257 254 ret = imx8m_soc_prepare(pdev, data->ocotp_compatible); ··· 321 326 int ret; 322 327 323 328 /* No match means this is non-i.MX8M hardware, do nothing. */ 324 - if (!of_match_node(imx8_soc_match, of_root)) 329 + if (!of_machine_device_match(imx8_soc_match)) 325 330 return 0; 326 331 327 332 ret = platform_driver_register(&imx8m_soc_driver);