aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/base.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-07-23 01:48:25 -0600
committerGrant Likely <grant.likely@secretlab.ca>2010-07-24 16:51:52 -0600
commit9a6b2e588c7809e86161236da3d29581bf5f8402 (patch)
tree0aebb8e868615a2354042a376405cd73d80ef19e /drivers/of/base.c
parent883c2cfc8bcc0fd00c5d9f596fb8870f481b5bda (diff)
downloadkernel_samsung_smdk4412-9a6b2e588c7809e86161236da3d29581bf5f8402.zip
kernel_samsung_smdk4412-9a6b2e588c7809e86161236da3d29581bf5f8402.tar.gz
kernel_samsung_smdk4412-9a6b2e588c7809e86161236da3d29581bf5f8402.tar.bz2
of: Fix phandle endian issues
The flat tree code wasn't fixing the endianness on phandle values when unflattening the tree, and the code in drivers/of wasn't always doing a be32_to_cpu before trying to dereference the phandle values. This patch fixes them. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r--drivers/of/base.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index e3f7af8..aa80525 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -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);