linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: grant.likely@secretlab.ca (Grant Likely)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 10/20] of/irq: fix interrupt parent lookup procedure
Date: Tue, 15 May 2012 12:41:49 -0600	[thread overview]
Message-ID: <20120515184149.4E6B93E080A@localhost> (raw)
In-Reply-To: <07f801cd3274$cfbe4200$6f3ac600$%kim@samsung.com>

On Tue, 15 May 2012 17:29:14 +0900, Kukjin Kim <kgene.kim@samsung.com> wrote:
> Thomas Abraham wrote:
> > 
> > The interrupt parent lookup fails for a node that is a interrupt-controller
> > but does not have an explict interrupt-parent property and instead inherits
> > this property from the root node.
> > 
> > Consider the nodes listed below.
> > 
> >     / {
> >         interrupt-parent = <&intc_level1>;
> > 
> >         intc_level1: interrupt-controller at xxx {
> >                 interrupt-controller;
> >                 #interrupt-cells = <3>;
> >                 <rest of the properties here>;
> >         };
> > 
> >         intc_level2: interrupt-controller at yyy {
> >                 interrupt-controller;
> >                 #interrupt-cells = <2>;
> >                 <rest of the properties here>;
> >         };
> >     };
> > 
> > The interrupt parent lookup for interrupt-controller at yyy fails. It inherits
> > the interrupt-parent property from the root node and the root node ('/')
> > specifies a 'interrupt-parent' property which represents the default interrupt
> > root controller. But, the property '#interrupt-cells' might not be specified
> > in the root node.
> > 
> > In case a interrupt controller node does not include a 'interrupt-parent'
> > property but inherits that property from the root node, the check for
> > 'interrupt-cells' property in the root node fails. Fix this removing the
> > check for 'interrupt-cells' property.

Hmmm... I dont see the bug...  From your description above, I see the
following sequence.

First iteration:
	child = &ic at yyy;
	cannot find "interrupt-parent" so take 'if' clause
		p = of_get_parent(child);  (root)
	iteration continues because #interrupt-cells not found in 'p'(root)
Second iteration:
	child = root;
	found "interrupt-parent", so take 'else' clause
		p = of_find_node_by_phandle();  (ic at xxx)
	iteration stops because #interrupt-cells is found in 'p'(ic at xxx)

What am I missing in my admittedly short look at the code?

g.

> > 
> > Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
> > ---
> >  drivers/of/irq.c |    4 +++-
> >  1 files changed, 3 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> > index 9cf0060..a520363 100644
> > --- a/drivers/of/irq.c
> > +++ b/drivers/of/irq.c
> > @@ -66,14 +66,16 @@ struct device_node *of_irq_find_parent(struct device_node *child)
> >  		if (parp == NULL)
> >  			p = of_get_parent(child);
> >  		else {
> > +			of_node_put(child);
> >  			if (of_irq_workarounds & OF_IMAP_NO_PHANDLE)
> >  				p = of_node_get(of_irq_dflt_pic);
> >  			else
> >  				p = of_find_node_by_phandle(be32_to_cpup(parp));
> > +			return p;
> >  		}
> >  		of_node_put(child);
> >  		child = p;
> > -	} while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL);
> > +	} while (p);

