All of lore.kernel.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: Could resource_size can be used for IORESOURCE_IRQ in device tree?
Date: Wed, 27 Jun 2012 08:32:16 +0000	[thread overview]
Message-ID: <201206270832.16418.arnd@arndb.de> (raw)
In-Reply-To: <CAMj5BkhkybgAAXbpLqUQvs0qhgLyKxdT0cMz8=5kaDdMwoL46Q@mail.gmail.com>

On Wednesday 27 June 2012, zhangfei gao wrote:
> 
> Excuse me,
> I have one question when using device tree to get resource_size for
> IORESOURCE_IRQ
> 
> Without dt,
> static struct resource
> {
>                 .start  = 18,
>                 .end    = 19,
>                 .flags  = IORESOURCE_IRQ,
> },
> iores = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> resource_size(iores) = 2 can be used to get how many irq.
> iores->start = 18; iores->end = 19;

IMHO we should just discourage this from being done.
While the API allows you to put multiple interrupts
into a single resource, it does not generally work,
e.g. when the same device is used in another SoC that
puts connects the interrupt lines to non-contiguous
irqs.

It also breaks down with sparse IRQs when you move
away from legacy irqdomains and the linux-internal numbers
that you put in the resource are not related to the hw
numbers any more.

> Is there any API directly get resource number in dt, like resource_size(iores).
> The reason is interrupts is not constant, and we want to parse
> directly from resource.
> If only one irq, then driver parse irqs internally.
> Only if irq number same as channel number, then every channel have own irq.
> It seems inconvenient get irq number one by one and check whether they
> equals channel number or not.

Which driver is it?

I guess in any case the solution would be to split the platform IRQ resource
and change the driver to just read the IRQs individually like most other
drivers do.

	Arnd

  reply	other threads:[~2012-06-27  8:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27  7:30 Could resource_size can be used for IORESOURCE_IRQ in device tree? zhangfei gao
2012-06-27  8:32 ` Arnd Bergmann [this message]
2012-06-27  9:14   ` zhangfei gao

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=201206270832.16418.arnd@arndb.de \
    --to=arnd@arndb.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.