mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 20:33:58 -04:00
serial: msm-geni-serial: Update is_clock_off to atomic variable
Update is_clock_off and wakeup_enabled variable to atomic to avoid race conditions while accessing it. Change-Id: I7e792b5938befeeede60f15353be328d20c25758 Signed-off-by: Anvesh Salveru <asalveru@codeaurora.org> Signed-off-by: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
This commit is contained in:
parent
3ea3b05116
commit
1502b7f36e
1 changed files with 7 additions and 5 deletions
|
|
@ -232,7 +232,7 @@ struct msm_geni_serial_port {
|
|||
struct completion s_cmd_timeout;
|
||||
spinlock_t rx_lock;
|
||||
bool pm_auto_suspend_disable;
|
||||
bool is_clock_off;
|
||||
atomic_t is_clock_off;
|
||||
enum uart_error_code uart_error;
|
||||
};
|
||||
|
||||
|
|
@ -1268,7 +1268,7 @@ static void msm_geni_serial_start_tx(struct uart_port *uport)
|
|||
static unsigned int ios_log_limit;
|
||||
|
||||
/* when start_tx is called with UART clocks OFF return. */
|
||||
if (uart_console(uport) && msm_port->is_clock_off) {
|
||||
if (uart_console(uport) && (uport->suspended || atomic_read(&msm_port->is_clock_off))) {
|
||||
IPC_LOG_MSG(msm_port->console_log,
|
||||
"%s. Console in suspend state\n", __func__);
|
||||
return;
|
||||
|
|
@ -2166,7 +2166,7 @@ static void msm_geni_serial_handle_isr(struct uart_port *uport,
|
|||
bool s_cmd_done = false;
|
||||
bool m_cmd_done = false;
|
||||
|
||||
if (uart_console(uport) && msm_port->is_clock_off) {
|
||||
if (uart_console(uport) && atomic_read(&msm_port->is_clock_off)) {
|
||||
IPC_LOG_MSG(msm_port->console_log,
|
||||
"%s. Console in suspend state\n", __func__);
|
||||
goto exit_geni_serial_isr;
|
||||
|
|
@ -2991,11 +2991,11 @@ static void msm_geni_serial_cons_pm(struct uart_port *uport,
|
|||
|
||||
if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF) {
|
||||
se_geni_resources_on(&msm_port->serial_rsc);
|
||||
msm_port->is_clock_off = false;
|
||||
atomic_set(&msm_port->is_clock_off, 0);
|
||||
} else if (new_state == UART_PM_STATE_OFF &&
|
||||
old_state == UART_PM_STATE_ON) {
|
||||
atomic_set(&msm_port->is_clock_off, 1);
|
||||
se_geni_resources_off(&msm_port->serial_rsc);
|
||||
msm_port->is_clock_off = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3620,6 +3620,7 @@ static int msm_geni_serial_sys_suspend(struct device *dev)
|
|||
struct uart_port *uport = &port->uport;
|
||||
|
||||
if (uart_console(uport) || port->pm_auto_suspend_disable) {
|
||||
IPC_LOG_MSG(port->console_log, "%s start\n", __func__);
|
||||
uart_suspend_port((struct uart_driver *)uport->private_data,
|
||||
uport);
|
||||
IPC_LOG_MSG(port->console_log, "%s\n", __func__);
|
||||
|
|
@ -3652,6 +3653,7 @@ static int msm_geni_serial_sys_resume(struct device *dev)
|
|||
if ((uart_console(uport) &&
|
||||
console_suspend_enabled && uport->suspended) ||
|
||||
port->pm_auto_suspend_disable) {
|
||||
IPC_LOG_MSG(port->console_log, "%s start\n", __func__);
|
||||
uart_resume_port((struct uart_driver *)uport->private_data,
|
||||
uport);
|
||||
IPC_LOG_MSG(port->console_log, "%s\n", __func__);
|
||||
|
|
|
|||
Loading…
Reference in a new issue