Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"open list:BROADCOM NVRAM DRIVER" <linux-mips@vger.kernel.org>,
	linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
	Linux-sh list <linux-sh@vger.kernel.org>,
	Daniel Mack <daniel@zonque.org>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	Rich Felker <dalias@libc.org>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 4/9] sh: intc: Drop the use of irq_create_identity_mapping()
Date: Tue, 06 Apr 2021 14:02:41 +0100
Message-ID: <87im4zpnv2.wl-maz@kernel.org> (raw)
In-Reply-To: <CAMuHMdU3vo1AWuDr69WK8-1w38+Q7KturAoL=cFpspZiYr2ssA@mail.gmail.com>

On Tue, 06 Apr 2021 11:32:13 +0100,
Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> 
> Hi Marc,
> 
> On Tue, Apr 6, 2021 at 11:44 AM Marc Zyngier <maz@kernel.org> wrote:
> > Instead of playing games with using irq_create_identity_mapping()
> > and irq_domain_associate(), drop the use of the former and only
> > use the latter, together with the allocation of the irq_desc
> > as needed.
> >
> > It doesn't make the code less awful, but at least the intent
> > is clearer.
> >
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> 
> Thanks for your patch!
> 
> > --- a/drivers/sh/intc/core.c
> > +++ b/drivers/sh/intc/core.c
> > @@ -179,6 +179,23 @@ static unsigned int __init save_reg(struct intc_desc_int *d,
> >         return 0;
> >  }
> >
> > +static bool __init intc_map(struct irq_domain *domain, int irq)
> > +{
> > +       int res;
> 
> warning: unused variable ‘res’ [-Wunused-variable]
> 
> > +
> > +       if (!irq_to_desc(irq) && irq_alloc_desc_at(irq, NUMA_NO_NODE) != irq) {
> > +               pr_err("uname to allocate IRQ %d\n", irq);
> > +               return false;
> > +       }
> > +
> > +       if (irq_domain_associate(domain, irq, irq)) {
> > +               pr_err("domain association failure\n");
> > +               return false;
> > +       }
> > +
> > +       return true;
> > +}
> > +
> >  int __init register_intc_controller(struct intc_desc *desc)
> >  {
> >         unsigned int i, k, smp;
> > @@ -316,19 +333,8 @@ int __init register_intc_controller(struct intc_desc *desc)
> 
> warning: unused variable ‘res’ [-Wunused-variable]

Ah, thanks for spotting these.

> 
> >                 if (!vect->enum_id)
> >                         continue;
> >
> > -               res = irq_create_identity_mapping(d->domain, irq);
> 
> 
> > -               if (unlikely(res)) {
> > -                       if (res == -EEXIST) {
> > -                               res = irq_domain_associate(d->domain, irq, irq);
> > -                               if (unlikely(res)) {
> > -                                       pr_err("domain association failure\n");
> > -                                       continue;
> > -                               }
> > -                       } else {
> > -                               pr_err("can't identity map IRQ %d\n", irq);
> > -                               continue;
> > -                       }
> > -               }
> > +               if (!intc_map(d->domain, irq))
> > +                       continue;
> >
> >                 intc_irq_xlate_set(irq, vect->enum_id, d);
> >                 intc_register_irq(desc, d, vect->enum_id, irq);
> 
> Otherwise this seems to work fine on real hardware (landisk) and qemu
> (rts7751r2d).  I did verify that the new function intc_map() is called.
> 
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Awesome, thanks Geert.

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply index

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06  9:35 [PATCH 0/9] Cleaning up some of the irqdomain features Marc Zyngier
2021-04-06  9:35 ` [PATCH 1/9] irqdomain: Reimplement irq_linear_revmap() with irq_find_mapping() Marc Zyngier
2021-04-06 11:21   ` Christophe Leroy
2021-04-06 12:12     ` Marc Zyngier
2021-04-06  9:35 ` [PATCH 2/9] ARM: PXA: Kill use of irq_create_strict_mappings() Marc Zyngier
2021-04-26 22:39   ` Guenter Roeck
2021-04-27  8:30     ` Marc Zyngier
2021-04-27 12:56       ` Guenter Roeck
2021-04-06  9:35 ` [PATCH 3/9] irqchip/jcore-aic: " Marc Zyngier
2021-04-06  9:35 ` [PATCH 4/9] sh: intc: Drop the use of irq_create_identity_mapping() Marc Zyngier
2021-04-06 10:32   ` Geert Uytterhoeven
2021-04-06 13:02     ` Marc Zyngier [this message]
2021-04-06  9:35 ` [PATCH 5/9] irqdomain: Kill irq_create_strict_mappings()/irq_create_identity_mapping() Marc Zyngier
2021-04-06  9:35 ` [PATCH 6/9] mips: netlogic: Use irq_domain_simple_ops for XLP PIC Marc Zyngier
2021-04-06 11:36   ` Thomas Bogendoerfer
2021-04-06  9:35 ` [PATCH 7/9] irqdomain: Drop references to recusive irqdomain setup Marc Zyngier
2021-04-06  9:35 ` [PATCH 8/9] powerpc: Convert irq_domain_add_legacy_isa use to irq_domain_add_legacy Marc Zyngier
2021-04-06  9:35 ` [PATCH 9/9] irqdomain: Kill irq_domain_add_legacy_isa Marc Zyngier

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=87im4zpnv2.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=dalias@libc.org \
    --cc=daniel@zonque.org \
    --cc=geert@linux-m68k.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=robert.jarzmik@free.fr \
    --cc=tglx@linutronix.de \
    --cc=tsbogend@alpha.franken.de \
    --cc=ysato@users.sourceforge.jp \
    /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

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git