Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp256768ybl; Wed, 4 Dec 2019 02:11:41 -0800 (PST) X-Google-Smtp-Source: APXvYqw61trsNorKwr7CJBBll9hPhuZlxoxAXP1PfE3Q85rX12FxBp+jJ9bX426kdFtMs6PZNmxA X-Received: by 2002:a9d:5885:: with SMTP id x5mr1786853otg.132.1575454301276; Wed, 04 Dec 2019 02:11:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575454301; cv=none; d=google.com; s=arc-20160816; b=h92Y6HQhNSV9gN/t1H1ozTkSNHOCObmAto6ORYSg4UePnIsaIn0LzGqUTd+upppIwd 5uZVKadhQihH0gv2EYRAiifEGA+Uge5ofNZ4cX7wz3snhKUfTVfA5XYww9Pv08OUcojX cwiOYBQsSbIMZUibGlDWYeMbgbVsE6blCFgEWC5eFzV96PAuJlIfdvLw+BafwsAWavXo DK3NTh8uWJIgM4ubuHQX5x5rPyPWm/amgnw5NYla7o0CnGGlVTycSDFUfUIojtKEwKKs h6mxlKJQydngFp9u6Pu2s9MR8vApr+VEsHG5T3lKu50irNBVmnOj4ak108GceHIyYydn oPOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Ya98y3FMNK5MCYEdYl4DIOjhhrCwmlonm6QYr5nDJZk=; b=0TgU4wFpyKjC7WMRlJSuKzj4FJg2ifLIxKYU9DkmSrj7kNFmwtskSAKyTC8HNr0mhy vfmK8UxLT26b08zs7QesEfp/Q8e3vS39bkyWZ6qxM4hMb2xWX0zDH6DDwTZiQUBv2JyP +PcPL5GcbMy4RPqnH3wETPd1KQ5nFxaGeVL+Vmdk8rT7SXTCfDgEh42qeJw8JRjiAZPU 9A33vMfV8cDDiSE3uPqfPptQ/gWaLWxWfbvXI1Mra8QYhcg0HjmRQUzMcfavko/1ddd0 obW8NB6D6qqplTphcDw9J1klAT80Db7RXXVvEi89/McVGncOjePoC4xmqXmHfd/GPCB1 kRGg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z21si3157433oti.25.2019.12.04.02.11.29; Wed, 04 Dec 2019 02:11:41 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727635AbfLDKJe (ORCPT + 99 others); Wed, 4 Dec 2019 05:09:34 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:48813 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727621AbfLDKJd (ORCPT ); Wed, 4 Dec 2019 05:09:33 -0500 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1icRb4-0006R9-Qi; Wed, 04 Dec 2019 11:09:26 +0100 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1icRb3-0006ip-Vu; Wed, 04 Dec 2019 11:09:25 +0100 Date: Wed, 4 Dec 2019 11:09:25 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Peng Fan Cc: "rjui@broadcom.com" , "linus.walleij@linaro.org" , "bgolaszewski@baylibre.com" , "f.fainelli@gmail.com" , "sbranden@broadcom.com" , "thierry.reding@gmail.com" , "robh@kernel.org" , "bcm-kernel-feedback-list@broadcom.com" , dl-linux-imx , "linux-gpio@vger.kernel.org" , "linux-pwm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 2/2] gpio: bcm-kona: use platform_irq_count Message-ID: <20191204100925.sjp6cztozlm5qm6y@pengutronix.de> References: <1575451330-11112-1-git-send-email-peng.fan@nxp.com> <1575451330-11112-2-git-send-email-peng.fan@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1575451330-11112-2-git-send-email-peng.fan@nxp.com> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 04, 2019 at 09:24:39AM +0000, Peng Fan wrote: > From: Peng Fan > > platform_irq_count() is the more generic way (independent of > device trees) to determine the count of available interrupts. So > use this instead. > > As platform_irq_count() might return an error code (which > of_irq_count doesn't) some additional handling is necessary. > > Signed-off-by: Peng Fan > --- > > V3: > Use %pe Great. Note that with %pe there is a dependency on commit 57f5677e535b ("printf: add support for printing symbolic error names") which was applied during the current merge window. > V2: > Update commit log, and add err handling > Not tested, just code inspection > > > drivers/gpio/gpio-bcm-kona.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c > index 4122683eb1f9..baee8c3f06ad 100644 > --- a/drivers/gpio/gpio-bcm-kona.c > +++ b/drivers/gpio/gpio-bcm-kona.c > @@ -19,7 +19,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -586,11 +585,18 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev) > > kona_gpio->gpio_chip = template_chip; > chip = &kona_gpio->gpio_chip; > - kona_gpio->num_bank = of_irq_count(dev->of_node); > - if (kona_gpio->num_bank == 0) { > + ret = platform_irq_count(pdev); > + if (!ret) { > dev_err(dev, "Couldn't determine # GPIO banks\n"); > return -ENOENT; > + } else if (ret < 0) { > + if (ret != -EPROBE_DEFER) > + dev_err(dev, "Couldn't determine GPIO banks: (%pe)\n", > + ERR_PTR(ret)); I'd say drop either the colon or the parenthesis. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | https://www.pengutronix.de/ |