From: Michael Ellerman <mpe@ellerman.id.au>
To: Rob Herring <robh@kernel.org>, John Crispin <john@phrozen.org>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Frank Rowand <frowand.list@gmail.com>
Cc: linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
Frank Rowand <frank.rowand@sony.com>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3] of/fdt: Rework early_init_dt_scan_memory() to call directly
Date: Wed, 15 Dec 2021 21:13:46 +1100 [thread overview]
Message-ID: <871r2emazp.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20211214202652.3894707-1-robh@kernel.org>
Rob Herring <robh@kernel.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.
It needs to match the trailing NULL, so 7 or sizeof("memory") works.
cheers
next prev parent reply other threads:[~2021-12-15 10:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-14 20:26 [PATCH v3] of/fdt: Rework early_init_dt_scan_memory() to call directly Rob Herring
2021-12-15 10:13 ` Michael Ellerman [this message]
2021-12-15 14:16 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871r2emazp.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=benh@kernel.crashing.org \
--cc=devicetree@vger.kernel.org \
--cc=frank.rowand@sony.com \
--cc=frowand.list@gmail.com \
--cc=john@phrozen.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
--cc=robh@kernel.org \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox