linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/9] irq: check domain hwirq range for DT translate
Date: Mon, 19 Dec 2011 08:23:42 -0600	[thread overview]
Message-ID: <4EEF48EE.1070800@gmail.com> (raw)
In-Reply-To: <4EEF3110.30203@ti.com>

Benoit,

On 12/19/2011 06:41 AM, Cousson, Benoit wrote:
> Hi Rob,
> 
> While trying your series to take advantage of the generic-irq domain
> support for OMAP3 INTC, I realized that the following patch is breaking
> drivers that are using irq_domain_add_simple.
> 
> The point is that irq_domain_add_simple does not populate hwirq_base or
> nr_irq, so that test will always fail if the domain is created by the
> irq_domain_add_simple API.
> 
> Adding an extra parameter to provide the nr_irq should fix that.
> 
> The long term fix should be to use the generic-irq for such driver, but
> this is not the same effort, so it might worth fixing that API for the
> moment.
> 
> Regards,
> Benoit
> 
> On 12/14/2011 4:28 PM, Rob Herring wrote:
>> From: Rob Herring<rob.herring@calxeda.com>
>>
>> A DT node may have more than 1 domain associated with it, so make sure
>> the hwirq number is within range when doing DT translation.
>>
>> Signed-off-by: Rob Herring<rob.herring@calxeda.com>
>> Cc: Thomas Gleixner<tglx@linutronix.de>
>> ---
>>   kernel/irq/irqdomain.c |    3 +++
>>   1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
>> index 200ce83..ae6441e 100644
>> --- a/kernel/irq/irqdomain.c
>> +++ b/kernel/irq/irqdomain.c
>> @@ -135,6 +135,9 @@ int irq_domain_simple_dt_translate(struct
>> irq_domain *d,
>>           return -EINVAL;
>>       if (intsize<  1)
>>           return -EINVAL;
>> +    if ((intspec[0]<  d->hwirq_base) ||
>> +        (intspec[0]>= d->hwirq_base + d->nr_irq))

I think this should work:

if (d->nr_irq && ((intspec[0] < d->hwirq_base) ||
    (intspec[0] >= d->hwirq_base + d->nr_irq)))

Rob

>> +        return -EINVAL;
>>
>>       *out_hwirq = intspec[0];
>>       *out_type = IRQ_TYPE_NONE;
> 

  reply	other threads:[~2011-12-19 14:23 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14 15:28 [PATCH 0/9] irq domain for gen irq chip and pl061 DT irq support Rob Herring
2011-12-14 15:28 ` [PATCH 1/9] dt: add empty of_get_node/of_put_node functions Rob Herring
2011-12-14 16:02   ` Grant Likely
2011-12-14 15:28 ` [PATCH 2/9] irq: check domain hwirq range for DT translate Rob Herring
2011-12-14 16:08   ` Grant Likely
2011-12-15  5:23   ` Shawn Guo
2011-12-19 12:41   ` Cousson, Benoit
2011-12-19 14:23     ` Rob Herring [this message]
2011-12-19 15:21       ` Cousson, Benoit
2011-12-14 15:28 ` [PATCH 3/9] irq: convert generic-chip to use irq_domain Rob Herring
2011-12-14 21:14   ` Grant Likely
2011-12-14 21:23     ` Rob Herring
2011-12-14 21:26       ` Grant Likely
2011-12-14 23:29         ` Rob Herring
2011-12-15  5:25   ` Shawn Guo
2011-12-15  5:55     ` Shawn Guo
2011-12-15 13:39       ` Rob Herring
2011-12-15 13:56         ` Rob Herring
2011-12-15 14:15           ` Shawn Guo
2011-12-15 14:46           ` Shawn Guo
2011-12-15 15:55           ` Grant Likely
2011-12-15 16:17             ` Rob Herring
2011-12-15 16:39               ` Grant Likely
2011-12-15 14:08         ` Shawn Guo
2011-12-15 14:01           ` Rob Herring
2011-12-14 15:28 ` [PATCH 4/9] gpio: pl061: use chained_irq_* functions in irq handler Rob Herring
2011-12-14 21:15   ` Grant Likely
2011-12-14 15:28 ` [PATCH 5/9] gpio: pl061: convert to use 0 for no irq Rob Herring
2011-12-14 21:16   ` Grant Likely
2011-12-14 15:28 ` [PATCH 6/9] ARM: realview: convert pl061 no irq to 0 instead of -1 Rob Herring
2011-12-14 21:16   ` Grant Likely
2011-12-14 15:28 ` [PATCH 7/9] gpio: pl061: convert to use generic irq chip Rob Herring
2011-12-14 21:17   ` Grant Likely
2011-12-19 20:52   ` [PATCH v2] " Rob Herring
2011-12-24 23:26     ` Linus Walleij
2012-01-02  8:54     ` Grant Likely
2012-01-02 16:54       ` Rob Herring
2011-12-14 15:28 ` [PATCH 8/9] gpio: pl061: enable interrupts with DT style binding Rob Herring
2011-12-14 21:39   ` Grant Likely
2011-12-19 20:54   ` [PATCH v2] " Rob Herring
2011-12-14 15:28 ` [PATCH 9/9] ARM: highbank: add interrupt properties to gpio nodes Rob Herring
2011-12-14 21:39   ` Grant Likely
2011-12-14 15:41 ` [PATCH 0/9] irq domain for gen irq chip and pl061 DT irq support Rob Herring

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=4EEF48EE.1070800@gmail.com \
    --to=robherring2@gmail.com \
    --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).