diff mbox series

[Xen-devel] xen/arm: bootfdt: Use proper default for #address-cells and #size-cells

Message ID 20171129175732.7256-1-julien.grall@linaro.org
State Accepted
Commit c05aa4afac64ea687c1a2bf9277ba6552809495b
Headers show
Series [Xen-devel] xen/arm: bootfdt: Use proper default for #address-cells and #size-cells | expand

Commit Message

Julien Grall Nov. 29, 2017, 5:57 p.m. UTC
Per the device-tree specific [1], when the property #address-cells
and  #size-cells are not present, the default value should be resp. 1
and 2.

[1] https://www.devicetree.org/downloads/devicetree-specification-v0.1-20160524.pdf

Signed-off-by: Julien Grall <julien.grall@linaro.org>

---

    This was discovered debugging DT generated by GRUB on ACPI-only
    platform. I am not aware of any DT relying on that for now, but it
    would still be nice to be compliant with the spec and avoid
    surprise.
---
 xen/arch/arm/bootfdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stefano Stabellini Nov. 29, 2017, 6:12 p.m. UTC | #1
On Wed, 29 Nov 2017, Julien Grall wrote:
> Per the device-tree specific [1], when the property #address-cells
> and  #size-cells are not present, the default value should be resp. 1
> and 2.
> 
> [1] https://www.devicetree.org/downloads/devicetree-specification-v0.1-20160524.pdf
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> 
>     This was discovered debugging DT generated by GRUB on ACPI-only
>     platform. I am not aware of any DT relying on that for now, but it
>     would still be nice to be compliant with the spec and avoid
>     surprise.
> ---
>  xen/arch/arm/bootfdt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
> index 4a687e725d..8eba42c7b9 100644
> --- a/xen/arch/arm/bootfdt.c
> +++ b/xen/arch/arm/bootfdt.c
> @@ -109,8 +109,8 @@ int __init device_tree_for_each_node(const void *fdt,
>              continue;
>          }
>  
> -        as = depth > 0 ? address_cells[depth-1] : 0;
> -        ss = depth > 0 ? size_cells[depth-1] : 0;
> +        as = depth > 0 ? address_cells[depth-1] : DT_ROOT_NODE_ADDR_CELLS_DEFAULT;
> +        ss = depth > 0 ? size_cells[depth-1] : DT_ROOT_NODE_SIZE_CELLS_DEFAULT;
>  
>          address_cells[depth] = device_tree_get_u32(fdt, node,
>                                                     "#address-cells", as);
> -- 
> 2.11.0
>
Julien Grall Dec. 8, 2017, 3:18 p.m. UTC | #2
Hi,

On 29/11/17 18:12, Stefano Stabellini wrote:
> On Wed, 29 Nov 2017, Julien Grall wrote:
>> Per the device-tree specific [1], when the property #address-cells
>> and  #size-cells are not present, the default value should be resp. 1
>> and 2.
>>
>> [1] https://www.devicetree.org/downloads/devicetree-specification-v0.1-20160524.pdf
>>
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> 
> Acked-by: Stefano Stabellini <sstabellini@kernel.org>

This was acked but not applied to staging. Can you do it please?

Cheers,

> 
> 
>> ---
>>
>>      This was discovered debugging DT generated by GRUB on ACPI-only
>>      platform. I am not aware of any DT relying on that for now, but it
>>      would still be nice to be compliant with the spec and avoid
>>      surprise.
>> ---
>>   xen/arch/arm/bootfdt.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
>> index 4a687e725d..8eba42c7b9 100644
>> --- a/xen/arch/arm/bootfdt.c
>> +++ b/xen/arch/arm/bootfdt.c
>> @@ -109,8 +109,8 @@ int __init device_tree_for_each_node(const void *fdt,
>>               continue;
>>           }
>>   
>> -        as = depth > 0 ? address_cells[depth-1] : 0;
>> -        ss = depth > 0 ? size_cells[depth-1] : 0;
>> +        as = depth > 0 ? address_cells[depth-1] : DT_ROOT_NODE_ADDR_CELLS_DEFAULT;
>> +        ss = depth > 0 ? size_cells[depth-1] : DT_ROOT_NODE_SIZE_CELLS_DEFAULT;
>>   
>>           address_cells[depth] = device_tree_get_u32(fdt, node,
>>                                                      "#address-cells", as);
>> -- 
>> 2.11.0
>>
Stefano Stabellini Dec. 8, 2017, 9:18 p.m. UTC | #3
On Fri, 8 Dec 2017, Julien Grall wrote:
> Hi,
> 
> On 29/11/17 18:12, Stefano Stabellini wrote:
> > On Wed, 29 Nov 2017, Julien Grall wrote:
> > > Per the device-tree specific [1], when the property #address-cells
> > > and  #size-cells are not present, the default value should be resp. 1
> > > and 2.
> > > 
> > > [1]
> > > https://www.devicetree.org/downloads/devicetree-specification-v0.1-20160524.pdf
> > > 
> > > Signed-off-by: Julien Grall <julien.grall@linaro.org>
> > 
> > Acked-by: Stefano Stabellini <sstabellini@kernel.org>
> 
> This was acked but not applied to staging. Can you do it please?

It was in my arm-next branch together with a couple of patches from
Andre. I committed all three to staging.



> 
> > 
> > 
> > > ---
> > > 
> > >      This was discovered debugging DT generated by GRUB on ACPI-only
> > >      platform. I am not aware of any DT relying on that for now, but it
> > >      would still be nice to be compliant with the spec and avoid
> > >      surprise.
> > > ---
> > >   xen/arch/arm/bootfdt.c | 4 ++--
> > >   1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
> > > index 4a687e725d..8eba42c7b9 100644
> > > --- a/xen/arch/arm/bootfdt.c
> > > +++ b/xen/arch/arm/bootfdt.c
> > > @@ -109,8 +109,8 @@ int __init device_tree_for_each_node(const void *fdt,
> > >               continue;
> > >           }
> > >   -        as = depth > 0 ? address_cells[depth-1] : 0;
> > > -        ss = depth > 0 ? size_cells[depth-1] : 0;
> > > +        as = depth > 0 ? address_cells[depth-1] :
> > > DT_ROOT_NODE_ADDR_CELLS_DEFAULT;
> > > +        ss = depth > 0 ? size_cells[depth-1] :
> > > DT_ROOT_NODE_SIZE_CELLS_DEFAULT;
> > >             address_cells[depth] = device_tree_get_u32(fdt, node,
> > >                                                      "#address-cells",
> > > as);
> > > -- 
> > > 2.11.0
> > > 
> 
> -- 
> Julien Grall
>
diff mbox series

Patch

diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index 4a687e725d..8eba42c7b9 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -109,8 +109,8 @@  int __init device_tree_for_each_node(const void *fdt,
             continue;
         }
 
-        as = depth > 0 ? address_cells[depth-1] : 0;
-        ss = depth > 0 ? size_cells[depth-1] : 0;
+        as = depth > 0 ? address_cells[depth-1] : DT_ROOT_NODE_ADDR_CELLS_DEFAULT;
+        ss = depth > 0 ? size_cells[depth-1] : DT_ROOT_NODE_SIZE_CELLS_DEFAULT;
 
         address_cells[depth] = device_tree_get_u32(fdt, node,
                                                    "#address-cells", as);