Commit 4e0f5cc6 authored by Tony Lindgren's avatar Tony Lindgren Committed by Greg Kroah-Hartman

serial: 8250_omap: Fix probe and remove for PM runtime

Otherwise the interconnect related code implementing PM runtime will
produce these errors on a failed probe:

omap_uart 48066000.serial: omap_device: omap_device_enable() called from invalid state 1
omap_uart 48066000.serial: use pm_runtime_put_sync_suspend() in driver?

Note that we now also need to check for priv in omap8250_runtime_suspend()
as it has not yet been registered if probe fails. And we need to use
pm_runtime_put_sync() to properly idle the device like we already do
in omap8250_remove().

Fixes: 61929cf0 ("tty: serial: Add 8250-core based omap driver")
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f99b63af
...@@ -1235,7 +1235,8 @@ static int omap8250_probe(struct platform_device *pdev) ...@@ -1235,7 +1235,8 @@ static int omap8250_probe(struct platform_device *pdev)
pm_runtime_put_autosuspend(&pdev->dev); pm_runtime_put_autosuspend(&pdev->dev);
return 0; return 0;
err: err:
pm_runtime_put(&pdev->dev); pm_runtime_dont_use_autosuspend(&pdev->dev);
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
return ret; return ret;
} }
...@@ -1244,6 +1245,7 @@ static int omap8250_remove(struct platform_device *pdev) ...@@ -1244,6 +1245,7 @@ static int omap8250_remove(struct platform_device *pdev)
{ {
struct omap8250_priv *priv = platform_get_drvdata(pdev); struct omap8250_priv *priv = platform_get_drvdata(pdev);
pm_runtime_dont_use_autosuspend(&pdev->dev);
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
serial8250_unregister_port(priv->line); serial8250_unregister_port(priv->line);
...@@ -1343,6 +1345,10 @@ static int omap8250_runtime_suspend(struct device *dev) ...@@ -1343,6 +1345,10 @@ static int omap8250_runtime_suspend(struct device *dev)
struct omap8250_priv *priv = dev_get_drvdata(dev); struct omap8250_priv *priv = dev_get_drvdata(dev);
struct uart_8250_port *up; struct uart_8250_port *up;
/* In case runtime-pm tries this before we are setup */
if (!priv)
return 0;
up = serial8250_get_port(priv->line); up = serial8250_get_port(priv->line);
/* /*
* When using 'no_console_suspend', the console UART must not be * When using 'no_console_suspend', the console UART must not be
......
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