From: Grant Likely <grant.likely@secretlab.ca>
To: devicetree-discuss@lists.ozlabs.org, jeremy.kerr@canonical.com,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/2] of/irq: Fix endian issues in parsing interrupt specifiers
Date: Fri, 23 Jul 2010 17:05:25 -0600 [thread overview]
Message-ID: <20100723230514.28579.65527.stgit@angua> (raw)
In-Reply-To: <20100723230437.28579.19577.stgit@angua>
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>
---
drivers/of/irq.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 65cfae1..2d14eac 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)
* properties, for example when resolving PCI interrupts when no device
* node exist for the parent.
*/
-int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
- const u32 *addr, struct of_irq *out_irq)
+int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
+ u32 ointsize, const __be32 *addr, struct of_irq *out_irq)
{
struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
const __be32 *tmp, *imap, *imask;
@@ -100,7 +100,8 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
int imaplen, match, i;
pr_debug("of_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n",
- parent->full_name, intspec[0], intspec[1], ointsize);
+ parent->full_name, be32_to_cpup(intspec),
+ be32_to_cpu(intspec + 1), ointsize);
ipar = of_node_get(parent);
@@ -278,7 +279,7 @@ EXPORT_SYMBOL_GPL(of_irq_map_raw);
int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq)
{
struct device_node *p;
- const u32 *intspec, *tmp, *addr;
+ const __be32 *intspec, *tmp, *addr;
u32 intsize, intlen;
int res = -EINVAL;
@@ -292,9 +293,9 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq
intspec = of_get_property(device, "interrupts", &intlen);
if (intspec == NULL)
return -EINVAL;
- intlen /= sizeof(u32);
+ intlen /= sizeof(*intspec);
- pr_debug(" intspec=%d intlen=%d\n", *intspec, intlen);
+ pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen);
/* Get the reg property (if any) */
addr = of_get_property(device, "reg", NULL);
prev parent reply other threads:[~2010-07-23 23:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-23 23:05 [PATCH v2 1/2] of: Fix phandle endian issues Grant Likely
2010-07-23 23:05 ` Grant Likely [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100723230514.28579.65527.stgit@angua \
--to=grant.likely@secretlab.ca \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=jeremy.kerr@canonical.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox