]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.28/serial-8250_omap-fix-probe-and-remove-for-pm-runtime.patch
Remove duplicated commits
[thirdparty/kernel/stable-queue.git] / releases / 4.9.28 / serial-8250_omap-fix-probe-and-remove-for-pm-runtime.patch
CommitLineData
b74db2ac
GKH
1From 4e0f5cc65098ea32a1e77baae74215b9bd5276b1 Mon Sep 17 00:00:00 2001
2From: Tony Lindgren <tony@atomide.com>
3Date: Fri, 20 Jan 2017 12:22:31 -0800
4Subject: serial: 8250_omap: Fix probe and remove for PM runtime
5
6From: Tony Lindgren <tony@atomide.com>
7
8commit 4e0f5cc65098ea32a1e77baae74215b9bd5276b1 upstream.
9
10Otherwise the interconnect related code implementing PM runtime will
11produce these errors on a failed probe:
12
13omap_uart 48066000.serial: omap_device: omap_device_enable() called from invalid state 1
14omap_uart 48066000.serial: use pm_runtime_put_sync_suspend() in driver?
15
16Note that we now also need to check for priv in omap8250_runtime_suspend()
17as it has not yet been registered if probe fails. And we need to use
18pm_runtime_put_sync() to properly idle the device like we already do
19in omap8250_remove().
20
21Fixes: 61929cf0169d ("tty: serial: Add 8250-core based omap driver")
22Signed-off-by: Tony Lindgren <tony@atomide.com>
23Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25---
26 drivers/tty/serial/8250/8250_omap.c | 8 +++++++-
27 1 file changed, 7 insertions(+), 1 deletion(-)
28
29--- a/drivers/tty/serial/8250/8250_omap.c
30+++ b/drivers/tty/serial/8250/8250_omap.c
31@@ -1237,7 +1237,8 @@ static int omap8250_probe(struct platfor
32 pm_runtime_put_autosuspend(&pdev->dev);
33 return 0;
34 err:
35- pm_runtime_put(&pdev->dev);
36+ pm_runtime_dont_use_autosuspend(&pdev->dev);
37+ pm_runtime_put_sync(&pdev->dev);
38 pm_runtime_disable(&pdev->dev);
39 return ret;
40 }
41@@ -1246,6 +1247,7 @@ static int omap8250_remove(struct platfo
42 {
43 struct omap8250_priv *priv = platform_get_drvdata(pdev);
44
45+ pm_runtime_dont_use_autosuspend(&pdev->dev);
46 pm_runtime_put_sync(&pdev->dev);
47 pm_runtime_disable(&pdev->dev);
48 serial8250_unregister_port(priv->line);
49@@ -1345,6 +1347,10 @@ static int omap8250_runtime_suspend(stru
50 struct omap8250_priv *priv = dev_get_drvdata(dev);
51 struct uart_8250_port *up;
52
53+ /* In case runtime-pm tries this before we are setup */
54+ if (!priv)
55+ return 0;
56+
57 up = serial8250_get_port(priv->line);
58 /*
59 * When using 'no_console_suspend', the console UART must not be