[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAL_Jsq+gFrL1EjjTEYAtk=XHXPBWn070n7CjycULx2tG987oGw@mail.gmail.com>
Date: Wed, 15 Dec 2021 08:16:28 -0600
From: Rob Herring <robh@...nel.org>
To: Michael Ellerman <mpe@...erman.id.au>
Cc: John Crispin <john@...ozen.org>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Frank Rowand <frowand.list@...il.com>,
"open list:MIPS" <linux-mips@...r.kernel.org>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
Frank Rowand <frank.rowand@...y.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
devicetree@...r.kernel.org
Subject: Re: [PATCH v3] of/fdt: Rework early_init_dt_scan_memory() to call directly
On Wed, Dec 15, 2021 at 4:13 AM Michael Ellerman <mpe@...erman.id.au> wrote:
>
> Rob Herring <robh@...nel.org> writes:
> > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> > index 5e216555fe4f..97d7607625ec 100644
> > --- a/drivers/of/fdt.c
> > +++ b/drivers/of/fdt.c
> > @@ -1078,49 +1078,50 @@ u64 __init dt_mem_next_cell(int s, const __be32 **cellp)
> > /*
> > * early_init_dt_scan_memory - Look for and parse memory nodes
> > */
> > -int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
> > - int depth, void *data)
> > +int __init early_init_dt_scan_memory(void)
> > {
> > - const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> > - const __be32 *reg, *endp;
> > - int l;
> > - bool hotpluggable;
> > -
> > - /* We are scanning "memory" nodes only */
> > - if (type == NULL || strcmp(type, "memory") != 0)
> > - return 0;
> > + int node;
> > + const void *fdt = initial_boot_params;
> >
> > - reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
> > - if (reg == NULL)
> > - reg = of_get_flat_dt_prop(node, "reg", &l);
> > - if (reg == NULL)
> > - return 0;
> > + for (node = fdt_node_offset_by_prop_value(fdt, -1, "device_type", "memory", 6);
> > + node != -FDT_ERR_NOTFOUND;
> > + node = fdt_node_offset_by_prop_value(fdt, node, "device_type", "memory", 6)) {
>
> The 6 there doesn't work on my machines.
Crap! I meant to keep the original version and just fix the return.
>
> It needs to match the trailing NULL, so 7 or sizeof("memory") works.
That's what I get for trying to look thru libfdt to see what it wants.
Seems to be strlen() on property names and strlen()+1 on values.
Rob
Powered by blists - more mailing lists