Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4825390ybi; Tue, 30 Jul 2019 08:48:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwV5hxHisJ+qLspqBEo2Y3sCTjLRBoZObahiiiE4eE5XODtlCYNwjJbKXXEPJjQL3brKCel X-Received: by 2002:a17:90a:30aa:: with SMTP id h39mr118377691pjb.32.1564501680450; Tue, 30 Jul 2019 08:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564501680; cv=none; d=google.com; s=arc-20160816; b=UszbS7S6k/vIFko+QZpRFJARqtDtfc1eDs/NGegDFNff0RIinDv/VIOvAN5FvGklHv qWqKGofMOBLgRT2xPTg23Xa3w2Tv6GHhgmwXhxuiflP5jRcfhsHOTPpK2zEGLvubXZjH OXVMEa4K+eZv3oEOPab9Xn2TWsDT3ZcLAlMahn6gOKv36nmRIeFV2Rpl0j4pPSMPzZhX f2HQ0HgTqorQHYYVbTcDPd0gioKUDYuiR+bbwB8CQ+nXFxuWf6NrVlwIx++v5PvApszU tPmcwVQGiHkh0/Qsc0zdvoZEqiK8RjbE3dy/t1EU28rpWEQW2ljYYvh6AQtoWFW10EcY D1nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=cHzD9jJm0FVojAZgnH0A+FvoIz++lL6e6pUJgdhG7Fw=; b=Xt2W4qtddf0sxneAJxnAT9qzu73dDehOx1x4QQk+6aAn4vDzeBfyTmAKpGrYQued89 MHsIMc35sEHbFvRQq8hNnipUnz2X/b/Gmtucqo9Hbhin1hdD0+HklvlcSdp1KnfaDjsG BTkT7ByPhIiyXlpTG9Uxml24TGAdLEpl4n/jw0nqJAlr/4b+Ii/JLjoruJCOUjfrn12b dg87soDZ1SyP2CXSjmXfPZvqi/esNQTTqeofNhfdsmXHvp+2i8wAzQqrJtvk4wVXgljy xiNwafSnA+clC0Y6WvTRy4PQpsuAx2R53e2yQoFAq1+E++tS+lub23m07TDtztP5WW1x mlGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16si24365801pgl.318.2019.07.30.08.47.45; Tue, 30 Jul 2019 08:48:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730716AbfG3LHo (ORCPT + 99 others); Tue, 30 Jul 2019 07:07:44 -0400 Received: from mga11.intel.com ([192.55.52.93]:57603 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730639AbfG3LHg (ORCPT ); Tue, 30 Jul 2019 07:07:36 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jul 2019 04:07:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,326,1559545200"; d="scan'208";a="371502145" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.145]) by fmsmga006.fm.intel.com with ESMTP; 30 Jul 2019 04:07:32 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1hsPyc-000293-LK; Tue, 30 Jul 2019 14:07:30 +0300 Date: Tue, 30 Jul 2019 14:07:30 +0300 From: Andy Shevchenko To: Brian Norris Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Salvatore Bellizzi , Dmitry Torokhov , egranata@chromium.org, egranata@google.com, Enric Balletbo i Serra , Gwendal Grignou , linux-acpi@vger.kernel.org, Benson Leung , stable@vger.kernel.org Subject: Re: [PATCH] driver core: platform: return -ENXIO for missing GpioInt Message-ID: <20190730110730.GK23480@smile.fi.intel.com> References: <20190729204954.25510-1-briannorris@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190729204954.25510-1-briannorris@chromium.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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 Mon, Jul 29, 2019 at 01:49:54PM -0700, Brian Norris wrote: > Commit daaef255dc96 ("driver: platform: Support parsing GpioInt 0 in > platform_get_irq()") broke the Embedded Controller driver on most LPC > Chromebooks (i.e., most x86 Chromebooks), because cros_ec_lpc expects > platform_get_irq() to return -ENXIO for non-existent IRQs. > Unfortunately, acpi_dev_gpio_irq_get() doesn't follow this convention > and returns -ENOENT instead. So we get this error from cros_ec_lpc: > > couldn't retrieve IRQ number (-2) > > I see a variety of drivers that treat -ENXIO specially, so rather than > fix all of them, let's fix up the API to restore its previous behavior. > > I reported this on v2 of this patch: > > https://lore.kernel.org/lkml/20190220180538.GA42642@google.com/ > > but apparently the patch had already been merged before v3 got sent out: > > https://lore.kernel.org/lkml/20190221193429.161300-1-egranata@chromium.org/ > > and the result is that the bug landed and remains unfixed. > > I differ from the v3 patch by: > * allowing for ret==0, even though acpi_dev_gpio_irq_get() specifically > documents (and enforces) that 0 is not a valid return value (noted on > the v3 review) > * adding a small comment Thank you for fixing this. Reviewed-by: Andy Shevchenko > > Reported-by: Brian Norris > Reported-by: Salvatore Bellizzi > Cc: Enrico Granata > Cc: > Fixes: daaef255dc96 ("driver: platform: Support parsing GpioInt 0 in platform_get_irq()") > Signed-off-by: Brian Norris > --- > Side note: it might have helped alleviate some of this pain if there > were email notifications to the mailing list when a patch gets applied. > I didn't realize (and I'm not sure if Enrico did) that v2 was already > merged by the time I noted its mistakes. If I had known, I would have > suggested a follow-up patch, not a v3. > > I know some maintainers' "tip bots" do this, but not all apparently. > > drivers/base/platform.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > index 506a0175a5a7..ec974ba9c0c4 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -157,8 +157,13 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) > * the device will only expose one IRQ, and this fallback > * allows a common code path across either kind of resource. > */ > - if (num == 0 && has_acpi_companion(&dev->dev)) > - return acpi_dev_gpio_irq_get(ACPI_COMPANION(&dev->dev), num); > + if (num == 0 && has_acpi_companion(&dev->dev)) { > + int ret = acpi_dev_gpio_irq_get(ACPI_COMPANION(&dev->dev), num); > + > + /* Our callers expect -ENXIO for missing IRQs. */ > + if (ret >= 0 || ret == -EPROBE_DEFER) > + return ret; > + } > > return -ENXIO; > #endif > -- > 2.22.0.709.g102302147b-goog > -- With Best Regards, Andy Shevchenko