of: Fix phandle endian issues
[linux-2.6-block.git] / drivers / of / base.c
index e3f7af882e455e47be73f3ccc07499eb94169068..aa805250de765e5e1c9531e0b9cbfbb6143683f2 100644 (file)
@@ -605,14 +605,14 @@ EXPORT_SYMBOL(of_find_node_by_phandle);
 struct device_node *
 of_parse_phandle(struct device_node *np, const char *phandle_name, int index)
 {
-       const phandle *phandle;
+       const __be32 *phandle;
        int size;
 
        phandle = of_get_property(np, phandle_name, &size);
        if ((!phandle) || (size < sizeof(*phandle) * (index + 1)))
                return NULL;
 
-       return of_find_node_by_phandle(phandle[index]);
+       return of_find_node_by_phandle(be32_to_cpup(phandle + index));
 }
 EXPORT_SYMBOL(of_parse_phandle);
 
@@ -668,16 +668,16 @@ int of_parse_phandles_with_args(struct device_node *np, const char *list_name,
 
        while (list < list_end) {
                const __be32 *cells;
-               const phandle *phandle;
+               phandle phandle;
 
-               phandle = list++;
+               phandle = be32_to_cpup(list++);
                args = list;
 
                /* one cell hole in the list = <>; */
-               if (!*phandle)
+               if (!phandle)
                        goto next;
 
-               node = of_find_node_by_phandle(*phandle);
+               node = of_find_node_by_phandle(phandle);
                if (!node) {
                        pr_debug("%s: could not find phandle\n",
                                 np->full_name);