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 2/4] irqdomain: augment add_simple() to allocate descs
Date: Mon, 26 Nov 2012 20:22:59 +0000	[thread overview]
Message-ID: <20121126202259.190243E09E6@localhost> (raw)
In-Reply-To: <506457A1.8050404@gmail.com>

On Thu, 27 Sep 2012 08:41:53 -0500, Rob Herring <robherring2@gmail.com> wrote:
> On 09/27/2012 08:13 AM, Linus Walleij wrote:
> > ---
> >  kernel/irq/irqdomain.c | 21 ++++++++++++++++-----
> >  1 file changed, 16 insertions(+), 5 deletions(-)
> > 
> > diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> > index 49a7772..a0655b6 100644
> > --- a/kernel/irq/irqdomain.c
> > +++ b/kernel/irq/irqdomain.c
> > @@ -148,7 +148,8 @@ static unsigned int irq_domain_legacy_revmap(struct irq_domain *domain,
> >   * @host_data: Controller private data pointer
> >   *
> >   * Allocates a legacy irq_domain if irq_base is positive or a linear
> > - * domain otherwise.
> > + * domain otherwise. For the legacy domain, IRQ descriptors will also
> > + * be allocated.
> >   *
> >   * This is intended to implement the expected behaviour for most
> >   * interrupt controllers which is that a linear mapping should
> > @@ -162,11 +163,21 @@ struct irq_domain *irq_domain_add_simple(struct device_node *of_node,
> >  					 const struct irq_domain_ops *ops,
> >  					 void *host_data)
> >  {
> > -	if (first_irq > 0)
> > -		return irq_domain_add_legacy(of_node, size, first_irq, 0,
> > +	if (first_irq > 0) {
> > +		int irq_base;
> > +
> > +		irq_base = irq_alloc_descs(first_irq, 0, size, numa_node_id());
> 
> This will always fail for !SPARSE_IRQ, so we probably don't want warn in
> that case. So perhaps something like this:
> 
> int irq_base = first_irq;
> 
> if (is_enabled(CONFIG_SPARSE_IRQ)) {
> 	irq_base = irq_alloc_descs(first_irq, 0, size, numa_node_id());
> 	if (irq_base < 0) {
> 		WARN(1, "Cannot allocate irq_descs @ IRQ%d, assuming pre-allocated\n",
> 		     first_irq);
> 		irq_base = first_irq;
> 	}
> }

Also, warn seems a little over-loud in this case. If the controller is
legitimately claiming irqs in the reserved range, then dumping out a
backtrace is kind of nasty.

g.

  reply	other threads:[~2012-11-26 20:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-27 13:13 [PATCH 2/4] irqdomain: augment add_simple() to allocate descs Linus Walleij
2012-09-27 13:41 ` Rob Herring
2012-11-26 20:22   ` Grant Likely [this message]
2012-09-27 13:54 ` Paul Mundt

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=20121126202259.190243E09E6@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).