diff mbox

dt: add of_alias_scan and of_alias_get_id

Message ID 20110815063643.GI7244@S2100-06.ap.freescale.net
State New
Headers show

Commit Message

Shawn Guo Aug. 15, 2011, 6:36 a.m. UTC
On Sun, Aug 14, 2011 at 11:05:29PM -0700, David Miller wrote:
> From: Shawn Guo <shawn.guo@freescale.com>
> Date: Mon, 15 Aug 2011 14:07:09 +0800
> 
> > Can you please help me a little bit more with the "other places"?
> 
> arch/sparc/kernel/prom*.c
> 
How about the following changes?  I do not even have a compiler to do
build test for sparc.  Is it possible for me to get one from somewhere?

---8<-----

Comments

David Miller Aug. 15, 2011, 6:35 a.m. UTC | #1
From: Shawn Guo <shawn.guo@freescale.com>
Date: Mon, 15 Aug 2011 14:36:44 +0800

> @@ -245,4 +245,11 @@ void __init of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops)
>         nextp = &allnodes->allnext;
>         allnodes->child = of_pdt_build_tree(allnodes,
>                         of_pdt_prom_ops->getchild(allnodes->phandle), &nextp);
> +
> +       /* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */
> +       of_chosen = of_find_node_by_path("/chosen");
> +       if (of_chosen == NULL)
> +               of_chosen = of_find_node_by_path("/chosen@0");
> +       of_aliases = of_find_node_by_path("/aliases");
> +       of_alias_scan(dt_alloc);
>  }

There is no dt_alloc variable visible in this function.

I didn't need to use a compiler to find this problem, and neither
do you.
Shawn Guo Aug. 15, 2011, 6:45 a.m. UTC | #2
On Mon, Aug 15, 2011 at 02:36:44PM +0800, Shawn Guo wrote:
> On Sun, Aug 14, 2011 at 11:05:29PM -0700, David Miller wrote:
> > From: Shawn Guo <shawn.guo@freescale.com>
> > Date: Mon, 15 Aug 2011 14:07:09 +0800
> > 
> > > Can you please help me a little bit more with the "other places"?
> > 
> > arch/sparc/kernel/prom*.c
> > 
> How about the following changes?  I do not even have a compiler to do
> build test for sparc.  Is it possible for me to get one from somewhere?
> 
> ---8<-----
> diff --git a/drivers/of/pdt.c b/drivers/of/pdt.c
> index 4d87b5d..124280a 100644
> --- a/drivers/of/pdt.c
> +++ b/drivers/of/pdt.c
> @@ -245,4 +245,11 @@ void __init of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops)
>         nextp = &allnodes->allnext;
>         allnodes->child = of_pdt_build_tree(allnodes,
>                         of_pdt_prom_ops->getchild(allnodes->phandle), &nextp);
> +
> +       /* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */
> +       of_chosen = of_find_node_by_path("/chosen");
> +       if (of_chosen == NULL)
> +               of_chosen = of_find_node_by_path("/chosen@0");
> +       of_aliases = of_find_node_by_path("/aliases");
> +       of_alias_scan(dt_alloc);

dt_alloc here needs to be some wrapper function of prom_early_alloc().

>  }
Shawn Guo Aug. 15, 2011, 6:47 a.m. UTC | #3
On Sun, Aug 14, 2011 at 11:35:59PM -0700, David Miller wrote:
> From: Shawn Guo <shawn.guo@freescale.com>
> Date: Mon, 15 Aug 2011 14:36:44 +0800
> 
> > @@ -245,4 +245,11 @@ void __init of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops)
> >         nextp = &allnodes->allnext;
> >         allnodes->child = of_pdt_build_tree(allnodes,
> >                         of_pdt_prom_ops->getchild(allnodes->phandle), &nextp);
> > +
> > +       /* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */
> > +       of_chosen = of_find_node_by_path("/chosen");
> > +       if (of_chosen == NULL)
> > +               of_chosen = of_find_node_by_path("/chosen@0");
> > +       of_aliases = of_find_node_by_path("/aliases");
> > +       of_alias_scan(dt_alloc);
> >  }
> 
> There is no dt_alloc variable visible in this function.
> 
> I didn't need to use a compiler to find this problem, and neither
> do you.
> 
I should have found that before sending it even for comment.  Yeah,
you beat me to that!
diff mbox

Patch

diff --git a/drivers/of/pdt.c b/drivers/of/pdt.c
index 4d87b5d..124280a 100644
--- a/drivers/of/pdt.c
+++ b/drivers/of/pdt.c
@@ -245,4 +245,11 @@  void __init of_pdt_build_devicetree(phandle root_node, struct of_pdt_ops *ops)
        nextp = &allnodes->allnext;
        allnodes->child = of_pdt_build_tree(allnodes,
                        of_pdt_prom_ops->getchild(allnodes->phandle), &nextp);
+
+       /* Get pointer to "/chosen" and "/aliasas" nodes for use everywhere */
+       of_chosen = of_find_node_by_path("/chosen");
+       if (of_chosen == NULL)
+               of_chosen = of_find_node_by_path("/chosen@0");
+       of_aliases = of_find_node_by_path("/aliases");
+       of_alias_scan(dt_alloc);
 }