linux-mips
[Top] [All Lists]

Re: [PATCH v2 04/10] irqdomain: Return errors from irq_create_of_mapping

To: Rob Herring <robherring2@gmail.com>, Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [PATCH v2 04/10] irqdomain: Return errors from irq_create_of_mapping()
From: Thierry Reding <thierry.reding@gmail.com>
Date: Mon, 23 Sep 2013 10:13:38 +0200
Cc: Rob Herring <rob.herring@calxeda.com>, Grant Likely <grant.likely@linaro.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Thomas Gleixner <tglx@linutronix.de>, linux-mips@linux-mips.org, Russell King <linux@arm.linux.org.uk>, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Ralf Baechle <ralf@linux-mips.org>, sparclinux@vger.kernel.org, linuxppc-dev <linuxppc-dev@lists.ozlabs.org>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=NsC1Uwg9F0R/3N6i5kUKiMxNx6uq7oVgocK0VWI/bbk=; b=Z1H0nV/+EBjBXxvzVYZolsuqWkgLTmXqnEX2zv0hYLcIP84CivG5Km8fOchcvaiVF1 7JThb+Ya5ktFvPNqYoWnSZ48LbGzW37pV9uLIAsgWLgL0z3TACAkxKVhLUQH7XAxkh4K EKSIO6F2EtBFzlXYX7wbNU1xQ/UzlIbGsTKesFmxU7QS8IVdRkoV3NT1STmE1wddEpuW QoIEOKe4WYQrdYxINWA9osenc2JTYCmZpq+BdiQ00zJ8YNN+DkF7j9V6D20PdiputbWg Q1uj0jSS2LdaasXbw+O8VPBSjkpOICm93R2vs/NSXKC7i1GS8bMrH/Xe4TT9nNUHZBLa /XUg==
In-reply-to: <CAL_JsqLQeAQD460f8Lk9eDE2dCzLusC1mXZ-_uaKVFLfhJNryg@mail.gmail.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1379510692-32435-1-git-send-email-treding@nvidia.com> <1379510692-32435-5-git-send-email-treding@nvidia.com> <CAL_JsqLQeAQD460f8Lk9eDE2dCzLusC1mXZ-_uaKVFLfhJNryg@mail.gmail.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.21 (2010-09-15)
On Sun, Sep 22, 2013 at 04:14:43PM -0500, Rob Herring wrote:
> On Wed, Sep 18, 2013 at 8:24 AM, Thierry Reding
> <thierry.reding@gmail.com> wrote:
> > Instead of returning 0 for all errors, allow the precise error code to
> > be propagated. This will be used in subsequent patches to allow further
> > propagation of error codes.
> >
> > The interrupt number corresponding to the new mapping is returned in an
> > output parameter so that the return value is reserved to signal success
> > (== 0) or failure (< 0).
> >
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> 
> One comment below, otherwise:
> 
> Acked-by: Rob Herring <rob.herring@calxeda.com>
> 
> > diff --git a/arch/powerpc/kernel/pci-common.c 
> > b/arch/powerpc/kernel/pci-common.c
> > index 905a24b..ae71b14 100644
> > --- a/arch/powerpc/kernel/pci-common.c
> > +++ b/arch/powerpc/kernel/pci-common.c
> > @@ -230,6 +230,7 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
> >  {
> >         struct of_irq oirq;
> >         unsigned int virq;
> > +       int ret;
> >
> >         pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev));
> >
> > @@ -266,8 +267,10 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
> >                          oirq.size, oirq.specifier[0], oirq.specifier[1],
> >                          of_node_full_name(oirq.controller));
> >
> > -               virq = irq_create_of_mapping(oirq.controller, 
> > oirq.specifier,
> > -                                            oirq.size);
> > +               ret = irq_create_of_mapping(oirq.controller, oirq.specifier,
> > +                                           oirq.size, &virq);
> > +               if (ret)
> > +                       virq = NO_IRQ;
> >         }
> >         if(virq == NO_IRQ) {
> >                 pr_debug(" Failed to map !\n");
> 
> Can you get rid of NO_IRQ usage here instead of adding to it.

I was trying to stay consistent with the remainder of the code. PowerPC
is a pretty heavy user of NO_IRQ. Of all 348 references, more than half
(182) are in arch/powerpc, so I'd rather like to get a go-ahead from
Benjamin on this.

That said, perhaps we should just go all the way and get rid of NO_IRQ
for good. Things could get somewhat messy, though. There are a couple of
these spread through the code:

        #ifndef NO_IRQ
        #define NO_IRQ (-1)
        #endif

And this isn't very encouraging either:

        $ git grep 'irq.*=.*-1' | wc -l
        638

Thierry

Attachment: pgpzaQ3chtfIt.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>