Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2861446ybh; Mon, 5 Aug 2019 08:02:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzK6wzoYzcS3K9dVAF9FnnUWXgcRyBQNYnnj3dxGpXgepEMZrh+tiykZ5sTiShoiz0d+ccy X-Received: by 2002:a17:902:8547:: with SMTP id d7mr147293326plo.171.1565017328193; Mon, 05 Aug 2019 08:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565017328; cv=none; d=google.com; s=arc-20160816; b=pc2AChrpWB1LbRlloNQg4ch/3e6XTqzoihQhgRKgr9UOUHNpw0/0hrNorpspiLtbkw +Nfk6HJNyPQujKR4UqhevvJDqD7bG8qiWF33AarFHQ2uBaIIZl8TwmLRA5z4zcNo3G4N wFMYbPr9wNu4Vb+EQo1hhRRG58+3IVsHJXY3kGZQT3YWsJV0uVIVzuhgVjXxmEdrypB0 fbt4/KV8afF0aSOlPS79+CyY6iPSoe1ryTcYfhOtL0MShNvZVjgpGGuQKL8Ub9rF44Dh RmWsPx46NmnyxSpWCM1rslVmfSI4ej60SIOPAM23B7PM0GGXG3tZsN7YZEb6XqgtesXK KLeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=eJ7SYWT+3V+IrU/P+g4WVqDTf9F+Efcf7VkpvncOTK4=; b=eXWjEZMw9XOY3OH11i3PBkBEuXelBgXG7jDEnC6HZ2HdffaQDmSVzSyCluHe0drRHG zCNV8ZDKN48C/mGK2Y0dxi6EFXVExhKKpJThevrQEAjaEOII5nQS1YfeYoeFYNUBxGyc iDi+ivuIj5KH/8nE7EbiyiOcLkntrccKMABxKjogwDtHiO91bQG02wW9etF5dQzxj8QF 3SIP6i89IhAC9E8BxOhaQgwEYbWXsIT+3afgdpsANvT4R9ldCg2gG4g3CY4yJQ0Po1Dc 6myTn3GPRulz4reuCKlY2H8CLaI+Cp0whO/TsntF02xknPLbNyykZMVjH6w58MD+7tQC uS4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fPsxLD2k; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9si2909885pgm.59.2019.08.05.08.01.51; Mon, 05 Aug 2019 08:02:08 -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; dkim=pass header.i=@kernel.org header.s=default header.b=fPsxLD2k; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729317AbfHEPBG (ORCPT + 99 others); Mon, 5 Aug 2019 11:01:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:36196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728848AbfHEPBG (ORCPT ); Mon, 5 Aug 2019 11:01:06 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (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 493A9206C1; Mon, 5 Aug 2019 15:01:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565017264; bh=384BdRNrgOOPUHK/Gd5gCMeKsXndGzWgEJedt98ySYI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=fPsxLD2kGrZ6nAmuXEvY7FDyBVnBaRN6dt3HrDvCMCeUM86R+p/IRxLYxUESGCwdr 0GO4aVohZ31gRx359dkq2bXOA9PUhIzUWYsyZ3hj70xgyYYv9UGv/Xfg9YHgFdM/w7 Ku9eG9Hc8exbAjuMwNOeuhC6dZKBxVsuJSg92C2c= Date: Mon, 5 Aug 2019 16:01:00 +0100 From: Jonathan Cameron To: Phil Reid Cc: Stephen Boyd , linux-kernel@vger.kernel.org, Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-iio@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH v6 19/57] iio: Remove dev_err() usage after platform_get_irq() Message-ID: <20190805160100.7f1b92be@archlinux> In-Reply-To: <6dc9dbc0-c338-eb21-aeb3-70026bebfd41@electromag.com.au> References: <20190730181557.90391-1-swboyd@chromium.org> <20190730181557.90391-20-swboyd@chromium.org> <5d41a66d.1c69fb81.6d372.4c72@mx.google.com> <6dc9dbc0-c338-eb21-aeb3-70026bebfd41@electromag.com.au> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 1 Aug 2019 10:37:40 +0800 Phil Reid wrote: > G'day Stephen, > > One comment below. Please send as fresh patch. Nice to clean these up, but I'll loose it buried in a thread like this! Thanks, Jonathan > > On 31/07/2019 22:32, Stephen Boyd wrote: > > Quoting Phil Reid (2019-07-30 23:42:16) > >> G'day Stephen, > >> > >> A comment unrelated to your change. > >> > >> On 31/07/2019 02:15, Stephen Boyd wrote: > >> .... > >> > >>> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c > >>> index 32f1c4a33b20..abe99856c823 100644 > >>> --- a/drivers/iio/adc/at91_adc.c > >>> +++ b/drivers/iio/adc/at91_adc.c > >>> @@ -1179,10 +1179,8 @@ static int at91_adc_probe(struct platform_device *pdev) > >>> idev->info = &at91_adc_info; > >>> > >>> st->irq = platform_get_irq(pdev, 0); > >>> - if (st->irq < 0) { > >>> - dev_err(&pdev->dev, "No IRQ ID is designated\n"); > >>> + if (st->irq < 0) > >>> return -ENODEV; > >> Should this be returning st->irq instead of -ENODEV? > >> eg: platform_get_irq can return -EPROBE_DEFER > >> > >> Pattern is repeated in a number of other places. > > > > Probably? Here's a patch. > > > > ----8<---- > > From: Stephen Boyd > > Subject: [PATCH] iio: Return error values from platform_get_irq*() > > > > Sometimes platform_get_irq*() can return -EPROBE_DEFER, so it's best to > > return the actual error value from calling this function instead of > > overriding the value to something like -EINVAL or -ENXIO. Except for in > > the case when the irq value is 0 and the driver knows that irq 0 isn't > > valid. In such a situation, return whatever error value was returned > > before this change. > > > > Reported-by: Phil Reid > > Cc: Phil Reid > > Cc: Jonathan Cameron > > Cc: Hartmut Knaack > > Cc: Lars-Peter Clausen > > Cc: Peter Meerwald-Stadler > > Cc: linux-iio@vger.kernel.org > > Cc: Greg Kroah-Hartman > > Signed-off-by: Stephen Boyd > > --- > > drivers/iio/adc/at91_adc.c | 2 +- > > drivers/iio/adc/bcm_iproc_adc.c | 2 +- > > drivers/iio/adc/fsl-imx25-gcq.c | 4 +--- > > drivers/iio/adc/lpc32xx_adc.c | 2 +- > > drivers/iio/adc/npcm_adc.c | 2 +- > > drivers/iio/adc/spear_adc.c | 2 +- > > 6 files changed, 6 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c > > index abe99856c823..2c604198c4b7 100644 > > --- a/drivers/iio/adc/at91_adc.c > > +++ b/drivers/iio/adc/at91_adc.c > > @@ -1180,7 +1180,7 @@ static int at91_adc_probe(struct platform_device *pdev) > > > > st->irq = platform_get_irq(pdev, 0); > > if (st->irq < 0) > > - return -ENODEV; > > + return st->irq; > > > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > > > diff --git a/drivers/iio/adc/bcm_iproc_adc.c b/drivers/iio/adc/bcm_iproc_adc.c > > index 646ebdc0a8b4..6c05ea510c40 100644 > > --- a/drivers/iio/adc/bcm_iproc_adc.c > > +++ b/drivers/iio/adc/bcm_iproc_adc.c > > @@ -541,7 +541,7 @@ static int iproc_adc_probe(struct platform_device *pdev) > > > > adc_priv->irqno = platform_get_irq(pdev, 0); > > if (adc_priv->irqno <= 0) > > - return -ENODEV; > > + return adc_priv->irqno; > > return adc_priv->irqno ? : -ENODEV; > > > > > ret = regmap_update_bits(adc_priv->regmap, IPROC_REGCTL2, > > IPROC_ADC_AUXIN_SCAN_ENA, 0); > > diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c > > index fa71489195c6..ee20ab09abe5 100644 > > --- a/drivers/iio/adc/fsl-imx25-gcq.c > > +++ b/drivers/iio/adc/fsl-imx25-gcq.c > > @@ -340,9 +340,7 @@ static int mx25_gcq_probe(struct platform_device *pdev) > > > > priv->irq = platform_get_irq(pdev, 0); > > if (priv->irq <= 0) { > > - ret = priv->irq; > > - if (!ret) > > - ret = -ENXIO; > > + ret = priv->irq ? : -ENXIO; > > goto err_clk_unprepare; > > } > > > > diff --git a/drivers/iio/adc/lpc32xx_adc.c b/drivers/iio/adc/lpc32xx_adc.c > > index b896f7ff4572..edbb58212fba 100644 > > --- a/drivers/iio/adc/lpc32xx_adc.c > > +++ b/drivers/iio/adc/lpc32xx_adc.c > > @@ -173,7 +173,7 @@ static int lpc32xx_adc_probe(struct platform_device *pdev) > > > > irq = platform_get_irq(pdev, 0); > > if (irq <= 0) > > - return -ENXIO; > > + return irq ? : -ENXIO; > > > > retval = devm_request_irq(&pdev->dev, irq, lpc32xx_adc_isr, 0, > > LPC32XXAD_NAME, st); > > diff --git a/drivers/iio/adc/npcm_adc.c b/drivers/iio/adc/npcm_adc.c > > index 910f3585fa54..1e54a64a4534 100644 > > --- a/drivers/iio/adc/npcm_adc.c > > +++ b/drivers/iio/adc/npcm_adc.c > > @@ -225,7 +225,7 @@ static int npcm_adc_probe(struct platform_device *pdev) > > > > irq = platform_get_irq(pdev, 0); > > if (irq <= 0) { > > - ret = -EINVAL; > > + ret = irq ? : -EINVAL; > > goto err_disable_clk; > > } > > > > diff --git a/drivers/iio/adc/spear_adc.c b/drivers/iio/adc/spear_adc.c > > index 592b97c464da..9b16717ac7e7 100644 > > --- a/drivers/iio/adc/spear_adc.c > > +++ b/drivers/iio/adc/spear_adc.c > > @@ -301,7 +301,7 @@ static int spear_adc_probe(struct platform_device *pdev) > > > > irq = platform_get_irq(pdev, 0); > > if (irq <= 0) { > > - ret = -EINVAL; > > + ret = irq ? : -EINVAL; > > goto errout2; > > } > > > > > >