mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank Rowand <frowand.list@gmail.com>
To: Rob Herring <robh@kernel.org>, devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] of/fdt: avoid re-parsing '#{address,size}-cells' in of_fdt_limit_memory
Date: Tue, 4 Sep 2018 18:54:22 -0700	[thread overview]
Message-ID: <8b866d4d-1362-311d-5a6e-3e414d8f90ab@gmail.com> (raw)
In-Reply-To: <20180830190523.31474-3-robh@kernel.org>

On 08/30/18 12:05, Rob Herring wrote:
> Now that we initialize dt_root_addr_cells and dt_root_size_cells earlier,
> use them and simplify of_fdt_limit_memory.
> 
> Cc: Frank Rowand <frowand.list@gmail.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/of/fdt.c | 23 +----------------------
>  1 file changed, 1 insertion(+), 22 deletions(-)
> 
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 49abe18f1bde..fef4b2c8a171 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c

As kbuild test robot noted, of_fdt_limit_memory() will access
__initdata dt_root_addr_cells and __initdata dt_root_size_cells.
A possible (untested) fix would be:

- void of_fdt_limit_memory(int limit)
- {

+ void __init of_fdt_limit_memory(int limit)
+ {


> @@ -44,28 +44,7 @@ void of_fdt_limit_memory(int limit)
>  	int memory;
>  	int len;
>  	const void *val;
> -	int nr_address_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT;
> -	int nr_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT;
> -	const __be32 *addr_prop;
> -	const __be32 *size_prop;
> -	int root_offset;
> -	int cell_size;
> -
> -	root_offset = fdt_path_offset(initial_boot_params, "/");
> -	if (root_offset < 0)
> -		return;
> -
> -	addr_prop = fdt_getprop(initial_boot_params, root_offset,
> -				"#address-cells", NULL);
> -	if (addr_prop)
> -		nr_address_cells = fdt32_to_cpu(*addr_prop);
> -
> -	size_prop = fdt_getprop(initial_boot_params, root_offset,
> -				"#size-cells", NULL);
> -	if (size_prop)
> -		nr_size_cells = fdt32_to_cpu(*size_prop);
> -
> -	cell_size = sizeof(uint32_t)*(nr_address_cells + nr_size_cells);
> +	int cell_size = sizeof(uint32_t)*(dt_root_addr_cells + dt_root_size_cells);
>  
>  	memory = fdt_path_offset(initial_boot_params, "/memory");
>  	if (memory > 0) {
> 


  parent reply	other threads:[~2018-09-05  1:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-30 19:05 [PATCH 0/3] of: root #{size,address}-cells clean-ups Rob Herring
2018-08-30 19:05 ` [PATCH 1/3] of/fdt: Scan the root node properties earlier Rob Herring
2018-09-05  1:49   ` Frank Rowand
2018-09-05 11:51     ` Rob Herring
2018-09-05 18:18       ` Frank Rowand
2018-09-05 20:06         ` Rob Herring
2018-09-05 21:10           ` Frank Rowand
2018-09-05 21:31             ` Rob Herring
2018-09-06 21:03               ` Frank Rowand
2018-08-30 19:05 ` [PATCH 2/3] of/fdt: avoid re-parsing '#{address,size}-cells' in of_fdt_limit_memory Rob Herring
2018-09-01  2:41   ` kbuild test robot
2018-09-05  1:54   ` Frank Rowand [this message]
2018-08-30 19:05 ` [PATCH 3/3] of: make default address and size cells sizes private Rob Herring
2018-09-05  1:55   ` Frank Rowand
2018-09-05  4:37     ` Mark Cave-Ayland
2018-09-05 12:12       ` Rob Herring
2018-09-05 16:01         ` Mark Cave-Ayland
2018-09-05  1:56 ` [PATCH 0/3] of: root #{size,address}-cells clean-ups Frank Rowand

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=8b866d4d-1362-311d-5a6e-3e414d8f90ab@gmail.com \
    --to=frowand.list@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    /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

Powered by JetHome