serial/8250_dw: use platform_get_irq() instead of platform_get_resource()
authorAlexey Brodkin <Alexey.Brodkin@synopsys.com>
Tue, 3 Mar 2015 15:11:14 +0000 (18:11 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Mar 2015 02:58:57 +0000 (03:58 +0100)
It is not recommened to use platform_get_resource(pdev, IORESOURCE_IRQ)
for requesting IRQ's resources any more, as they can be not ready yet in
case of DT-booting.

platform_get_irq() instead is a recommended way for getting IRQ even if
it was not retrieved earlier.

It also makes code simpler because we're getting "int" value right away
and no conversion from resource to int is required.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Alan Cox <alan@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_dw.c

index f426acc8c6b5efdbd62e616fc1ef0cc496a08098..06933e8826a1f383aa76cedc96bb3bb35abb3389 100644 (file)
@@ -384,18 +384,24 @@ static int dw8250_probe(struct platform_device *pdev)
 {
        struct uart_8250_port uart = {};
        struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+       int irq = platform_get_irq(pdev, 0);
        struct dw8250_data *data;
        int err;
 
-       if (!regs || !irq) {
-               dev_err(&pdev->dev, "no registers/irq defined\n");
+       if (!regs) {
+               dev_err(&pdev->dev, "no registers defined\n");
                return -EINVAL;
        }
 
+       if (irq < 0) {
+               if (irq != -EPROBE_DEFER)
+                       dev_err(&pdev->dev, "cannot get irq\n");
+               return irq;
+       }
+
        spin_lock_init(&uart.port.lock);
        uart.port.mapbase = regs->start;
-       uart.port.irq = irq->start;
+       uart.port.irq = irq;
        uart.port.handle_irq = dw8250_handle_irq;
        uart.port.pm = dw8250_do_pm;
        uart.port.type = PORT_8250;
This page took 0.041964 seconds and 5 git commands to generate.