On Mon, Jan 14, 2008 at 08:37:27PM -0600, Kumar Gala wrote:
> >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?

Because that's what the OF spec says the default is?

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

Grr, I thought I removed the size == 12 check...

> >-            if (prop)
> >-                    immrbase = of_translate_address(soc, prop);
> 
> why not make your code an else case if we don't have reg?

Why?

> 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 :)

It's not pointless, it's just incomplete.

>       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);
>       }

Why go out of our way to fail on a childless soc node?

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

Reply via email to