Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: serial: qcom_geni_serial: Rectify UART suspend mechanism

UART driver checks for the PM state and denies suspend if state is ACTIVE.
This makes UART to deny suspend when client keeps port open which is not
correct. Instead follow framework and obey suspend-resume callbacks.

Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Mukesh Kumar Savaliya and committed by
Greg Kroah-Hartman
b1f84dd3 9f641df4

+6 -30
+6 -30
drivers/tty/serial/qcom_geni_serial.c
··· 1324 1324 return 0; 1325 1325 } 1326 1326 1327 - static int __maybe_unused qcom_geni_serial_sys_suspend_noirq(struct device *dev) 1327 + static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev) 1328 1328 { 1329 1329 struct qcom_geni_serial_port *port = dev_get_drvdata(dev); 1330 1330 struct uart_port *uport = &port->uport; 1331 1331 1332 - if (uart_console(uport)) { 1333 - uart_suspend_port(uport->private_data, uport); 1334 - } else { 1335 - struct uart_state *state = uport->state; 1336 - /* 1337 - * If the port is open, deny system suspend. 1338 - */ 1339 - if (state->pm_state == UART_PM_STATE_ON) 1340 - return -EBUSY; 1341 - } 1342 - 1343 - return 0; 1332 + return uart_suspend_port(uport->private_data, uport); 1344 1333 } 1345 1334 1346 - static int __maybe_unused qcom_geni_serial_sys_resume_noirq(struct device *dev) 1335 + static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev) 1347 1336 { 1348 1337 struct qcom_geni_serial_port *port = dev_get_drvdata(dev); 1349 1338 struct uart_port *uport = &port->uport; 1350 1339 1351 - if (uart_console(uport) && 1352 - console_suspend_enabled && uport->suspended) { 1353 - uart_resume_port(uport->private_data, uport); 1354 - /* 1355 - * uart_suspend_port() invokes port shutdown which in turn 1356 - * frees the irq. uart_resume_port invokes port startup which 1357 - * performs request_irq. The request_irq auto-enables the IRQ. 1358 - * In addition, resume_noirq implicitly enables the IRQ and 1359 - * leads to an unbalanced IRQ enable warning. Disable the IRQ 1360 - * before returning so that the warning is suppressed. 1361 - */ 1362 - disable_irq(uport->irq); 1363 - } 1364 - return 0; 1340 + return uart_resume_port(uport->private_data, uport); 1365 1341 } 1366 1342 1367 1343 static const struct dev_pm_ops qcom_geni_serial_pm_ops = { 1368 - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend_noirq, 1369 - qcom_geni_serial_sys_resume_noirq) 1344 + SET_SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend, 1345 + qcom_geni_serial_sys_resume) 1370 1346 }; 1371 1347 1372 1348 static const struct of_device_id qcom_geni_serial_match_table[] = {