* [PATCH v2 1/9] of: provide of_machine_read_compatible()
2026-02-23 13:37 [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/ Bartosz Golaszewski
@ 2026-02-23 13:37 ` Bartosz Golaszewski
2026-02-23 13:37 ` [PATCH v2 2/9] of: provide of_machine_read_model() Bartosz Golaszewski
` (8 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 13:37 UTC (permalink / raw)
To: Rob Herring, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li
Cc: devicetree, linux-kernel, linuxppc-dev, linux-arm-kernel, imx,
linux-renesas-soc, linux-sunxi, driver-core, Bartosz Golaszewski
Provide a helper function allowing users to read the compatible string
of the machine, hiding the access to the root node.
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/of/base.c | 15 +++++++++++++++
include/linux/of.h | 8 ++++++++
2 files changed, 23 insertions(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 57420806c1a2b9a3c67b5dcc0f95610a87c2e46f..b70aec32e0e35ee232b413e548742491bf763df7 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -434,6 +434,21 @@ bool of_machine_compatible_match(const char *const *compats)
}
EXPORT_SYMBOL(of_machine_compatible_match);
+/**
+ * of_machine_read_compatible - Get the compatible string of this machine
+ * @compatible: address at which the address of the compatible string will be
+ * stored
+ * @index: index of the compatible entry in the list
+ *
+ * Returns:
+ * 0 on success, negative error number on failure.
+ */
+int of_machine_read_compatible(const char **compatible, unsigned int index)
+{
+ return of_property_read_string_index(of_root, "compatible", index, compatible);
+}
+EXPORT_SYMBOL_GPL(of_machine_read_compatible);
+
/**
* of_machine_device_match - Test root of device tree against a of_device_id array
* @matches: NULL terminated array of of_device_id match structures to search in
diff --git a/include/linux/of.h b/include/linux/of.h
index be6ec4916adf522aa5e4dcb1480fe91e1a4e29d2..7df971d52b556f21b510a8b5ebfc8df49a2a6f64 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -426,6 +426,8 @@ static inline bool of_machine_is_compatible(const char *compat)
return of_machine_compatible_match(compats);
}
+int of_machine_read_compatible(const char **compatible, unsigned int index);
+
extern int of_add_property(struct device_node *np, struct property *prop);
extern int of_remove_property(struct device_node *np, struct property *prop);
extern int of_update_property(struct device_node *np, struct property *newprop);
@@ -851,6 +853,12 @@ static inline int of_machine_is_compatible(const char *compat)
return 0;
}
+static inline int of_machine_read_compatible(const char **compatible,
+ unsigned int index)
+{
+ return -ENOSYS;
+}
+
static inline int of_add_property(struct device_node *np, struct property *prop)
{
return 0;
--
2.47.3
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH v2 2/9] of: provide of_machine_read_model()
2026-02-23 13:37 [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/ Bartosz Golaszewski
2026-02-23 13:37 ` [PATCH v2 1/9] of: provide of_machine_read_compatible() Bartosz Golaszewski
@ 2026-02-23 13:37 ` Bartosz Golaszewski
2026-02-23 13:37 ` [PATCH v2 3/9] base: soc: order includes alphabetically Bartosz Golaszewski
` (7 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 13:37 UTC (permalink / raw)
To: Rob Herring, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li
Cc: devicetree, linux-kernel, linuxppc-dev, linux-arm-kernel, imx,
linux-renesas-soc, linux-sunxi, driver-core, Bartosz Golaszewski
Provide a helper function allowing users to read the model string of the
machine, hiding the access to the root node.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/of/base.c | 13 +++++++++++++
include/linux/of.h | 6 ++++++
2 files changed, 19 insertions(+)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index b70aec32e0e35ee232b413e548742491bf763df7..bf4a51887d7422f5b8bfc63c7b20674bf03d800e 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -449,6 +449,19 @@ int of_machine_read_compatible(const char **compatible, unsigned int index)
}
EXPORT_SYMBOL_GPL(of_machine_read_compatible);
+/**
+ * of_machine_read_model - Get the model string of this machine
+ * @model: address at which the address of the model string will be stored
+ *
+ * Returns:
+ * 0 on success, negative error number on failure.
+ */
+int of_machine_read_model(const char **model)
+{
+ return of_property_read_string(of_root, "model", model);
+}
+EXPORT_SYMBOL_GPL(of_machine_read_model);
+
/**
* of_machine_device_match - Test root of device tree against a of_device_id array
* @matches: NULL terminated array of of_device_id match structures to search in
diff --git a/include/linux/of.h b/include/linux/of.h
index 7df971d52b556f21b510a8b5ebfc8df49a2a6f64..2b95777f16f6ea1fb1e4bd0d9902cc2640d14795 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -427,6 +427,7 @@ static inline bool of_machine_is_compatible(const char *compat)
}
int of_machine_read_compatible(const char **compatible, unsigned int index);
+int of_machine_read_model(const char **model);
extern int of_add_property(struct device_node *np, struct property *prop);
extern int of_remove_property(struct device_node *np, struct property *prop);
@@ -859,6 +860,11 @@ static inline int of_machine_read_compatible(const char **compatible,
return -ENOSYS;
}
+static inline int of_machine_read_model(const char **model)
+{
+ return -ENOSYS;
+}
+
static inline int of_add_property(struct device_node *np, struct property *prop)
{
return 0;
--
2.47.3
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH v2 3/9] base: soc: order includes alphabetically
2026-02-23 13:37 [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/ Bartosz Golaszewski
2026-02-23 13:37 ` [PATCH v2 1/9] of: provide of_machine_read_compatible() Bartosz Golaszewski
2026-02-23 13:37 ` [PATCH v2 2/9] of: provide of_machine_read_model() Bartosz Golaszewski
@ 2026-02-23 13:37 ` Bartosz Golaszewski
2026-02-23 13:37 ` [PATCH v2 4/9] base: soc: rename and export soc_device_get_machine() Bartosz Golaszewski
` (6 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 13:37 UTC (permalink / raw)
To: Rob Herring, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li
Cc: devicetree, linux-kernel, linuxppc-dev, linux-arm-kernel, imx,
linux-renesas-soc, linux-sunxi, driver-core, Bartosz Golaszewski
For easier readability and maintenance, order the included headers
alphabetically.
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/base/soc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/base/soc.c b/drivers/base/soc.c
index c8d3db9daa2f02c93aeefda9dd9c5ede148a676f..48e2f0dbd330b8d402135ffa7308f454eb4ab7a5 100644
--- a/drivers/base/soc.c
+++ b/drivers/base/soc.c
@@ -5,16 +5,16 @@
* Author: Lee Jones <lee.jones@linaro.org> for ST-Ericsson.
*/
-#include <linux/sysfs.h>
+#include <linux/err.h>
+#include <linux/glob.h>
+#include <linux/idr.h>
#include <linux/init.h>
#include <linux/of.h>
-#include <linux/stat.h>
#include <linux/slab.h>
-#include <linux/idr.h>
#include <linux/spinlock.h>
+#include <linux/stat.h>
+#include <linux/sysfs.h>
#include <linux/sys_soc.h>
-#include <linux/err.h>
-#include <linux/glob.h>
static DEFINE_IDA(soc_ida);
--
2.47.3
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH v2 4/9] base: soc: rename and export soc_device_get_machine()
2026-02-23 13:37 [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/ Bartosz Golaszewski
` (2 preceding siblings ...)
2026-02-23 13:37 ` [PATCH v2 3/9] base: soc: order includes alphabetically Bartosz Golaszewski
@ 2026-02-23 13:37 ` Bartosz Golaszewski
2026-02-23 13:37 ` [PATCH v2 5/9] soc: fsl: guts: don't access of_root directly Bartosz Golaszewski
` (5 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 13:37 UTC (permalink / raw)
To: Rob Herring, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li
Cc: devicetree, linux-kernel, linuxppc-dev, linux-arm-kernel, imx,
linux-renesas-soc, linux-sunxi, driver-core, Bartosz Golaszewski
Some SoC drivers reimplement the functionality of
soc_device_get_machine(). Make this function accessible through the
sys_soc.h header and rename it to a more descriptive name.
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/base/soc.c | 13 +++++--------
include/linux/sys_soc.h | 10 ++++++++++
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/base/soc.c b/drivers/base/soc.c
index 48e2f0dbd330b8d402135ffa7308f454eb4ab7a5..65ce72d49230360c22a812cb9286e7fb4de0baf2 100644
--- a/drivers/base/soc.c
+++ b/drivers/base/soc.c
@@ -111,17 +111,14 @@ static void soc_release(struct device *dev)
kfree(soc_dev);
}
-static void soc_device_get_machine(struct soc_device_attribute *soc_dev_attr)
+int soc_attr_read_machine(struct soc_device_attribute *soc_dev_attr)
{
- struct device_node *np;
-
if (soc_dev_attr->machine)
- return;
+ return -EBUSY;
- np = of_find_node_by_path("/");
- of_property_read_string(np, "model", &soc_dev_attr->machine);
- of_node_put(np);
+ return of_machine_read_model(&soc_dev_attr->machine);
}
+EXPORT_SYMBOL_GPL(soc_attr_read_machine);
static struct soc_device_attribute *early_soc_dev_attr;
@@ -131,7 +128,7 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr
const struct attribute_group **soc_attr_groups;
int ret;
- soc_device_get_machine(soc_dev_attr);
+ soc_attr_read_machine(soc_dev_attr);
if (!soc_bus_registered) {
if (early_soc_dev_attr)
diff --git a/include/linux/sys_soc.h b/include/linux/sys_soc.h
index d9b3cf0f410c8cfb509a4c1a4d6c83fde6fe33c6..f19f5cec18e28461fef57f22702d2c44a41e4193 100644
--- a/include/linux/sys_soc.h
+++ b/include/linux/sys_soc.h
@@ -37,6 +37,16 @@ void soc_device_unregister(struct soc_device *soc_dev);
*/
struct device *soc_device_to_device(struct soc_device *soc);
+/**
+ * soc_attr_read_machine - retrieve the machine model and store it in
+ * the soc_device_attribute structure
+ * @soc_dev_attr: SoC attribute structure to store the model in
+ *
+ * Returns:
+ * 0 on success, negative error number on failure.
+ */
+int soc_attr_read_machine(struct soc_device_attribute *soc_dev_attr);
+
#ifdef CONFIG_SOC_BUS
const struct soc_device_attribute *soc_device_match(
const struct soc_device_attribute *matches);
--
2.47.3
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH v2 5/9] soc: fsl: guts: don't access of_root directly
2026-02-23 13:37 [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/ Bartosz Golaszewski
` (3 preceding siblings ...)
2026-02-23 13:37 ` [PATCH v2 4/9] base: soc: rename and export soc_device_get_machine() Bartosz Golaszewski
@ 2026-02-23 13:37 ` Bartosz Golaszewski
2026-02-23 13:37 ` [PATCH v2 6/9] soc: imx8m: " Bartosz Golaszewski
` (4 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 13:37 UTC (permalink / raw)
To: Rob Herring, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li
Cc: devicetree, linux-kernel, linuxppc-dev, linux-arm-kernel, imx,
linux-renesas-soc, linux-sunxi, driver-core, Bartosz Golaszewski
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>
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Acked-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/soc/fsl/guts.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c
index 40afb27b582b1bbea004ca91b96d0a998e7a6582..9bee7baec2b9b3a548b16661f9ba86db2b982910 100644
--- a/drivers/soc/fsl/guts.c
+++ b/drivers/soc/fsl/guts.c
@@ -186,7 +186,6 @@ static int __init fsl_guts_init(void)
const struct fsl_soc_data *soc_data;
const struct of_device_id *match;
struct ccsr_guts __iomem *regs;
- const char *machine = NULL;
struct device_node *np;
bool little_endian;
u64 soc_uid = 0;
@@ -217,13 +216,9 @@ static int __init fsl_guts_init(void)
if (!soc_dev_attr)
return -ENOMEM;
- if (of_property_read_string(of_root, "model", &machine))
- of_property_read_string_index(of_root, "compatible", 0, &machine);
- if (machine) {
- soc_dev_attr->machine = kstrdup(machine, GFP_KERNEL);
- if (!soc_dev_attr->machine)
- goto err_nomem;
- }
+ ret = soc_attr_read_machine(soc_dev_attr);
+ if (ret)
+ of_machine_read_compatible(&soc_dev_attr->machine, 0);
soc_die = fsl_soc_die_match(svr, fsl_soc_die);
if (soc_die) {
@@ -267,7 +262,6 @@ static int __init fsl_guts_init(void)
err_nomem:
ret = -ENOMEM;
err:
- kfree(soc_dev_attr->machine);
kfree(soc_dev_attr->family);
kfree(soc_dev_attr->soc_id);
kfree(soc_dev_attr->revision);
--
2.47.3
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH v2 6/9] soc: imx8m: don't access of_root directly
2026-02-23 13:37 [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/ Bartosz Golaszewski
` (4 preceding siblings ...)
2026-02-23 13:37 ` [PATCH v2 5/9] soc: fsl: guts: don't access of_root directly Bartosz Golaszewski
@ 2026-02-23 13:37 ` Bartosz Golaszewski
2026-02-25 7:55 ` Peng Fan
2026-03-24 10:24 ` Alexander Stein
2026-02-23 13:37 ` [PATCH v2 7/9] soc: imx9: " Bartosz Golaszewski
` (3 subsequent siblings)
9 siblings, 2 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 13:37 UTC (permalink / raw)
To: Rob Herring, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li
Cc: devicetree, linux-kernel, linuxppc-dev, linux-arm-kernel, imx,
linux-renesas-soc, linux-sunxi, driver-core, Bartosz Golaszewski
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>
---
drivers/soc/imx/soc-imx8m.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/soc/imx/soc-imx8m.c b/drivers/soc/imx/soc-imx8m.c
index 8e2322999f0996d2723768469c6893b0ea22eb9d..77763a107edbd11302017e3f61ecb4369fda1ab0 100644
--- a/drivers/soc/imx/soc-imx8m.c
+++ b/drivers/soc/imx/soc-imx8m.c
@@ -226,7 +226,6 @@ static int imx8m_soc_probe(struct platform_device *pdev)
const struct imx8_soc_data *data;
struct imx8_soc_drvdata *drvdata;
struct device *dev = &pdev->dev;
- const struct of_device_id *id;
struct soc_device *soc_dev;
u32 soc_rev = 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";
- ret = of_property_read_string(of_root, "model", &soc_dev_attr->machine);
+ ret = soc_attr_read_machine(soc_dev_attr);
if (ret)
return ret;
- id = of_match_node(imx8_soc_match, of_root);
- if (!id)
- return -ENODEV;
-
- data = id->data;
+ data = device_get_match_data(dev);
if (data) {
soc_dev_attr->soc_id = data->name;
ret = imx8m_soc_prepare(pdev, data->ocotp_compatible);
@@ -326,7 +321,7 @@ static int __init imx8_soc_init(void)
int ret;
/* 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;
ret = platform_driver_register(&imx8m_soc_driver);
--
2.47.3
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH v2 6/9] soc: imx8m: don't access of_root directly
2026-02-23 13:37 ` [PATCH v2 6/9] soc: imx8m: " Bartosz Golaszewski
@ 2026-02-25 7:55 ` Peng Fan
2026-03-24 10:24 ` Alexander Stein
1 sibling, 0 replies; 22+ messages in thread
From: Peng Fan @ 2026-02-25 7:55 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Rob Herring, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li, devicetree, linux-kernel, linuxppc-dev,
linux-arm-kernel, imx, linux-renesas-soc, linux-sunxi,
driver-core
On Mon, Feb 23, 2026 at 02:37:21PM +0100, Bartosz Golaszewski wrote:
>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>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 6/9] soc: imx8m: don't access of_root directly
2026-02-23 13:37 ` [PATCH v2 6/9] soc: imx8m: " Bartosz Golaszewski
2026-02-25 7:55 ` Peng Fan
@ 2026-03-24 10:24 ` Alexander Stein
1 sibling, 0 replies; 22+ messages in thread
From: Alexander Stein @ 2026-03-24 10:24 UTC (permalink / raw)
To: Rob Herring, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li, linux-arm-kernel
Cc: devicetree, linux-kernel, linuxppc-dev, linux-arm-kernel, imx,
linux-renesas-soc, linux-sunxi, driver-core, Bartosz Golaszewski,
Bartosz Golaszewski
Hi,
Am Montag, 23. Februar 2026, 14:37:21 CET schrieb Bartosz Golaszewski:
> 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>
today I noticed the following warning running next-20260323:
> caam 30900000.crypto: No clock data provided for i.MX SoC
This happens when there is no matching against the soc_id.
Checking the source it turns out this patch is the cause that the SoC info
does not provide soc_id anymore.
next-20260323:
> $ grep . /sys/devices/soc0/*
> /sys/devices/soc0/family:Freescale i.MX
> /sys/devices/soc0/machine:TQ-Systems i.MX8MPlus TQMa8MPxL on MBa8MP-RAS314
> grep: /sys/devices/soc0/power: Is a directory
> /sys/devices/soc0/revision:unknown
> /sys/devices/soc0/serial_number:0000000000000000
> grep: /sys/devices/soc0/subsystem: Is a directory
reverting this patch (2524b293a59e586afd06358d0b191ab57208a920):
> $ grep . /sys/devices/soc0/*
> /sys/devices/soc0/family:Freescale i.MX
> /sys/devices/soc0/machine:TQ-Systems i.MX8MPlus TQMa8MPxL on MBa8MP-RAS314
> grep: /sys/devices/soc0/power: Is a directory
> /sys/devices/soc0/revision:1.1
> /sys/devices/soc0/serial_number:469677A693A4B8CE131D180033E44903
> /sys/devices/soc0/soc_id:i.MX8MP
> grep: /sys/devices/soc0/subsystem: Is a directory
soc_id is restored. Now that I write these lines I noticed that
serial_number also contained empty value which is restored with the revert.
Best regards,
Alexander
> ---
> drivers/soc/imx/soc-imx8m.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/soc/imx/soc-imx8m.c b/drivers/soc/imx/soc-imx8m.c
> index 8e2322999f0996d2723768469c6893b0ea22eb9d..77763a107edbd11302017e3f61ecb4369fda1ab0 100644
> --- a/drivers/soc/imx/soc-imx8m.c
> +++ b/drivers/soc/imx/soc-imx8m.c
> @@ -226,7 +226,6 @@ static int imx8m_soc_probe(struct platform_device *pdev)
> const struct imx8_soc_data *data;
> struct imx8_soc_drvdata *drvdata;
> struct device *dev = &pdev->dev;
> - const struct of_device_id *id;
> struct soc_device *soc_dev;
> u32 soc_rev = 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";
>
> - ret = of_property_read_string(of_root, "model", &soc_dev_attr->machine);
> + ret = soc_attr_read_machine(soc_dev_attr);
> if (ret)
> return ret;
>
> - id = of_match_node(imx8_soc_match, of_root);
> - if (!id)
> - return -ENODEV;
> -
> - data = id->data;
> + data = device_get_match_data(dev);
> if (data) {
> soc_dev_attr->soc_id = data->name;
> ret = imx8m_soc_prepare(pdev, data->ocotp_compatible);
> @@ -326,7 +321,7 @@ static int __init imx8_soc_init(void)
> int ret;
>
> /* 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;
>
> ret = platform_driver_register(&imx8m_soc_driver);
>
>
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 7/9] soc: imx9: don't access of_root directly
2026-02-23 13:37 [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/ Bartosz Golaszewski
` (5 preceding siblings ...)
2026-02-23 13:37 ` [PATCH v2 6/9] soc: imx8m: " Bartosz Golaszewski
@ 2026-02-23 13:37 ` Bartosz Golaszewski
2026-02-23 13:37 ` [PATCH v2 8/9] soc: renesas: " Bartosz Golaszewski
` (2 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 13:37 UTC (permalink / raw)
To: Rob Herring, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li
Cc: devicetree, linux-kernel, linuxppc-dev, linux-arm-kernel, imx,
linux-renesas-soc, linux-sunxi, driver-core, Bartosz Golaszewski,
Peng Fan
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>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/soc/imx/soc-imx9.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/imx/soc-imx9.c b/drivers/soc/imx/soc-imx9.c
index d67bc7402b10e2966ff77cbf3b15c087540bd377..58eef7d4f9089ae56891507e8dec383e69884ec5 100644
--- a/drivers/soc/imx/soc-imx9.c
+++ b/drivers/soc/imx/soc-imx9.c
@@ -30,7 +30,7 @@ static int imx9_soc_probe(struct platform_device *pdev)
if (!attr)
return -ENOMEM;
- err = of_property_read_string(of_root, "model", &attr->machine);
+ err = soc_attr_read_machine(attr);
if (err)
return dev_err_probe(dev, err, "%s: missing model property\n", __func__);
@@ -89,7 +89,7 @@ static int __init imx9_soc_init(void)
struct platform_device *pdev;
/* No match means it is not an i.MX 9 series SoC, do nothing. */
- if (!of_match_node(imx9_soc_match, of_root))
+ if (!of_machine_device_match(imx9_soc_match))
return 0;
ret = platform_driver_register(&imx9_soc_driver);
--
2.47.3
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH v2 8/9] soc: renesas: don't access of_root directly
2026-02-23 13:37 [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/ Bartosz Golaszewski
` (6 preceding siblings ...)
2026-02-23 13:37 ` [PATCH v2 7/9] soc: imx9: " Bartosz Golaszewski
@ 2026-02-23 13:37 ` Bartosz Golaszewski
2026-02-24 18:32 ` Rob Herring
2026-03-02 16:32 ` Geert Uytterhoeven
2026-02-23 13:37 ` [PATCH v2 9/9] soc: sunxi: mbus: " Bartosz Golaszewski
2026-02-24 18:38 ` [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/ Rob Herring
9 siblings, 2 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 13:37 UTC (permalink / raw)
To: Rob Herring, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li
Cc: devicetree, linux-kernel, linuxppc-dev, linux-arm-kernel, imx,
linux-renesas-soc, linux-sunxi, driver-core, Bartosz Golaszewski
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>
---
drivers/soc/renesas/renesas-soc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesas-soc.c
index 38ff0b823bdaf1ba106bfb57ed423158d9103f8d..bd8ba0ac30fa91fcf2a10edd0d58b064650085cf 100644
--- a/drivers/soc/renesas/renesas-soc.c
+++ b/drivers/soc/renesas/renesas-soc.c
@@ -6,6 +6,7 @@
*/
#include <linux/bitfield.h>
+#include <linux/cleanup.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_address.h>
@@ -468,7 +469,11 @@ static int __init renesas_soc_init(void)
const char *soc_id;
int ret;
- match = of_match_node(renesas_socs, of_root);
+ struct device_node *root __free(device_node) = of_find_node_by_path("/");
+ if (!root)
+ return -ENOENT;
+
+ match = of_match_node(renesas_socs, root);
if (!match)
return -ENODEV;
--
2.47.3
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH v2 8/9] soc: renesas: don't access of_root directly
2026-02-23 13:37 ` [PATCH v2 8/9] soc: renesas: " Bartosz Golaszewski
@ 2026-02-24 18:32 ` Rob Herring
2026-02-25 9:42 ` Bartosz Golaszewski
2026-03-02 16:32 ` Geert Uytterhoeven
1 sibling, 1 reply; 22+ messages in thread
From: Rob Herring @ 2026-02-24 18:32 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich, Christophe Leroy (CS GROUP), Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li, devicetree, linux-kernel, linuxppc-dev,
linux-arm-kernel, imx, linux-renesas-soc, linux-sunxi,
driver-core
On Mon, Feb 23, 2026 at 02:37:23PM +0100, Bartosz Golaszewski wrote:
> 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>
> ---
> drivers/soc/renesas/renesas-soc.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesas-soc.c
> index 38ff0b823bdaf1ba106bfb57ed423158d9103f8d..bd8ba0ac30fa91fcf2a10edd0d58b064650085cf 100644
> --- a/drivers/soc/renesas/renesas-soc.c
> +++ b/drivers/soc/renesas/renesas-soc.c
> @@ -6,6 +6,7 @@
> */
>
> #include <linux/bitfield.h>
> +#include <linux/cleanup.h>
> #include <linux/io.h>
> #include <linux/of.h>
> #include <linux/of_address.h>
> @@ -468,7 +469,11 @@ static int __init renesas_soc_init(void)
> const char *soc_id;
> int ret;
>
> - match = of_match_node(renesas_socs, of_root);
> + struct device_node *root __free(device_node) = of_find_node_by_path("/");
> + if (!root)
> + return -ENOENT;
> +
> + match = of_match_node(renesas_socs, root);
Doesn't of_machine_device_match() work here?
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH v2 8/9] soc: renesas: don't access of_root directly
2026-02-24 18:32 ` Rob Herring
@ 2026-02-25 9:42 ` Bartosz Golaszewski
2026-02-25 21:47 ` Rob Herring
0 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2026-02-25 9:42 UTC (permalink / raw)
To: Rob Herring
Cc: Bartosz Golaszewski, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li, devicetree, linux-kernel, linuxppc-dev,
linux-arm-kernel, imx, linux-renesas-soc, linux-sunxi,
driver-core
On Tue, Feb 24, 2026 at 7:32 PM Rob Herring <robh@kernel.org> wrote:
>
> On Mon, Feb 23, 2026 at 02:37:23PM +0100, Bartosz Golaszewski wrote:
> > 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>
> > ---
> > drivers/soc/renesas/renesas-soc.c | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesas-soc.c
> > index 38ff0b823bdaf1ba106bfb57ed423158d9103f8d..bd8ba0ac30fa91fcf2a10edd0d58b064650085cf 100644
> > --- a/drivers/soc/renesas/renesas-soc.c
> > +++ b/drivers/soc/renesas/renesas-soc.c
> > @@ -6,6 +6,7 @@
> > */
> >
> > #include <linux/bitfield.h>
> > +#include <linux/cleanup.h>
> > #include <linux/io.h>
> > #include <linux/of.h>
> > #include <linux/of_address.h>
> > @@ -468,7 +469,11 @@ static int __init renesas_soc_init(void)
> > const char *soc_id;
> > int ret;
> >
> > - match = of_match_node(renesas_socs, of_root);
> > + struct device_node *root __free(device_node) = of_find_node_by_path("/");
> > + if (!root)
> > + return -ENOENT;
> > +
> > + match = of_match_node(renesas_socs, root);
>
> Doesn't of_machine_device_match() work here?
>
No, because we're using the returned address of the matching struct
of_device_id later in the function. If you think it's a better idea to
introduce of_machine_match_node(), let me know but I think that should
be done separately.
Bart
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH v2 8/9] soc: renesas: don't access of_root directly
2026-02-25 9:42 ` Bartosz Golaszewski
@ 2026-02-25 21:47 ` Rob Herring
0 siblings, 0 replies; 22+ messages in thread
From: Rob Herring @ 2026-02-25 21:47 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Bartosz Golaszewski, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li, devicetree, linux-kernel, linuxppc-dev,
linux-arm-kernel, imx, linux-renesas-soc, linux-sunxi,
driver-core
On Wed, Feb 25, 2026 at 3:42 AM Bartosz Golaszewski <brgl@kernel.org> wrote:
>
> On Tue, Feb 24, 2026 at 7:32 PM Rob Herring <robh@kernel.org> wrote:
> >
> > On Mon, Feb 23, 2026 at 02:37:23PM +0100, Bartosz Golaszewski wrote:
> > > 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>
> > > ---
> > > drivers/soc/renesas/renesas-soc.c | 7 ++++++-
> > > 1 file changed, 6 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesas-soc.c
> > > index 38ff0b823bdaf1ba106bfb57ed423158d9103f8d..bd8ba0ac30fa91fcf2a10edd0d58b064650085cf 100644
> > > --- a/drivers/soc/renesas/renesas-soc.c
> > > +++ b/drivers/soc/renesas/renesas-soc.c
> > > @@ -6,6 +6,7 @@
> > > */
> > >
> > > #include <linux/bitfield.h>
> > > +#include <linux/cleanup.h>
> > > #include <linux/io.h>
> > > #include <linux/of.h>
> > > #include <linux/of_address.h>
> > > @@ -468,7 +469,11 @@ static int __init renesas_soc_init(void)
> > > const char *soc_id;
> > > int ret;
> > >
> > > - match = of_match_node(renesas_socs, of_root);
> > > + struct device_node *root __free(device_node) = of_find_node_by_path("/");
> > > + if (!root)
> > > + return -ENOENT;
> > > +
> > > + match = of_match_node(renesas_socs, root);
> >
> > Doesn't of_machine_device_match() work here?
> >
>
> No, because we're using the returned address of the matching struct
> of_device_id later in the function. If you think it's a better idea to
> introduce of_machine_match_node(), let me know but I think that should
> be done separately.
No, it's fine.
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 8/9] soc: renesas: don't access of_root directly
2026-02-23 13:37 ` [PATCH v2 8/9] soc: renesas: " Bartosz Golaszewski
2026-02-24 18:32 ` Rob Herring
@ 2026-03-02 16:32 ` Geert Uytterhoeven
2026-03-02 17:18 ` Bartosz Golaszewski
1 sibling, 1 reply; 22+ messages in thread
From: Geert Uytterhoeven @ 2026-03-02 16:32 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Rob Herring, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li, devicetree, linux-kernel, linuxppc-dev,
linux-arm-kernel, imx, linux-renesas-soc, linux-sunxi,
driver-core
Hi Bartosz,
On Mon, 23 Feb 2026 at 14:38, Bartosz Golaszewski
<bartosz.golaszewski@oss.qualcomm.com> wrote:
> 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>
> --- a/drivers/soc/renesas/renesas-soc.c
> +++ b/drivers/soc/renesas/renesas-soc.c
> @@ -468,7 +469,11 @@ static int __init renesas_soc_init(void)
> const char *soc_id;
> int ret;
>
> - match = of_match_node(renesas_socs, of_root);
> + struct device_node *root __free(device_node) = of_find_node_by_path("/");
> + if (!root)
> + return -ENOENT;
> +
> + match = of_match_node(renesas_socs, root);
> if (!match)
> return -ENODEV;
>
I still find it silly to add a call to of_find_node_by_path().
In your reply to my comment on v1, you said you don't want to add
another helper.
Currently we have two helpers in this area:
1. of_machine_device_match(), which returns bool, and tells if a
match is available,
2. of_machine_get_match_data(), which returns the match data, if a
match is available.
But there is no helper to return the actual match?
of_machine_device_match() would be fine, if it wouldn't cast the result
to bool...
As there is no cost (binary size-wise) in having the helper that returns
the match, too, I have sent a series[1] to do that. The last patch[2]
is an alternative to this patch, avoiding the need to add a call to
of_find_node_by_path().
[1] "[PATCH 0/7] of: Add and use of_machine_get_match() helper"
https://lore.kernel.org/cover.1772468323.git.geert+renesas@glider.be
[2] "[PATCH 7/7] soc: renesas: Convert to of_machine_get_match()"
https://lore.kernel.org/10876b30a8bdb7d1cfcc2f23fb859f2ffea335fe.1772468323.git.geert+renesas@glider.be
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH v2 8/9] soc: renesas: don't access of_root directly
2026-03-02 16:32 ` Geert Uytterhoeven
@ 2026-03-02 17:18 ` Bartosz Golaszewski
0 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2026-03-02 17:18 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Bartosz Golaszewski, Rob Herring, Saravana Kannan,
Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Christophe Leroy (CS GROUP), Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Geert Uytterhoeven,
Magnus Damm, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Frank Li, devicetree, linux-kernel, linuxppc-dev,
linux-arm-kernel, imx, linux-renesas-soc, linux-sunxi,
driver-core
On Mon, Mar 2, 2026 at 5:47 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Bartosz,
>
> On Mon, 23 Feb 2026 at 14:38, Bartosz Golaszewski
> <bartosz.golaszewski@oss.qualcomm.com> wrote:
> > 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>
>
> > --- a/drivers/soc/renesas/renesas-soc.c
> > +++ b/drivers/soc/renesas/renesas-soc.c
>
> > @@ -468,7 +469,11 @@ static int __init renesas_soc_init(void)
> > const char *soc_id;
> > int ret;
> >
> > - match = of_match_node(renesas_socs, of_root);
> > + struct device_node *root __free(device_node) = of_find_node_by_path("/");
> > + if (!root)
> > + return -ENOENT;
> > +
> > + match = of_match_node(renesas_socs, root);
> > if (!match)
> > return -ENODEV;
> >
>
> I still find it silly to add a call to of_find_node_by_path().
> In your reply to my comment on v1, you said you don't want to add
> another helper.
>
> Currently we have two helpers in this area:
> 1. of_machine_device_match(), which returns bool, and tells if a
> match is available,
> 2. of_machine_get_match_data(), which returns the match data, if a
> match is available.
> But there is no helper to return the actual match?
> of_machine_device_match() would be fine, if it wouldn't cast the result
> to bool...
>
> As there is no cost (binary size-wise) in having the helper that returns
> the match, too, I have sent a series[1] to do that. The last patch[2]
> is an alternative to this patch, avoiding the need to add a call to
> of_find_node_by_path().
>
> [1] "[PATCH 0/7] of: Add and use of_machine_get_match() helper"
> https://lore.kernel.org/cover.1772468323.git.geert+renesas@glider.be
> [2] "[PATCH 7/7] soc: renesas: Convert to of_machine_get_match()"
> https://lore.kernel.org/10876b30a8bdb7d1cfcc2f23fb859f2ffea335fe.1772468323.git.geert+renesas@glider.be
>
Sure, I'm fine with this patch being dropped and your series queued instead.
Bart
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 9/9] soc: sunxi: mbus: don't access of_root directly
2026-02-23 13:37 [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/ Bartosz Golaszewski
` (7 preceding siblings ...)
2026-02-23 13:37 ` [PATCH v2 8/9] soc: renesas: " Bartosz Golaszewski
@ 2026-02-23 13:37 ` Bartosz Golaszewski
2026-02-24 18:38 ` [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/ Rob Herring
9 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 13:37 UTC (permalink / raw)
To: Rob Herring, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li
Cc: devicetree, linux-kernel, linuxppc-dev, linux-arm-kernel, imx,
linux-renesas-soc, linux-sunxi, driver-core, Bartosz Golaszewski
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>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/soc/sunxi/sunxi_mbus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/sunxi/sunxi_mbus.c b/drivers/soc/sunxi/sunxi_mbus.c
index 1734da357ca21b249740e089698275507ea98a8a..8bc5f62ff258837d3f3b30cb84b60d1872b31c27 100644
--- a/drivers/soc/sunxi/sunxi_mbus.c
+++ b/drivers/soc/sunxi/sunxi_mbus.c
@@ -118,7 +118,7 @@ static const char * const sunxi_mbus_platforms[] __initconst = {
static int __init sunxi_mbus_init(void)
{
- if (!of_device_compatible_match(of_root, sunxi_mbus_platforms))
+ if (!of_machine_compatible_match(sunxi_mbus_platforms))
return 0;
bus_register_notifier(&platform_bus_type, &sunxi_mbus_nb);
--
2.47.3
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/
2026-02-23 13:37 [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/ Bartosz Golaszewski
` (8 preceding siblings ...)
2026-02-23 13:37 ` [PATCH v2 9/9] soc: sunxi: mbus: " Bartosz Golaszewski
@ 2026-02-24 18:38 ` Rob Herring
2026-02-26 9:28 ` Bartosz Golaszewski
9 siblings, 1 reply; 22+ messages in thread
From: Rob Herring @ 2026-02-24 18:38 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Saravana Kannan, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich, Christophe Leroy (CS GROUP), Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li, devicetree, linux-kernel, linuxppc-dev,
linux-arm-kernel, imx, linux-renesas-soc, linux-sunxi,
driver-core, Peng Fan
On Mon, Feb 23, 2026 at 02:37:15PM +0100, Bartosz Golaszewski wrote:
> linux/of.h declares a set of variables providing addresses of certain
> key OF nodes. The pointers being variables can't profit from stubs
> provided for when CONFIG_OF is disabled which means that drivers
> accessing these variables can't profit from CONFIG_COMPILE_TEST=y
> coverage.
>
> There are drivers under drivers/soc/ that access the of_root node. This
> series introduces new OF helpers for reading the machine compatible and
> model strings, exports an existing SoC helper that reads the machine
> string from the root node and finally replaces all direct accesses to
> of_root with new or already existing helper functions.
>
> Merging strategy: first two patches should be either acked by Rob or
> picked up into an immutable branch based on v7.0-rc1, the rest can go
> through the SoC tree.
SoC tree is good.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
> Changes in v2:
> - rename of_machine_get_compatible() to of_machine_read_compatible() and
> add the index argument
> - add a stub for of_machine_read_compatible() for !CONFIG_OF
> - provide of_machine_read_model() to avoid having to look-up the root
> node via of_find_node_by_path("/")
> - rename soc_device_get_machine() to soc_attr_read_machine() before
> making it an exported symbol
> - Link to v1: https://lore.kernel.org/r/20260119-soc-of-root-v1-0-32a0fa9a78b4@oss.qualcomm.com
>
> ---
> Bartosz Golaszewski (9):
> of: provide of_machine_read_compatible()
> of: provide of_machine_read_model()
> base: soc: order includes alphabetically
> base: soc: rename and export soc_device_get_machine()
> soc: fsl: guts: don't access of_root directly
> soc: imx8m: don't access of_root directly
> soc: imx9: don't access of_root directly
> soc: renesas: don't access of_root directly
> soc: sunxi: mbus: don't access of_root directly
For all but patch 8,
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/
2026-02-24 18:38 ` [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/ Rob Herring
@ 2026-02-26 9:28 ` Bartosz Golaszewski
2026-03-12 15:18 ` Greg Kroah-Hartman
0 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2026-02-26 9:28 UTC (permalink / raw)
To: Rob Herring
Cc: Bartosz Golaszewski, Saravana Kannan, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li, devicetree, linux-kernel, linuxppc-dev,
linux-arm-kernel, imx, linux-renesas-soc, linux-sunxi,
driver-core, Peng Fan
On Tue, Feb 24, 2026 at 7:38 PM Rob Herring <robh@kernel.org> wrote:
>
> On Mon, Feb 23, 2026 at 02:37:15PM +0100, Bartosz Golaszewski wrote:
> > linux/of.h declares a set of variables providing addresses of certain
> > key OF nodes. The pointers being variables can't profit from stubs
> > provided for when CONFIG_OF is disabled which means that drivers
> > accessing these variables can't profit from CONFIG_COMPILE_TEST=y
> > coverage.
> >
> > There are drivers under drivers/soc/ that access the of_root node. This
> > series introduces new OF helpers for reading the machine compatible and
> > model strings, exports an existing SoC helper that reads the machine
> > string from the root node and finally replaces all direct accesses to
> > of_root with new or already existing helper functions.
> >
> > Merging strategy: first two patches should be either acked by Rob or
> > picked up into an immutable branch based on v7.0-rc1, the rest can go
> > through the SoC tree.
>
> SoC tree is good.
>
> For all but patch 8,
>
> Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
>
FYI Rob also reviewed patch 8 now. Who would pick the patches up? Greg
KH? There does not seem to be a centralized SoC maintainer in
MAINTAINERS?
Bart
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/
2026-02-26 9:28 ` Bartosz Golaszewski
@ 2026-03-12 15:18 ` Greg Kroah-Hartman
2026-03-13 8:36 ` Bartosz Golaszewski
0 siblings, 1 reply; 22+ messages in thread
From: Greg Kroah-Hartman @ 2026-03-12 15:18 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Rob Herring, Bartosz Golaszewski, Saravana Kannan,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li, devicetree, linux-kernel, linuxppc-dev,
linux-arm-kernel, imx, linux-renesas-soc, linux-sunxi,
driver-core, Peng Fan
On Thu, Feb 26, 2026 at 10:28:26AM +0100, Bartosz Golaszewski wrote:
> On Tue, Feb 24, 2026 at 7:38 PM Rob Herring <robh@kernel.org> wrote:
> >
> > On Mon, Feb 23, 2026 at 02:37:15PM +0100, Bartosz Golaszewski wrote:
> > > linux/of.h declares a set of variables providing addresses of certain
> > > key OF nodes. The pointers being variables can't profit from stubs
> > > provided for when CONFIG_OF is disabled which means that drivers
> > > accessing these variables can't profit from CONFIG_COMPILE_TEST=y
> > > coverage.
> > >
> > > There are drivers under drivers/soc/ that access the of_root node. This
> > > series introduces new OF helpers for reading the machine compatible and
> > > model strings, exports an existing SoC helper that reads the machine
> > > string from the root node and finally replaces all direct accesses to
> > > of_root with new or already existing helper functions.
> > >
> > > Merging strategy: first two patches should be either acked by Rob or
> > > picked up into an immutable branch based on v7.0-rc1, the rest can go
> > > through the SoC tree.
> >
> > SoC tree is good.
> >
> > For all but patch 8,
> >
> > Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
> >
>
> FYI Rob also reviewed patch 8 now. Who would pick the patches up? Greg
> KH? There does not seem to be a centralized SoC maintainer in
> MAINTAINERS?
Sure, let me take them now, thanks.
greg k-h
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/
2026-03-12 15:18 ` Greg Kroah-Hartman
@ 2026-03-13 8:36 ` Bartosz Golaszewski
2026-03-13 9:22 ` Greg Kroah-Hartman
0 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2026-03-13 8:36 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Rob Herring, Bartosz Golaszewski, Saravana Kannan,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li, devicetree, linux-kernel, linuxppc-dev,
linux-arm-kernel, imx, linux-renesas-soc, linux-sunxi,
driver-core, Peng Fan, Bartosz Golaszewski
On Thu, 12 Mar 2026 16:18:38 +0100, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> said:
> On Thu, Feb 26, 2026 at 10:28:26AM +0100, Bartosz Golaszewski wrote:
>> On Tue, Feb 24, 2026 at 7:38 PM Rob Herring <robh@kernel.org> wrote:
>> >
>> > On Mon, Feb 23, 2026 at 02:37:15PM +0100, Bartosz Golaszewski wrote:
>> > > linux/of.h declares a set of variables providing addresses of certain
>> > > key OF nodes. The pointers being variables can't profit from stubs
>> > > provided for when CONFIG_OF is disabled which means that drivers
>> > > accessing these variables can't profit from CONFIG_COMPILE_TEST=y
>> > > coverage.
>> > >
>> > > There are drivers under drivers/soc/ that access the of_root node. This
>> > > series introduces new OF helpers for reading the machine compatible and
>> > > model strings, exports an existing SoC helper that reads the machine
>> > > string from the root node and finally replaces all direct accesses to
>> > > of_root with new or already existing helper functions.
>> > >
>> > > Merging strategy: first two patches should be either acked by Rob or
>> > > picked up into an immutable branch based on v7.0-rc1, the rest can go
>> > > through the SoC tree.
>> >
>> > SoC tree is good.
>> >
>> > For all but patch 8,
>> >
>> > Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
>> >
>>
>> FYI Rob also reviewed patch 8 now. Who would pick the patches up? Greg
>> KH? There does not seem to be a centralized SoC maintainer in
>> MAINTAINERS?
>
> Sure, let me take them now, thanks.
>
> greg k-h
>
In the meantime Geert sent an alternative to patch 8/9 so this single one can
be dropped from the series.
Thanks,
Bartosz
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 0/9] soc: remove direct accesses to of_root from drivers/soc/
2026-03-13 8:36 ` Bartosz Golaszewski
@ 2026-03-13 9:22 ` Greg Kroah-Hartman
0 siblings, 0 replies; 22+ messages in thread
From: Greg Kroah-Hartman @ 2026-03-13 9:22 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Rob Herring, Bartosz Golaszewski, Saravana Kannan,
Rafael J. Wysocki, Danilo Krummrich, Christophe Leroy (CS GROUP),
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Geert Uytterhoeven, Magnus Damm, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, Frank Li, devicetree, linux-kernel, linuxppc-dev,
linux-arm-kernel, imx, linux-renesas-soc, linux-sunxi,
driver-core, Peng Fan
On Fri, Mar 13, 2026 at 01:36:49AM -0700, Bartosz Golaszewski wrote:
> On Thu, 12 Mar 2026 16:18:38 +0100, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> said:
> > On Thu, Feb 26, 2026 at 10:28:26AM +0100, Bartosz Golaszewski wrote:
> >> On Tue, Feb 24, 2026 at 7:38 PM Rob Herring <robh@kernel.org> wrote:
> >> >
> >> > On Mon, Feb 23, 2026 at 02:37:15PM +0100, Bartosz Golaszewski wrote:
> >> > > linux/of.h declares a set of variables providing addresses of certain
> >> > > key OF nodes. The pointers being variables can't profit from stubs
> >> > > provided for when CONFIG_OF is disabled which means that drivers
> >> > > accessing these variables can't profit from CONFIG_COMPILE_TEST=y
> >> > > coverage.
> >> > >
> >> > > There are drivers under drivers/soc/ that access the of_root node. This
> >> > > series introduces new OF helpers for reading the machine compatible and
> >> > > model strings, exports an existing SoC helper that reads the machine
> >> > > string from the root node and finally replaces all direct accesses to
> >> > > of_root with new or already existing helper functions.
> >> > >
> >> > > Merging strategy: first two patches should be either acked by Rob or
> >> > > picked up into an immutable branch based on v7.0-rc1, the rest can go
> >> > > through the SoC tree.
> >> >
> >> > SoC tree is good.
> >> >
> >> > For all but patch 8,
> >> >
> >> > Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
> >> >
> >>
> >> FYI Rob also reviewed patch 8 now. Who would pick the patches up? Greg
> >> KH? There does not seem to be a centralized SoC maintainer in
> >> MAINTAINERS?
> >
> > Sure, let me take them now, thanks.
> >
> > greg k-h
> >
>
> In the meantime Geert sent an alternative to patch 8/9 so this single one can
> be dropped from the series.
Ick, ok, I've now dropped that one commit from the tree.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 22+ messages in thread