Thread (27 messages) 27 messages, 9 authors, 2026-02-23

Re: [PATCH 7/8] soc: renesas: don't access of_root directly

From: Bartosz Golaszewski <brgl@kernel.org>
Date: 2026-02-23 13:46:12
Also in: imx, linux-arm-kernel, linux-devicetree, linux-renesas-soc, linux-sunxi, lkml

On Mon, Jan 19, 2026 at 8:25 PM Geert Uytterhoeven [off-list ref] wrote:
Hi Bartosz,

On Mon, 19 Jan 2026 at 11:40, Bartosz Golaszewski
[off-list ref] wrote:
quoted
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 <redacted>
Thanks for your patch!
quoted
--- 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);
I am not so fond of these of_find_node_by_path("/") + something replacements.
What about adding an of_match_root() helper?
I removed other instances from this series but not this one. I don't
want to grow this series with even more new helpers. How about
addressing this separately?
However, in the previous patch you used a different strategy:

-       if (!of_match_node(imx8_soc_match, of_root))
+       if (!of_machine_device_match(imx8_soc_match))
Because here, we really need the match structure later into the function.

Bart
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help