From: Bjorn Helgaas <helgaas@kernel.org>
To: Marc Gonzalez <marc.w.gonzalez@free.fr>
Cc: Stephen Boyd <swboyd@chromium.org>,
LKML <linux-kernel@vger.kernel.org>,
PCI <linux-pci@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Lucas Stach <l.stach@pengutronix.de>,
Linus Walleij <linus.walleij@linaro.org>,
Mans Rullgard <mans@mansr.com>, Marc Zyngier <maz@kernel.org>
Subject: Re: [PATCH v6 31/57] pci: Remove dev_err() usage after platform_get_irq()
Date: Wed, 7 Aug 2019 17:08:37 -0500 [thread overview]
Message-ID: <20190807220837.GZ151852@google.com> (raw)
In-Reply-To: <fece42c0-f511-173a-b16a-5b1f3a1c1a4e@free.fr>
On Wed, Aug 07, 2019 at 04:09:10PM +0200, Marc Gonzalez wrote:
> On 30/07/2019 23:56, Bjorn Helgaas wrote:
>
> >> diff --git a/drivers/pci/controller/pcie-tango.c b/drivers/pci/controller/pcie-tango.c
> >> index 21a208da3f59..b87aa9041480 100644
> >> --- a/drivers/pci/controller/pcie-tango.c
> >> +++ b/drivers/pci/controller/pcie-tango.c
> >> @@ -273,10 +273,8 @@ static int tango_pcie_probe(struct platform_device *pdev)
> >> writel_relaxed(0, pcie->base + SMP8759_ENABLE + offset);
> >>
> >> virq = platform_get_irq(pdev, 1);
> >> - if (virq <= 0) {
> >> - dev_err(dev, "Failed to map IRQ\n");
> >> + if (virq <= 0)
> >> return -ENXIO;
> >
> > Why <= 0 and -ENXIO?
>
> Smirk. I remember discussing this in the past...
> Here it is:
>
> https://patchwork.kernel.org/patch/10006651/
Sigh, what a mess. I did say in that discussion that it wasn't worth
changing existing "irq <= 0" tests. I can't remember why I said that,
but I think I was wrong.
platform_get_irq() is a generic interface and we have to be able to
interpret return values consistently. The overwhelming consensus
among platform_get_irq() callers is to treat "irq < 0" as an error,
and I think we should follow suit.
> A) AFAIU platform_get_irq() = 0 signals an error.
>
> https://yarchive.net/comp/linux/zero.html
> https://lkml.org/lkml/2016/2/9/212
> https://patchwork.ozlabs.org/patch/486056/
>
> B) I don't remember why I picked ENXIO.
> Perhaps it made more sense to me (at the time) than EINVAL or ENODEV.
I think the best pattern is:
irq = platform_get_irq(pdev, i);
if (irq < 0)
return irq;
There's not an overwhelming consensus on whether to return the result
of platform_get_irq() or a hard-coded -ENXIO/-EINVAL/-ENODEV etc, but
why throw away information?
Bjorn
next prev parent reply other threads:[~2019-08-07 22:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190730181557.90391-1-swboyd@chromium.org>
2019-07-30 18:15 ` [PATCH v6 31/57] pci: Remove dev_err() usage after platform_get_irq() Stephen Boyd
2019-07-30 21:56 ` Bjorn Helgaas
2019-08-07 14:09 ` Marc Gonzalez
2019-08-07 22:08 ` Bjorn Helgaas [this message]
2019-08-08 8:02 ` Geert Uytterhoeven
2019-08-10 8:20 ` Linus Walleij
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=20190807220837.GZ151852@google.com \
--to=helgaas@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=l.stach@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mans@mansr.com \
--cc=marc.w.gonzalez@free.fr \
--cc=maz@kernel.org \
--cc=swboyd@chromium.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).