Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp567706ybp; Wed, 9 Oct 2019 00:15:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqyna2384DLuJQkKCvZf3gbAf903yYidegd0j8x8zTKOzLWCHvSsqNCuc9han8CC/iKdExLe X-Received: by 2002:a17:906:6d87:: with SMTP id h7mr1458462ejt.4.1570605308566; Wed, 09 Oct 2019 00:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570605308; cv=none; d=google.com; s=arc-20160816; b=CAxcFCC+JRejlMCuYFYmzlccFwkYkqWC3HojDIbuZpketR2zjT15NvUidznAxS2MSg +zT9yCKODbpbb94GQ340LTMEXKJ/Z67UVUgJSGSe8FlAMTBsNQo1Xo+QXMVLNj8WVyZn iX2Pva1bk19sQm41rEcIEyDNLyKSxpN/5ECcX8Ob3M14I42U1hEnF/ZifjQq0H9KbNY6 J5N6ko5stpxhRYT1+X410srhsM9Qdtj1WVVuCH2YoACQA/ryZLoGpmDmMzai6IyfEN+j oeGyMEx/CgHD6n3OCPqCABeHtz0b7Lh7n7dHqwB2fRj19wU00eTO6GR6L1xOYkRq4Bcs nrow== 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=RrIJDqqKnq/yvBlB6YZE9rMxJUKEogAhM4pBZea3XzA=; b=tVBwquPdGwwywa07ZQi30bIepfK1DxEZlcExS4q8USf5ZWuHXmuB+cNsG5QIiXraWo VKI2597pg+kOvFSTU6Fx6RZDUbkwAX1Il1ItR9hV0XPS7tuRWTQEJFwMcl7Lin1m/vCz 5n/AJcWMjWRG5vtrOsGkswaYFldWdmx7sxcTCH0WQveb0wZ+GL+eFfvmc5OlUNuriszm x1CUv9ZjdsxQuHzmTr+W76GyJlI6wELSg3uuJHDbBmkbKs+7pisW0EmM5B9sZHSu5j+T Vu5YfiRNDvZhKLQ0/2fB0pOiVM2HjTjEgJt+M6MfWuandhuyGcyozAxAcklidytczBAP 8ZjA== 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 r16si722682edo.307.2019.10.09.00.14.45; Wed, 09 Oct 2019 00:15: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; 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 S1725989AbfJIHOQ (ORCPT + 99 others); Wed, 9 Oct 2019 03:14:16 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:54831 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725440AbfJIHOQ (ORCPT ); Wed, 9 Oct 2019 03:14:16 -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 1iI6Ag-0000w8-A7; Wed, 09 Oct 2019 09:14:06 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iI6Ad-0003la-A9; Wed, 09 Oct 2019 09:14:03 +0200 Date: Wed, 9 Oct 2019 09:14:03 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Anson Huang Cc: Stephen Boyd , Greg Kroah-Hartman , "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" , dl-linux-imx , "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: <20191009071403.ugd2wuac6ue5zsd6@pengutronix.de> References: <1570601911-9162-1-git-send-email-Anson.Huang@nxp.com> <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: 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 06:58:24AM +0000, Anson Huang wrote: > > 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. > > Yes, I noticed this, thanks. > > > > > > 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 t > > Then the imx driver would just call platform_get_irq_nowarn without having > > to check the number of available irqs first. > > Agreed, it would be nice if we can fix this from the API level, this > is to save many patches from various drivers side, let me know if > agreement is reached and I will do the patch. I wouldn't expect that most callers actually want an error message and so these need a different patch (i.e. dropping the error message by the caller). This type of patch is fine and the normal load when something is consolidated. Which other drivers do you have on your radar that don't want an error message if platform_get_irq() fails? Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |