From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.kernel.org ([198.145.29.136]:52421 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751823AbbIOJI5 (ORCPT ); Tue, 15 Sep 2015 05:08:57 -0400 From: lizf@kernel.org To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Simek , Greg Kroah-Hartman , Zefan Li Subject: [PATCH 3.4 064/146] serial: xilinx: Use platform_get_irq to get irq description structure Date: Tue, 15 Sep 2015 17:02:59 +0800 Message-Id: <1442307861-32031-64-git-send-email-lizf@kernel.org> In-Reply-To: <1442307787-31952-1-git-send-email-lizf@kernel.org> References: <1442307787-31952-1-git-send-email-lizf@kernel.org> Sender: stable-owner@vger.kernel.org List-ID: From: Michal Simek 3.4.109-rc1 review patch. If anyone has any objections, please let me know. ------------------ commit 5c90c07b98c02198d9777a7c4f3047b0a94bf7ed upstream. For systems with CONFIG_SERIAL_OF_PLATFORM=y and device_type = "serial"; property in DT of_serial.c driver maps and unmaps IRQ (because driver probe fails). Then a driver is called but irq mapping is not created that's why driver is failing again in again on request_irq(). Based on this use platform_get_irq() instead of platform_get_resource() which is doing irq_desc allocation and driver itself can request IRQ. Fix both xilinx serial drivers in the tree. Signed-off-by: Michal Simek Signed-off-by: Greg Kroah-Hartman [lizf: Backported to 3.4: adjust context] Signed-off-by: Zefan Li --- drivers/tty/serial/uartlite.c | 11 ++++++----- drivers/tty/serial/xilinx_uartps.c | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c index 6cd4143..d9706e7 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c @@ -573,7 +573,8 @@ MODULE_DEVICE_TABLE(of, ulite_of_match); static int __devinit ulite_probe(struct platform_device *pdev) { - struct resource *res, *res2; + struct resource *res; + int irq; int id = pdev->id; #ifdef CONFIG_OF const __be32 *prop; @@ -587,11 +588,11 @@ static int __devinit ulite_probe(struct platform_device *pdev) if (!res) return -ENODEV; - res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res2) - return -ENODEV; + irq = platform_get_irq(pdev, 0); + if (irq <= 0) + return -ENXIO; - return ulite_assign(&pdev->dev, id, res->start, res2->start); + return ulite_assign(&pdev->dev, id, res->start, irq); } static int __devexit ulite_remove(struct platform_device *pdev) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index b627363..778c39a 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -941,9 +941,9 @@ static struct uart_driver xuartps_uart_driver = { **/ static int __devinit xuartps_probe(struct platform_device *pdev) { - int rc; + int rc, irq; struct uart_port *port; - struct resource *res, *res2; + struct resource *res; int clk = 0; #ifdef CONFIG_OF @@ -964,9 +964,9 @@ static int __devinit xuartps_probe(struct platform_device *pdev) if (!res) return -ENODEV; - res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res2) - return -ENODEV; + irq = platform_get_irq(pdev, 0); + if (irq <= 0) + return -ENXIO; /* Initialize the port structure */ port = xuartps_get_port(); @@ -980,7 +980,7 @@ static int __devinit xuartps_probe(struct platform_device *pdev) * and triggers invocation of the config_port() entry point. */ port->mapbase = res->start; - port->irq = res2->start; + port->irq = irq; port->dev = &pdev->dev; port->uartclk = clk; dev_set_drvdata(&pdev->dev, port); -- 1.9.1