diff options
author | Rob Herring <r.herring@freescale.com> | 2010-06-08 09:48:08 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-07-05 18:14:25 -0400 |
commit | a7c194b007ec40a130207e9ace9cecf598fc6ac5 (patch) | |
tree | d5be1544285ab73d202b96ae20545d8d08d9bd1f | |
parent | 7dc2e1134a22dc242175d5321c0c9e97d16eb87b (diff) |
of/irq: little endian fixes
Fix some endian issues in the irq mapping OF code.
Signed-off-by: Rob Herring <r.herring@freescale.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
CC: Michal Simek <monstr@monstr.eu>
CC: Wolfram Sang <w.sang@pengutronix.de>
CC: Stephen Rothwell <sfr@canb.auug.org.au>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | drivers/of/irq.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 598454fbdd1e..623eb661c629 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c | |||
@@ -95,7 +95,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, | |||
95 | const u32 *addr, struct of_irq *out_irq) | 95 | const u32 *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 u32 *tmp, *imap, *imask; | 98 | const __be32 *tmp, *imap, *imask; |
99 | u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; | 99 | u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; |
100 | int imaplen, match, i; | 100 | int imaplen, match, i; |
101 | 101 | ||
@@ -111,7 +111,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, | |||
111 | do { | 111 | do { |
112 | tmp = of_get_property(ipar, "#interrupt-cells", NULL); | 112 | tmp = of_get_property(ipar, "#interrupt-cells", NULL); |
113 | if (tmp != NULL) { | 113 | if (tmp != NULL) { |
114 | intsize = *tmp; | 114 | intsize = be32_to_cpu(*tmp); |
115 | break; | 115 | break; |
116 | } | 116 | } |
117 | tnode = ipar; | 117 | tnode = ipar; |
@@ -140,7 +140,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, | |||
140 | } while (old && tmp == NULL); | 140 | } while (old && tmp == NULL); |
141 | of_node_put(old); | 141 | of_node_put(old); |
142 | old = NULL; | 142 | old = NULL; |
143 | addrsize = (tmp == NULL) ? 2 : *tmp; | 143 | addrsize = (tmp == NULL) ? 2 : be32_to_cpu(*tmp); |
144 | 144 | ||
145 | pr_debug(" -> addrsize=%d\n", addrsize); | 145 | pr_debug(" -> addrsize=%d\n", addrsize); |
146 | 146 | ||
@@ -152,8 +152,9 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, | |||
152 | if (of_get_property(ipar, "interrupt-controller", NULL) != | 152 | if (of_get_property(ipar, "interrupt-controller", NULL) != |
153 | NULL) { | 153 | NULL) { |
154 | pr_debug(" -> got it !\n"); | 154 | pr_debug(" -> got it !\n"); |
155 | memcpy(out_irq->specifier, intspec, | 155 | for (i = 0; i < intsize; i++) |
156 | intsize * sizeof(u32)); | 156 | out_irq->specifier[i] = |
157 | of_read_number(intspec +i, 1); | ||
157 | out_irq->size = intsize; | 158 | out_irq->size = intsize; |
158 | out_irq->controller = ipar; | 159 | out_irq->controller = ipar; |
159 | of_node_put(old); | 160 | of_node_put(old); |
@@ -223,9 +224,9 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, | |||
223 | pr_debug(" -> parent lacks #interrupt-cells!\n"); | 224 | pr_debug(" -> parent lacks #interrupt-cells!\n"); |
224 | goto fail; | 225 | goto fail; |
225 | } | 226 | } |
226 | newintsize = *tmp; | 227 | newintsize = be32_to_cpu(*tmp); |
227 | tmp = of_get_property(newpar, "#address-cells", NULL); | 228 | tmp = of_get_property(newpar, "#address-cells", NULL); |
228 | newaddrsize = (tmp == NULL) ? 0 : *tmp; | 229 | newaddrsize = (tmp == NULL) ? 0 : be32_to_cpu(*tmp); |
229 | 230 | ||
230 | pr_debug(" -> newintsize=%d, newaddrsize=%d\n", | 231 | pr_debug(" -> newintsize=%d, newaddrsize=%d\n", |
231 | newintsize, newaddrsize); | 232 | newintsize, newaddrsize); |
@@ -307,7 +308,7 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq | |||
307 | tmp = of_get_property(p, "#interrupt-cells", NULL); | 308 | tmp = of_get_property(p, "#interrupt-cells", NULL); |
308 | if (tmp == NULL) | 309 | if (tmp == NULL) |
309 | goto out; | 310 | goto out; |
310 | intsize = *tmp; | 311 | intsize = be32_to_cpu(*tmp); |
311 | 312 | ||
312 | pr_debug(" intsize=%d intlen=%d\n", intsize, intlen); | 313 | pr_debug(" intsize=%d intlen=%d\n", intsize, intlen); |
313 | 314 | ||