From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753349AbbIGCQb (ORCPT ); Sun, 6 Sep 2015 22:16:31 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:34817 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752716AbbIGCQa (ORCPT ); Sun, 6 Sep 2015 22:16:30 -0400 Message-ID: <55ECF37D.7050401@gmail.com> Date: Sun, 06 Sep 2015 19:16:29 -0700 From: Frank Rowand Reply-To: frowand.list@gmail.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Rob Herring CC: David Daney , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Rob Herring , Grant Likely , David Daney Subject: Re: [PATCH] of_pci_irq: Silence bogus "of_irq_parse_pci() failed ..." messages. References: <1441393926-23225-1-git-send-email-ddaney.cavm@gmail.com> <55EA41E3.5010103@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/6/2015 1:46 PM, Rob Herring wrote: > On Fri, Sep 4, 2015 at 8:14 PM, Frank Rowand wrote: >> On 9/4/2015 12:12 PM, David Daney wrote: >>> From: David Daney >>> >>> It is perfectly legitimate for a PCI device to have an >>> PCI_INTERRUPT_PIN value of zero. This happens if the device doesn't >>> use interrupts, or on PCIe devices, where only MSI/MSI-X are >>> supported. >>> >>> Silence the annoying "of_irq_parse_pci() failed with rc=-19" error >>> messages by making them conditional on !-ENODEV (which can only be >>> produced in the PCI_INTERRUPT_PIN == 0 case). >>> >>> Signed-off-by: David Daney >>> --- >>> drivers/of/of_pci_irq.c | 4 +++- >>> 1 file changed, 3 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/of/of_pci_irq.c b/drivers/of/of_pci_irq.c >>> index 1710d9d..33d242a 100644 >>> --- a/drivers/of/of_pci_irq.c >>> +++ b/drivers/of/of_pci_irq.c >>> @@ -106,7 +106,9 @@ int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin) >>> >>> ret = of_irq_parse_pci(dev, &oirq); >>> if (ret) { >>> - dev_err(&dev->dev, "of_irq_parse_pci() failed with rc=%d\n", ret); >>> + if (ret != -ENODEV) >>> + dev_err(&dev->dev, >>> + "of_irq_parse_pci() failed with rc=%d\n", ret); >>> return 0; /* Proper return code 0 == NO_IRQ */ >>> } >>> >>> >> >> It is not safe to assume that the functions that of_irq_parse_pci() calls >> will never be modified to return -ENODEV, thus resulting in of_irq_parse_pci() >> returning -ENODEV for a reason other than PCI_INTERRUPT_PIN == 0. > > Yes, but we're talking about a print statement. > >> >> A more robust solution would be something like: < snip my bad solution > >> I'm not sure I like my solution, there might be a better way. > > I don't like it. That's way too complex for just silencing an > erroneous error message. > > Perhaps just move the error message into of_irq_parse_pci and then you > can control the print more easily. Or just change to dev_dbg would be > okay by me. I knew I was making it way too hard. Yes, just move the error message to of_irq_parse_pci(), where the "/* No pin, exit */" test occurs. >> I also noticed another bug while looking at of_irq_parse_pci(). It returns >> the non-zero return value from pci_read_config_byte(). But that value is >> one of the PCI function error values from include/linux/pci.h, such as: >> >> #define PCIBIOS_BAD_REGISTER_NUMBER 0x87 >> >> instead of a negative errno. > > I was puzzled by why this is not standard error codes a while back. My > best guess is that that there is some legacy here. Changing error > values on widely used functions is impossible to audit. NO_IRQ being 0 > or -1 is one such case. > > Rob >