serial: omap: set dev->drvdata before enabling pm_runtime
authorFelipe Balbi <balbi@ti.com>
Thu, 6 Sep 2012 12:45:27 +0000 (15:45 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Sep 2012 16:17:01 +0000 (09:17 -0700)
by the time we call our first pm_runtme_get_sync()
after enable pm_runtime, our resume method might
be called. To avoid problems, we must make sure
that our dev->drvdata is set correctly before
our resume method gets called.

Tested-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/omap-serial.c

index b2043df42a4fca9bc9efd7794c7f425a6ecaa5d3..8a696a4efbee733237583a46a9ecd980a65f4479 100644 (file)
@@ -1333,6 +1333,7 @@ static int serial_omap_probe(struct platform_device *pdev)
        serial_omap_uart_wq = create_singlethread_workqueue(up->name);
        INIT_WORK(&up->qos_work, serial_omap_uart_qos_work);
 
+       platform_set_drvdata(pdev, up);
        pm_runtime_use_autosuspend(&pdev->dev);
        pm_runtime_set_autosuspend_delay(&pdev->dev,
                        omap_up_info->autosuspend_timeout);
@@ -1352,7 +1353,6 @@ static int serial_omap_probe(struct platform_device *pdev)
 
        pm_runtime_mark_last_busy(up->dev);
        pm_runtime_put_autosuspend(up->dev);
-       platform_set_drvdata(pdev, up);
        return 0;
 
 err_add_port: