aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Shih <pihsun@chromium.org>2018-11-26 23:49:50 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-05 05:31:21 -0500
commit100bc3e2bebf95506da57cbdf5f26b25f6da4c81 (patch)
tree26f1993d0acaf1c4e4a504428524244e66534fd1
parent2a48602615e0a2f563549c7d5c8d507f904cf96e (diff)
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 68e5fc4a255a ("tty: serial: 8250_mtk: use pm_runtime callbacks for enabling"), but still use pm_runtime callbacks. Fixes: 68e5fc4a255a ("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>
-rw-r--r--drivers/tty/serial/8250/8250_mtk.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index dd5e1cede2b5..c3f933d10295 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -213,17 +213,17 @@ static int mtk8250_probe(struct platform_device *pdev)
213 213
214 platform_set_drvdata(pdev, data); 214 platform_set_drvdata(pdev, data);
215 215
216 pm_runtime_enable(&pdev->dev); 216 err = mtk8250_runtime_resume(&pdev->dev);
217 if (!pm_runtime_enabled(&pdev->dev)) { 217 if (err)
218 err = mtk8250_runtime_resume(&pdev->dev); 218 return err;
219 if (err)
220 return err;
221 }
222 219
223 data->line = serial8250_register_8250_port(&uart); 220 data->line = serial8250_register_8250_port(&uart);
224 if (data->line < 0) 221 if (data->line < 0)
225 return data->line; 222 return data->line;
226 223
224 pm_runtime_set_active(&pdev->dev);
225 pm_runtime_enable(&pdev->dev);
226
227 return 0; 227 return 0;
228} 228}
229 229
@@ -234,13 +234,11 @@ static int mtk8250_remove(struct platform_device *pdev)
234 pm_runtime_get_sync(&pdev->dev); 234 pm_runtime_get_sync(&pdev->dev);
235 235
236 serial8250_unregister_port(data->line); 236 serial8250_unregister_port(data->line);
237 mtk8250_runtime_suspend(&pdev->dev);
237 238
238 pm_runtime_disable(&pdev->dev); 239 pm_runtime_disable(&pdev->dev);
239 pm_runtime_put_noidle(&pdev->dev); 240 pm_runtime_put_noidle(&pdev->dev);
240 241
241 if (!pm_runtime_status_suspended(&pdev->dev))
242 mtk8250_runtime_suspend(&pdev->dev);
243
244 return 0; 242 return 0;
245} 243}
246 244