Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1092584ybg; Sat, 26 Oct 2019 12:47:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLTP12wHKnBikFB7FMZLUA8OejaepvAKWkCtLFwgBnrdNEZyYvLNXKl8kZ9FVGfluAfoa7 X-Received: by 2002:a50:8969:: with SMTP id f38mr11020333edf.211.1572119228498; Sat, 26 Oct 2019 12:47:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572119228; cv=none; d=google.com; s=arc-20160816; b=e8BzsaFTpv9xsrfrztARazWIg1nurbHDEu6f29PJGW9ITSYdcedzUurTE45kCuiuI+ vWOw2RXjOpOOsLryGS+1eYRqrT8+8zjahDisz5dZaLQoCuOWKDVNJUCxR3suH31aOKRz 0iwbCPoY47A/mbxdh9cvrQT3W/KW6+zUfMfzIFvNM+J12RKvmdjvdskf302nRJA9DP2i wXMZN9VDpXIsZQonY8y92TgB9rgTORMquyTWC746FWWjWAswhfE/8zbR7gQDUayusoJX 4g+q5mU/ThQqUzYEB15q1NNGaSMgvL5dbpiJBKcTgol9YgrUdAaI5OCWdyhgaLCxKpsy Ymcg== 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=q/Xx2VG+4GUbGwksnqJxesAvACtxXBP4fwjFj2YSe6o=; b=iiUD0VeaCF87bEr/ww9W74y4QyJX+zE2mNz24qVHZwtYNUxsbq30KheMPEhdntr6gF juMCqMoanvGvsM6x7UHg4zYRb8LzGclbZkeXgAFNm11JCogXSRPBbsKGVa5X6oK0B+Qj wF4nj10ms9TD3xGnf11s3lT3mK3HfqLcgPT8MJwdQ6qtudy85IzKi4DbjMlXdlElh3ah IbXrjLD39WQZqqrvxZWjdyKyXxbWkvFo9/MUOQn+/BdQGyJHnyvRQjgvtWIccLAty3f1 IGJn4J3L28DebWmY41j8O+0KW5eCIzYQbEeN0Qf7NZR6JfopKeXFgwlWa+OmDhVsPSSW JaKw== 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 qx23si3607793ejb.217.2019.10.26.12.46.44; Sat, 26 Oct 2019 12:47: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 S1726525AbfJZTp4 (ORCPT + 99 others); Sat, 26 Oct 2019 15:45:56 -0400 Received: from mxwww.masterlogin.de ([95.129.51.220]:42442 "EHLO mxwww.masterlogin.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726350AbfJZTp4 (ORCPT ); Sat, 26 Oct 2019 15:45:56 -0400 Received: from mxout1.routing.net (unknown [192.168.10.81]) by new.mxwww.masterlogin.de (Postfix) with ESMTPS id E6DEC96433; Sat, 26 Oct 2019 19:45:52 +0000 (UTC) Received: from mxbox2.masterlogin.de (unknown [192.168.10.89]) by mxout1.routing.net (Postfix) with ESMTP id 51D2543C00; Sat, 26 Oct 2019 19:45:53 +0000 (UTC) Received: from localhost.localdomain (fttx-pool-80.208.211.177.bambit.de [80.208.211.177]) by mxbox2.masterlogin.de (Postfix) with ESMTPSA id D9DED1005F5; Sat, 26 Oct 2019 19:45:52 +0000 (UTC) From: Frank Wunderlich To: linux-mediatek@lists.infradead.org Cc: Frank Wunderlich , Greg Kroah-Hartman , Matthias Brugger , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH,RESEND] serial: 8250-mtk: Ask for IRQ-count before request one Date: Sat, 26 Oct 2019 21:45:22 +0200 Message-Id: <20191026194522.28293-1-frank-w@public-files.de> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org at least on bananapi-r2 we have only 1 IRQ and need to check for IRQ-count to fix following Errors during probe: [ 4.935780] mt6577-uart 11004000.serial: IRQ index 1 not found [ 4.962589] 11002000.serial: ttyS1 at MMIO 0x11002000 (irq = 202, base_baud = 1625000) is a ST16650V2 [ 4.972127] mt6577-uart 11002000.serial: IRQ index 1 not found [ 4.998927] 11003000.serial: ttyS2 at MMIO 0x11003000 (irq = 203, base_baud = 1625000) is a ST16650V2 [ 5.008474] mt6577-uart 11003000.serial: IRQ index 1 not found based on Patch from Anson Huang https://patchwork.ozlabs.org/patch/1164500/ Signed-off-by: Frank Wunderlich --- drivers/tty/serial/8250/8250_mtk.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c index b411ba4eb5e9..bf250187928a 100644 --- a/drivers/tty/serial/8250/8250_mtk.c +++ b/drivers/tty/serial/8250/8250_mtk.c @@ -485,6 +485,7 @@ static int mtk8250_probe(struct platform_device *pdev) struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); struct mtk8250_data *data; + int irq_count; int err; if (!regs || !irq) { @@ -544,7 +545,15 @@ static int mtk8250_probe(struct platform_device *pdev) pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); - data->rx_wakeup_irq = platform_get_irq(pdev, 1); + irq_count = platform_irq_count(pdev); + if (irq_count < 0) + return irq_count; + + if (irq_count > 1) { + data->rx_wakeup_irq = platform_get_irq(pdev, 1); + if (data->rx_wakeup_irq < 0) + data->rx_wakeup_irq = 0; + } return 0; } -- 2.17.1