Skip to content

Commit cdbe654

Browse files
tmlindgregkh
authored andcommitted
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: 61929cf ("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>
1 parent 64b4718 commit cdbe654

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

drivers/tty/serial/8250/8250_omap.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,8 @@ static int omap8250_probe(struct platform_device *pdev)
12351235
pm_runtime_put_autosuspend(&pdev->dev);
12361236
return 0;
12371237
err:
1238-
pm_runtime_put(&pdev->dev);
1238+
pm_runtime_dont_use_autosuspend(&pdev->dev);
1239+
pm_runtime_put_sync(&pdev->dev);
12391240
pm_runtime_disable(&pdev->dev);
12401241
return ret;
12411242
}
@@ -1244,6 +1245,7 @@ static int omap8250_remove(struct platform_device *pdev)
12441245
{
12451246
struct omap8250_priv *priv = platform_get_drvdata(pdev);
12461247

1248+
pm_runtime_dont_use_autosuspend(&pdev->dev);
12471249
pm_runtime_put_sync(&pdev->dev);
12481250
pm_runtime_disable(&pdev->dev);
12491251
serial8250_unregister_port(priv->line);
@@ -1343,6 +1345,10 @@ static int omap8250_runtime_suspend(struct device *dev)
13431345
struct omap8250_priv *priv = dev_get_drvdata(dev);
13441346
struct uart_8250_port *up;
13451347

1348+
/* In case runtime-pm tries this before we are setup */
1349+
if (!priv)
1350+
return 0;
1351+
13461352
up = serial8250_get_port(priv->line);
13471353
/*
13481354
* When using 'no_console_suspend', the console UART must not be

0 commit comments

Comments
 (0)