aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2010-07-23 18:56:19 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-07-24 18:51:52 -0400
commitd2f718398a21cdb925f12c2b332d206eacd967a6 (patch)
tree9786559e08c8539945dcf98d8d95404b9e2c9bcb /drivers/of
parent9a6b2e588c7809e86161236da3d29581bf5f8402 (diff)
of/irq: Fix endian issues in parsing interrupt specifiers
This patch fixes some instances where interrupt specifiers are dereferenced directly instead of doing a be32_to_cpu() conversion first. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/irq.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 65cfae1bd670..6e595e5a3977 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -91,8 +91,8 @@ static struct device_node *of_irq_find_parent(struct device_node *child)
91 * properties, for example when resolving PCI interrupts when no device 91 * properties, for example when resolving PCI interrupts when no device
92 * node exist for the parent. 92 * node exist for the parent.
93 */ 93 */
94int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, 94int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
95 const u32 *addr, struct of_irq *out_irq) 95 u32 ointsize, const __be32 *addr, struct of_irq *out_irq)
96{ 96{
97 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; 97 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
98 const __be32 *tmp, *imap, *imask; 98 const __be32 *tmp, *imap, *imask;
@@ -100,7 +100,8 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
100 int imaplen, match, i; 100 int imaplen, match, i;
101 101
102 pr_debug("of_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n", 102 pr_debug("of_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n",
103 parent->full_name, intspec[0], intspec[1], ointsize); 103 parent->full_name, be32_to_cpup(intspec),
104 be32_to_cpup(intspec + 1), ointsize);
104 105
105 ipar = of_node_get(parent); 106 ipar = of_node_get(parent);
106 107
@@ -278,7 +279,7 @@ EXPORT_SYMBOL_GPL(of_irq_map_raw);
278int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq) 279int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq)
279{ 280{
280 struct device_node *p; 281 struct device_node *p;
281 const u32 *intspec, *tmp, *addr; 282 const __be32 *intspec, *tmp, *addr;
282 u32 intsize, intlen; 283 u32 intsize, intlen;
283 int res = -EINVAL; 284 int res = -EINVAL;
284 285
@@ -292,9 +293,9 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq
292 intspec = of_get_property(device, "interrupts", &intlen); 293 intspec = of_get_property(device, "interrupts", &intlen);
293 if (intspec == NULL) 294 if (intspec == NULL)
294 return -EINVAL; 295 return -EINVAL;
295 intlen /= sizeof(u32); 296 intlen /= sizeof(*intspec);
296 297
297 pr_debug(" intspec=%d intlen=%d\n", *intspec, intlen); 298 pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen);
298 299
299 /* Get the reg property (if any) */ 300 /* Get the reg property (if any) */
300 addr = of_get_property(device, "reg", NULL); 301 addr = of_get_property(device, "reg", NULL);