diff mbox

[08/13] tty: serial: omap: switch over to platform_get_resource

Message ID 1398265117-11793-8-git-send-email-balbi@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Felipe Balbi April 23, 2014, 2:58 p.m. UTC
this way we can remove one pointer declaration.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 drivers/tty/serial/omap-serial.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Fabio Estevam April 23, 2014, 3:27 p.m. UTC | #1
On Wed, Apr 23, 2014 at 11:58 AM, Felipe Balbi <balbi@ti.com> wrote:

> @@ -1658,12 +1657,9 @@ static int serial_omap_probe(struct platform_device *pdev)
>                 omap_up_info = of_get_uart_port_info(&pdev->dev);
>                 pdev->dev.platform_data = omap_up_info;
>         } else {
> -               irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> -               if (!irq) {
> -                       dev_err(&pdev->dev, "no irq resource?\n");
> -                       return -ENODEV;
> -               }
> -               uartirq = irq->start;
> +               uartirq = platform_get_irq(pdev, 0);
> +               if (uartirq < 0)
> +                       return -EPROBE_DEFER;


Maybe you could just do a 'return uartirq' here instead.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Felipe Balbi April 23, 2014, 3:49 p.m. UTC | #2
On Wed, Apr 23, 2014 at 12:27:59PM -0300, Fabio Estevam wrote:
> On Wed, Apr 23, 2014 at 11:58 AM, Felipe Balbi <balbi@ti.com> wrote:
> 
> > @@ -1658,12 +1657,9 @@ static int serial_omap_probe(struct platform_device *pdev)
> >                 omap_up_info = of_get_uart_port_info(&pdev->dev);
> >                 pdev->dev.platform_data = omap_up_info;
> >         } else {
> > -               irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> > -               if (!irq) {
> > -                       dev_err(&pdev->dev, "no irq resource?\n");
> > -                       return -ENODEV;
> > -               }
> > -               uartirq = irq->start;
> > +               uartirq = platform_get_irq(pdev, 0);
> > +               if (uartirq < 0)
> > +                       return -EPROBE_DEFER;
> 
> 
> Maybe you could just do a 'return uartirq' here instead.

I don't mind either way, I'm only returning -EPROBE_DEFER because that's
what the other branch of this conditional returns. Tony, what do you
prefer ?
diff mbox

Patch

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 3813740..cb45e88 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1644,7 +1644,6 @@  static int serial_omap_probe(struct platform_device *pdev)
 	struct omap_uart_port_info *omap_up_info = dev_get_platdata(&pdev->dev);
 	struct uart_omap_port *up;
 	struct resource *mem;
-	struct resource *irq;
 	int uartirq = 0;
 	int wakeirq = 0;
 	int ret;
@@ -1658,12 +1657,9 @@  static int serial_omap_probe(struct platform_device *pdev)
 		omap_up_info = of_get_uart_port_info(&pdev->dev);
 		pdev->dev.platform_data = omap_up_info;
 	} else {
-		irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-		if (!irq) {
-			dev_err(&pdev->dev, "no irq resource?\n");
-			return -ENODEV;
-		}
-		uartirq = irq->start;
+		uartirq = platform_get_irq(pdev, 0);
+		if (uartirq < 0)
+			return -EPROBE_DEFER;
 	}
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);