diff options
author | Tony Lindgren <tony@atomide.com> | 2017-01-20 15:22:31 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-05-14 08:00:19 -0400 |
commit | 71fd9a94bd3fd35277c9e1cf6a373c1f7a8ec4cd (patch) | |
tree | c715d232494975e775b3b75f25b47f13ad0e1de5 | |
parent | 115fb7ec22b5422adabcd48232b68b6d2882e7f7 (diff) |
serial: 8250_omap: Fix probe and remove for PM runtime
commit 4e0f5cc65098ea32a1e77baae74215b9bd5276b1 upstream.
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: 61929cf0169d ("tty: serial: Add 8250-core based omap driver")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/8250/8250_omap.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c index f4eb807a2616..da31159a03ec 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c | |||
@@ -1237,7 +1237,8 @@ static int omap8250_probe(struct platform_device *pdev) | |||
1237 | pm_runtime_put_autosuspend(&pdev->dev); | 1237 | pm_runtime_put_autosuspend(&pdev->dev); |
1238 | return 0; | 1238 | return 0; |
1239 | err: | 1239 | err: |
1240 | pm_runtime_put(&pdev->dev); | 1240 | pm_runtime_dont_use_autosuspend(&pdev->dev); |
1241 | pm_runtime_put_sync(&pdev->dev); | ||
1241 | pm_runtime_disable(&pdev->dev); | 1242 | pm_runtime_disable(&pdev->dev); |
1242 | return ret; | 1243 | return ret; |
1243 | } | 1244 | } |
@@ -1246,6 +1247,7 @@ static int omap8250_remove(struct platform_device *pdev) | |||
1246 | { | 1247 | { |
1247 | struct omap8250_priv *priv = platform_get_drvdata(pdev); | 1248 | struct omap8250_priv *priv = platform_get_drvdata(pdev); |
1248 | 1249 | ||
1250 | pm_runtime_dont_use_autosuspend(&pdev->dev); | ||
1249 | pm_runtime_put_sync(&pdev->dev); | 1251 | pm_runtime_put_sync(&pdev->dev); |
1250 | pm_runtime_disable(&pdev->dev); | 1252 | pm_runtime_disable(&pdev->dev); |
1251 | serial8250_unregister_port(priv->line); | 1253 | serial8250_unregister_port(priv->line); |
@@ -1345,6 +1347,10 @@ static int omap8250_runtime_suspend(struct device *dev) | |||
1345 | struct omap8250_priv *priv = dev_get_drvdata(dev); | 1347 | struct omap8250_priv *priv = dev_get_drvdata(dev); |
1346 | struct uart_8250_port *up; | 1348 | struct uart_8250_port *up; |
1347 | 1349 | ||
1350 | /* In case runtime-pm tries this before we are setup */ | ||
1351 | if (!priv) | ||
1352 | return 0; | ||
1353 | |||
1348 | up = serial8250_get_port(priv->line); | 1354 | up = serial8250_get_port(priv->line); |
1349 | /* | 1355 | /* |
1350 | * When using 'no_console_suspend', the console UART must not be | 1356 | * When using 'no_console_suspend', the console UART must not be |