lkml.org 
[lkml]   [2013]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [RFC 4/9] of/irq: Refactor interrupt-map parsing
Date
On Fri, 01 Nov 2013 10:53:17 -0700, Grant Likely <grant.likely@linaro.org> wrote:
> On Thu, 31 Oct 2013 11:57:14 -0700, Olof Johansson <olof@lixom.net> wrote:
> > On Wed, Oct 30, 2013 at 02:25:21PM -0700, Grant Likely wrote:
> > > (Sorry for HTML mail)
> > >
> > > Can you put #define DEBUG at the top of drivers/of/irq.c and send me the
> > > log output from before and after the commit?
> >
> > Here you go, quite verbose log below.
> >
> > Looks like we're tripping the "no reg passed in" checks, not sure if related.
>
> I think I've found the bug. See if this helps...

That one was broken. Try this instead.

From bcbffc3d16f49451ef505dc021480aa061465a15 Mon Sep 17 00:00:00 2001
From: Grant Likely <grant.likely@linaro.org>
Date: Fri, 1 Nov 2013 10:50:50 -0700
Subject: [PATCH] of: Fixup interrupt parsing failure.

Signed-off-by: Grant Likely <grant.likely@linaro.org>
---
drivers/of/irq.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 8cc62b4a7988..422f253b61c1 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -97,7 +97,7 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
__be32 initial_match_array[8];
const __be32 *match_array = initial_match_array;
- const __be32 *tmp, *imap, *imask, dummy_imask[] = { ~0, ~0, ~0, ~0, ~0 };
+ const __be32 *tmp, *imap, *imask, dummy_imask[] = { ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0 };
u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
int imaplen, match, i;

@@ -147,18 +147,9 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)

pr_debug(" -> addrsize=%d\n", addrsize);

- /* If we were passed no "reg" property and we attempt to parse
- * an interrupt-map, then #address-cells must be 0.
- * Fail if it's not.
- */
- if (addr == NULL && addrsize != 0) {
- pr_debug(" -> no reg passed in when needed !\n");
- return -EINVAL;
- }
-
- /* Precalculate the match array - this simplifies match loop */
+ /* Precalculate the initial match array to simplify match loop */
for (i = 0; i < addrsize; i++)
- initial_match_array[i] = addr[i];
+ initial_match_array[i] = addr ? addr[i] : 0;
for (i = 0; i < intsize; i++)
initial_match_array[addrsize + i] = cpu_to_be32(out_irq->args[i]);

@@ -174,6 +165,15 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
return 0;
}

+ /* If we were passed no "reg" property and we attempt to parse
+ * an interrupt-map, then #address-cells must be 0.
+ * Fail if it's not.
+ */
+ if (addrsize && !addr) {
+ pr_debug(" -> no reg passed in when needed !\n");
+ return -EINVAL;
+ }
+
/* Now look for an interrupt-map */
imap = of_get_property(ipar, "interrupt-map", &imaplen);
/* No interrupt map, check for an interrupt parent */
--
1.8.1.2


\
 
 \ /
  Last update: 2013-11-01 20:21    [W:0.100 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site