Commit 9aabcbc0 authored by Michal Simek's avatar Michal Simek Committed by Zefan Li

serial: xilinx: Use platform_get_irq to get irq description structure

commit 5c90c07b 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: default avatarMichal Simek <michal.simek@xilinx.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: default avatarZefan Li <lizefan@huawei.com>
parent c2f1b991
...@@ -573,7 +573,8 @@ MODULE_DEVICE_TABLE(of, ulite_of_match); ...@@ -573,7 +573,8 @@ MODULE_DEVICE_TABLE(of, ulite_of_match);
static int __devinit ulite_probe(struct platform_device *pdev) static int __devinit ulite_probe(struct platform_device *pdev)
{ {
struct resource *res, *res2; struct resource *res;
int irq;
int id = pdev->id; int id = pdev->id;
#ifdef CONFIG_OF #ifdef CONFIG_OF
const __be32 *prop; const __be32 *prop;
...@@ -587,11 +588,11 @@ static int __devinit ulite_probe(struct platform_device *pdev) ...@@ -587,11 +588,11 @@ static int __devinit ulite_probe(struct platform_device *pdev)
if (!res) if (!res)
return -ENODEV; return -ENODEV;
res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0); irq = platform_get_irq(pdev, 0);
if (!res2) if (irq <= 0)
return -ENODEV; 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) static int __devexit ulite_remove(struct platform_device *pdev)
......
...@@ -941,9 +941,9 @@ static struct uart_driver xuartps_uart_driver = { ...@@ -941,9 +941,9 @@ static struct uart_driver xuartps_uart_driver = {
**/ **/
static int __devinit xuartps_probe(struct platform_device *pdev) static int __devinit xuartps_probe(struct platform_device *pdev)
{ {
int rc; int rc, irq;
struct uart_port *port; struct uart_port *port;
struct resource *res, *res2; struct resource *res;
int clk = 0; int clk = 0;
#ifdef CONFIG_OF #ifdef CONFIG_OF
...@@ -964,9 +964,9 @@ static int __devinit xuartps_probe(struct platform_device *pdev) ...@@ -964,9 +964,9 @@ static int __devinit xuartps_probe(struct platform_device *pdev)
if (!res) if (!res)
return -ENODEV; return -ENODEV;
res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0); irq = platform_get_irq(pdev, 0);
if (!res2) if (irq <= 0)
return -ENODEV; return -ENXIO;
/* Initialize the port structure */ /* Initialize the port structure */
port = xuartps_get_port(); port = xuartps_get_port();
...@@ -980,7 +980,7 @@ static int __devinit xuartps_probe(struct platform_device *pdev) ...@@ -980,7 +980,7 @@ static int __devinit xuartps_probe(struct platform_device *pdev)
* and triggers invocation of the config_port() entry point. * and triggers invocation of the config_port() entry point.
*/ */
port->mapbase = res->start; port->mapbase = res->start;
port->irq = res2->start; port->irq = irq;
port->dev = &pdev->dev; port->dev = &pdev->dev;
port->uartclk = clk; port->uartclk = clk;
dev_set_drvdata(&pdev->dev, port); dev_set_drvdata(&pdev->dev, port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment