Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp524317ybp; Tue, 8 Oct 2019 23:21:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzK3Kz2LNB0zVEQVsOZxB2XLbJnSAzmVs1dmBQo3Mp9nYpg/X3ZeLA6jFWufmgx79dGhWI+ X-Received: by 2002:a05:6402:1686:: with SMTP id a6mr1511327edv.174.1570602098791; Tue, 08 Oct 2019 23:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570602098; cv=none; d=google.com; s=arc-20160816; b=ep0+KM7h2/E9e60YjFGi63qDufZAXGCQDJK190WJXFhYVagQmpIuxpDld6alrWqbzj zw4Odl2KNT5e6DxtmGlNS9Ybg7vi4TbUhKEGi40470l2rTJvAAQTYDm6PWimy+9fXYBm qF5Nr6AkHMROCqwax4lC/AywwMtGdbCTjo/5sjgp8Iis1/n1AsoPntbMzELvw4jzhVta jB6dn4OwEztsb/D+b7NbV0DvNeQBE3uoImp+zuWluBrYr3CHHNS0pQOEL1jV0lvSYevS 1CUneoxqhbOUtbFxmSqF+2a6+OU0+9hB83ALklsBnhybr5E1sf714HhI/sjlTNC6Gi6m zmQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=Xp7NswrP5hvR8M4NCwY1KT367uGlAFZeReVZ9zjfK+0=; b=CJE9ptaUul1bgd3wBmh8OW3NOC1869zpsaPFleaSzPysvIy90rX9wkwXyim6AzvDE3 F4TKjbonEfKPGHqaYAN1EFVT2NRp6xcjcuNh+gObjX3qF+bgwDzGzd30Z0kLqEKrA6KM I0b5gKwniE6LK1gWhbOlgqa7DVhmrDogYbvYvIi/nPcu9T7xgeovcRJ+no34bfowDaoG fTr/wRi0gP1zfy40CEzJ+9SMDhzzBzdZTxPbuuCkrY4EYBtBgxdxeKSD/53kzQ79DXzc w9fYeCr/JwRwLkY/hdphMdlkkNk1EgERWD57iuoJrCRpfTQxh+4PE1xaAITlrrWQXEUg HzgA== 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=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p9si755878edc.96.2019.10.08.23.21.12; Tue, 08 Oct 2019 23:21:38 -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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727355AbfJIGU4 (ORCPT + 99 others); Wed, 9 Oct 2019 02:20:56 -0400 Received: from inva020.nxp.com ([92.121.34.13]:50952 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726254AbfJIGU4 (ORCPT ); Wed, 9 Oct 2019 02:20:56 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id C16261A0394; Wed, 9 Oct 2019 08:20:52 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E1DAC1A00A7; Wed, 9 Oct 2019 08:20:47 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id B22D7402EC; Wed, 9 Oct 2019 14:20:41 +0800 (SGT) From: Anson Huang To: gregkh@linuxfoundation.org, 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 Cc: Linux-imx@nxp.com Subject: [PATCH] tty: serial: imx: Only get second/third IRQ when there is more than one IRQ Date: Wed, 9 Oct 2019 14:18:31 +0800 Message-Id: <1570601911-9162-1-git-send-email-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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; + } sport->port.dev = &pdev->dev; sport->port.mapbase = res->start; -- 2.7.4