Skip to content

Commit 4f50d3a

Browse files
peter50216gregkh
authored andcommitted
tty: serial: 8250_mtk: always resume the device in probe.
commit 100bc3e upstream. 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 <pihsun@chromium.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c106394 commit 4f50d3a

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

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

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

223223
platform_set_drvdata(pdev, data);
224224

225-
pm_runtime_enable(&pdev->dev);
226-
if (!pm_runtime_enabled(&pdev->dev)) {
227-
err = mtk8250_runtime_resume(&pdev->dev);
228-
if (err)
229-
return err;
230-
}
225+
err = mtk8250_runtime_resume(&pdev->dev);
226+
if (err)
227+
return err;
231228

232229
data->line = serial8250_register_8250_port(&uart);
233230
if (data->line < 0)
234231
return data->line;
235232

233+
pm_runtime_set_active(&pdev->dev);
234+
pm_runtime_enable(&pdev->dev);
235+
236236
return 0;
237237
}
238238

@@ -243,13 +243,11 @@ static int mtk8250_remove(struct platform_device *pdev)
243243
pm_runtime_get_sync(&pdev->dev);
244244

245245
serial8250_unregister_port(data->line);
246+
mtk8250_runtime_suspend(&pdev->dev);
246247

247248
pm_runtime_disable(&pdev->dev);
248249
pm_runtime_put_noidle(&pdev->dev);
249250

250-
if (!pm_runtime_status_suspended(&pdev->dev))
251-
mtk8250_runtime_suspend(&pdev->dev);
252-
253251
return 0;
254252
}
255253

0 commit comments

Comments
 (0)