Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp550027ybp; Tue, 8 Oct 2019 23:54:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxA7vcf2HnmBWunF8774HMwiOZQhRE/KohCgUPG7fP4LhN/yYBcOqUefDY3EUjnO+jKm116 X-Received: by 2002:a17:906:e090:: with SMTP id gh16mr1410785ejb.56.1570604093585; Tue, 08 Oct 2019 23:54:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570604093; cv=none; d=google.com; s=arc-20160816; b=a3hLcIPRKov17mJUbblep7uSMJveWt2tOT1XDIEod5yZZQPG7ZU3nrlQI83IctTX9t jGEfuxwIY+xxRc7GkaecLIge/8PeQLrCqjYx10e5R1/0/wMoIiSgjmxvY9/zA9rLhPWU 3BY4ZdQGjmgmroHI6RN6auGEEC3s6K8VqEw4uaAgk50U5T8w3XqDHibIrzs+I1FFAUgy qsPpqeHnkis9K7/Tdz491m7ejAI+cHMvXGoVT4u8+6gQk/NWJBbMkzCuFbL5Q4lBzcDv HEHbFU5wZoNyhLWwp/jUuU0FU9FqrFOWrFCJtFcB/VaAooVM59NHMlI/BbRFwiqbPjrZ tvUQ== 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 :message-id:subject:cc:to:from:date; bh=APsLNaYP8aFkTqs0sKEEYCr8EHajs9bTOpyivV7spf8=; b=Y2M69JfEJu0bks/+8EfOPDQItBQffpmlW7W15Onklk5l2WKKsX1hOIcX1H5IlNDtl+ jp0IO65TrzucXyEot9Ip/WDlX3mgawVm4C+eYMXGGqWDsp7ZF9hl83g+OAVx/fkrtW+d uzXDgZLewMlhRkT3Wv3HXawVuiDlVU21wcl4MazXR8sHjiDNwC+Z0h3od4o+KIByr2oh 5VGbF3BeAkR2DDknyAhy9s9J28zs/AWNddpiMiB+d8aI9ueznvQh9VuuUgF7nE3g/GRT fcmZ5XwlBWPvNeHe3YjFPV1bV3zwhjyX9OZ5pjjcrPI4sEC7Wf5rbwi0M1CLNxyw29r1 DOUA== 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 j4si723522edl.192.2019.10.08.23.54.30; Tue, 08 Oct 2019 23:54:53 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726349AbfJIGx2 (ORCPT + 99 others); Wed, 9 Oct 2019 02:53:28 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:60835 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbfJIGx2 (ORCPT ); Wed, 9 Oct 2019 02:53:28 -0400 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iI5qZ-0006pi-5k; Wed, 09 Oct 2019 08:53:19 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iI5qV-0002hI-D8; Wed, 09 Oct 2019 08:53:15 +0200 Date: Wed, 9 Oct 2019 08:53:15 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Anson Huang , Stephen Boyd , Greg Kroah-Hartman Cc: jslaby@suse.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linux-imx@nxp.com, "Rafael J. Wysocki" , Andy Shevchenko Subject: Re: [PATCH] tty: serial: imx: Only get second/third IRQ when there is more than one IRQ Message-ID: <20191009065315.wgdvmkv6skteyul4@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1570601911-9162-1-git-send-email-Anson.Huang@nxp.com> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 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 Hello, On Wed, Oct 09, 2019 at 02:18:31PM +0800, Anson Huang wrote: > All i.MX SoCs except i.MX1 have ONLY 1 IRQ, so it is better to check > the IRQ count before getting second/third IRQ to avoid below error > message during probe: > > [ 0.726219] imx-uart 30860000.serial: IRQ index 1 not found > [ 0.731329] imx-uart 30860000.serial: IRQ index 2 not found This message was introduced in commit 7723f4c5ecdb8d832f049f8483beb0d1081cedf6 for 5.4-rc1. I added the involved people to the recipents of this mail. > Signed-off-by: Anson Huang > --- > drivers/tty/serial/imx.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > index 504d81c..081fa82 100644 > --- a/drivers/tty/serial/imx.c > +++ b/drivers/tty/serial/imx.c > @@ -2198,6 +2198,7 @@ static int imx_uart_probe(struct platform_device *pdev) > u32 ucr1; > struct resource *res; > int txirq, rxirq, rtsirq; > + int irq_count; > > sport = devm_kzalloc(&pdev->dev, sizeof(*sport), GFP_KERNEL); > if (!sport) > @@ -2220,9 +2221,17 @@ static int imx_uart_probe(struct platform_device *pdev) > if (IS_ERR(base)) > return PTR_ERR(base); > > + irq_count = platform_irq_count(pdev); > + if (irq_count < 0) > + return irq_count; > + > rxirq = platform_get_irq(pdev, 0); > - txirq = platform_get_irq(pdev, 1); > - rtsirq = platform_get_irq(pdev, 2); > + if (irq_count > 1) { > + txirq = platform_get_irq(pdev, 1); > + rtsirq = platform_get_irq(pdev, 2); > + } else { > + txirq = rtsirq = -ENXIO; > + } The patch is fine given the changed behaviour of platform_get_irq. I wonder if it is sensible to introduce a variant of platform_get_irq (say platform_get_irq_nowarn) that behaves like __platform_get_irq does today. Then the imx driver would just call platform_get_irq_nowarn without having to check the number of available irqs first. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |