Re: [PATCH v2 8/9] soc: renesas: don't access of_root directly
From: Rob Herring
Date: Wed Feb 25 2026 - 16:47:59 EST
On Wed, Feb 25, 2026 at 3:42 AM Bartosz Golaszewski <brgl@xxxxxxxxxx> wrote:
>
> On Tue, Feb 24, 2026 at 7:32 PM Rob Herring <robh@xxxxxxxxxx> 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@xxxxxxxxxx>
> > > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
> > > ---
> > > 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@xxxxxxxxxx>