This does break one use-case.  Sometimes the interrupt-parent is the
same node when an 
> > 
> >  	return p;
> >  }
> > --
> > 1.7.5.4
> 
> Hi Grant and Rob,
> 
> I'm ok on this and this patch and #11 patch in this series are required for patches that add device tree based support for wakeup
> interrupts on EXYNOS5250.
> 
> So could you have a look at this patch and let us know if this is okay or any rework is required.
> 
> Thanks.
> 
> Best regards,
> Kgene.
> --
> Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
> SW Solution Development Team, Samsung Electronics Co., Ltd.
> 

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.

  reply	other threads:[~2012-05-15 18:41 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-30 19:14 [PATCH 00/20] ARM: Samsung: Add support for Exynos5250 Rev1.0 Thomas Abraham
2012-04-30 19:14 ` [PATCH 01/20] ARM: EXYNOS: Add watchdog timer clock instance Thomas Abraham
2012-04-30 19:14 ` [PATCH 02/20] ARM: EXYNOS: Support DMA for EXYNOS5250 SoC Thomas Abraham
2012-04-30 19:14 ` [PATCH 03/20] ARM: EXYNOS: fix ctrlbit for exynos5_clk_pdma1 Thomas Abraham
2012-04-30 19:14 ` [PATCH 04/20] ARM: EXYNOS: Modify the GIC physical address for static io-mapping Thomas Abraham
2012-04-30 19:14 ` [PATCH 05/20] ARM: EXYNOS: Redefine IRQ_MCT_L0,1 definition Thomas Abraham
2012-05-27  1:29   ` Kyungmin Park
2012-06-04  7:56     ` Thomas Abraham
2012-04-30 19:14 ` [PATCH 06/20] ARM: EXYNOS: add GPC4 bank instance Thomas Abraham
2012-05-15 16:27   ` Grant Likely
2012-04-30 19:14 ` [PATCH 07/20] ARM: EXYNOS: Add pre-divider and fout mux clocks for bpll and mpll Thomas Abraham
2012-05-09 11:45   ` Kukjin Kim
2012-05-15  7:09     ` Kukjin Kim
2012-04-30 19:14 ` [PATCH 08/20] ARM: EXYNOS: update irqs for EXYNOS5250 evt1 Thomas Abraham
2012-04-30 19:14 ` [PATCH 09/20] ARM: Exynos: Remove a new bus_type instance for Exynos5 Thomas Abraham
2012-04-30 19:14 ` [PATCH 10/20] of/irq: fix interrupt parent lookup procedure Thomas Abraham
2012-05-15  8:29   ` Kukjin Kim
2012-05-15 18:41     ` Grant Likely [this message]
2012-05-15 20:59       ` Grant Likely
2012-05-26 14:05       ` Thomas Abraham
2012-04-30 19:14 ` [PATCH 11/20] of/irq: add retry support for interrupt controller tree initialization Thomas Abraham
2012-04-30 19:14 ` [PATCH 12/20] ARM: Exynos: Add irq_domain support for interrupt combiner Thomas Abraham
2012-04-30 19:14 ` [PATCH 13/20] ARM: Exynos: Add device tree " Thomas Abraham
2012-04-30 19:14 ` [PATCH 14/20] ARM: Exynos: Simplify the wakeup interrupt setup code Thomas Abraham
2012-04-30 19:14 ` [PATCH 15/20] ARM: Exynos: Add irq_domain support for gpio wakeup interrupts Thomas Abraham
2012-05-15 16:29   ` Grant Likely
2012-04-30 19:14 ` [PATCH 16/20] ARM: Exynos: Remove arch_initcall for wakeup interrupt initialization Thomas Abraham
2012-04-30 19:14 ` [PATCH 17/20] ARM: Exynos: Add device tree support for gpio wakeup interrupt controller Thomas Abraham
2012-05-15 16:35   ` Grant Likely
2012-04-30 19:14 ` [PATCH 18/20] ARM: dts: Update device tree source files for EXYNOS5250 Thomas Abraham
2012-05-02 19:55   ` Olof Johansson
2012-05-15 14:00     ` Thomas Abraham
2012-05-15 14:20       ` [PATCH v2 " Thomas Abraham
2012-04-30 19:14 ` [PATCH 19/20] ARM: Exynos5: Add combiner, wakeup interrupt controller and ethernet nodes Thomas Abraham
2012-05-02 17:57   ` Olof Johansson
2012-05-19  6:11     ` Grant Likely
2012-05-19  6:23       ` Olof Johansson
2012-04-30 19:14 ` [PATCH 20/20] ARM: Exynos5: Add AUXDATA for i2c controllers Thomas Abraham
2012-05-09 11:50 ` [PATCH 00/20] ARM: Samsung: Add support for Exynos5250 Rev1.0 Kukjin Kim
2012-05-15  8:41 ` Kukjin Kim
2012-05-15  8:44   ` Thomas Abraham

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=20120515184149.4E6B93E080A@localhost \
    --to=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).