On Jan 14, 2008, at 10:29 AM, Scott Wood wrote:

> The reg property in fsl soc nodes should be removed.
>
> Signed-off-by: Scott Wood <[EMAIL PROTECTED]>
> ---
> arch/powerpc/sysdev/fsl_soc.c |   14 +++++++++++---
> 1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/ 
> fsl_soc.c
> index 3ace747..7502e03 100644
> --- a/arch/powerpc/sysdev/fsl_soc.c
> +++ b/arch/powerpc/sysdev/fsl_soc.c
> @@ -54,10 +54,18 @@ phys_addr_t get_immrbase(void)
>       soc = of_find_node_by_type(NULL, "soc");
>       if (soc) {
>               int size;
> -             const void *prop = of_get_property(soc, "reg", &size);
> +             u32 naddr;
> +             const u32 *prop = of_get_property(soc, "#address-cells", &size);
> +
> +             if (prop && size == 4)
> +                     naddr = *prop;
> +             else
> +                     naddr = 2;

Why default to two?

>
> +
> +             prop = of_get_property(soc, "ranges", &size);
> +             if (prop && size == 12)
> +                     immrbase = of_translate_address(soc, prop + naddr);
>
> -             if (prop)
> -                     immrbase = of_translate_address(soc, prop);

why not make your code an else case if we don't have reg?

>
>               of_node_put(soc);
>       }

or something like, than we don't have to worry about adjust anything,  
and if you don't have any children its kinda a pointless device tree :)

        if (soc) {
                struct device_node *child = of_get_next_child(soc, NULL);
                if (child) {
                        const void *prop = of_get_property(soc, "ranges", NULL);
                        if (prop)
                                immrbase = of_translate_address(child, prop);
                        of_node_put(child);
                }
                of_node_put(soc);
        }

- k
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to