Skip to content

Commit

Permalink
serial: xilinx: Use platform_get_irq to get irq description structure
Browse files Browse the repository at this point in the history
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 <michal.simek@xilinx.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Michal Simek authored and Greg Kroah-Hartman committed Apr 28, 2015
1 parent 10afbe3 commit 5c90c07
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
11 changes: 6 additions & 5 deletions drivers/tty/serial/uartlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,8 @@ MODULE_DEVICE_TABLE(of, ulite_of_match);

static int 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;
Expand All @@ -646,11 +647,11 @@ static int 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 ulite_remove(struct platform_device *pdev)
Expand Down
12 changes: 6 additions & 6 deletions drivers/tty/serial/xilinx_uartps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1331,9 +1331,9 @@ static SIMPLE_DEV_PM_OPS(cdns_uart_dev_pm_ops, cdns_uart_suspend,
*/
static int cdns_uart_probe(struct platform_device *pdev)
{
int rc, id;
int rc, id, irq;
struct uart_port *port;
struct resource *res, *res2;
struct resource *res;
struct cdns_uart *cdns_uart_data;

cdns_uart_data = devm_kzalloc(&pdev->dev, sizeof(*cdns_uart_data),
Expand Down Expand Up @@ -1380,9 +1380,9 @@ static int cdns_uart_probe(struct platform_device *pdev)
goto err_out_clk_disable;
}

res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res2) {
rc = -ENODEV;
irq = platform_get_irq(pdev, 0);
if (irq <= 0) {
rc = -ENXIO;
goto err_out_clk_disable;
}

Expand Down Expand Up @@ -1411,7 +1411,7 @@ static int cdns_uart_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_get_rate(cdns_uart_data->uartclk);
port->private_data = cdns_uart_data;
Expand Down

0 comments on commit 5c90c07

Please sign in to comment.