From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 478F4C32751 for ; Wed, 7 Aug 2019 22:08:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CD3021882 for ; Wed, 7 Aug 2019 22:08:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565215721; bh=Anq0fyzHSpNvpzissPJGid5WBnHTC6apYNeaT7/QbSo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=BqPdyBc0/y8UwVYtTj4ETpGYtj+iPyr664HWqEHNUl0VboidmT0VywLQVzAmGrsNp fQNE4wPxsTUUYzNeHHHRgPj+OhqsiO8Dw4G8gERfMqbOquXPqgwkb5OkL9NiwHozRx up/r++GjJTq8efAPb1RL68FIWJYYwL43Z5KIiczs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730138AbfHGWIk (ORCPT ); Wed, 7 Aug 2019 18:08:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:45212 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727213AbfHGWIj (ORCPT ); Wed, 7 Aug 2019 18:08:39 -0400 Received: from localhost (unknown [69.71.4.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7257021872; Wed, 7 Aug 2019 22:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565215718; bh=Anq0fyzHSpNvpzissPJGid5WBnHTC6apYNeaT7/QbSo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Z48flQZqTjJaDYD05Ot7rpnOYeugqEJHgGY4XFE3IO059jgqSn5smN/EywZdfTVMs 95zjsbsMzzwvJ+g8xBwap1ChAgu2CCvyplWosfaT/+gtusd69kWVbk08gnqT6F/Eef MD29vTCgdlJYft00UMFW6aUKhb3KhFfsuZoJyyGQ= Date: Wed, 7 Aug 2019 17:08:37 -0500 From: Bjorn Helgaas To: Marc Gonzalez Cc: Stephen Boyd , LKML , PCI , Greg Kroah-Hartman , Lorenzo Pieralisi , Lucas Stach , Linus Walleij , Mans Rullgard , Marc Zyngier Subject: Re: [PATCH v6 31/57] pci: Remove dev_err() usage after platform_get_irq() Message-ID: <20190807220837.GZ151852@google.com> References: <20190730181557.90391-1-swboyd@chromium.org> <20190730181557.90391-32-swboyd@chromium.org> <20190730215626.GA151852@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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