Skip to content

Commit 100bc3e

Browse files
peter50216gregkh
authored andcommitted
tty: serial: 8250_mtk: always resume the device in probe.
serial8250_register_8250_port calls uart_config_port, which calls config_port on the port before it tries to power on the port. So we need the port to be on before calling serial8250_register_8250_port. Change the code to always do a runtime resume in probe before registering port, and always do a runtime suspend in remove. This basically reverts the change in commit 68e5fc4 ("tty: serial: 8250_mtk: use pm_runtime callbacks for enabling"), but still use pm_runtime callbacks. Fixes: 68e5fc4 ("tty: serial: 8250_mtk: use pm_runtime callbacks for enabling") Signed-off-by: Peter Shih <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2a48602 commit 100bc3e

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

drivers/tty/serial/8250/8250_mtk.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,17 +213,17 @@ static int mtk8250_probe(struct platform_device *pdev)
213213

214214
platform_set_drvdata(pdev, data);
215215

216-
pm_runtime_enable(&pdev->dev);
217-
if (!pm_runtime_enabled(&pdev->dev)) {
218-
err = mtk8250_runtime_resume(&pdev->dev);
219-
if (err)
220-
return err;
221-
}
216+
err = mtk8250_runtime_resume(&pdev->dev);
217+
if (err)
218+
return err;
222219

223220
data->line = serial8250_register_8250_port(&uart);
224221
if (data->line < 0)
225222
return data->line;
226223

224+
pm_runtime_set_active(&pdev->dev);
225+
pm_runtime_enable(&pdev->dev);
226+
227227
return 0;
228228
}
229229

@@ -234,13 +234,11 @@ static int mtk8250_remove(struct platform_device *pdev)
234234
pm_runtime_get_sync(&pdev->dev);
235235

236236
serial8250_unregister_port(data->line);
237+
mtk8250_runtime_suspend(&pdev->dev);
237238

238239
pm_runtime_disable(&pdev->dev);
239240
pm_runtime_put_noidle(&pdev->dev);
240241

241-
if (!pm_runtime_status_suspended(&pdev->dev))
242-
mtk8250_runtime_suspend(&pdev->dev);
243-
244242
return 0;
245243
}
246244

0 commit comments

Comments
 (0)