msm_serial_hs: modify uart driver to prevent race between timer calls

In some of the cases when UART submits sps transfer request, BAM finishes
transfer quickly. This results into deletion of Tx timeout timer from an
ISR context whereas in actual timer is not yet started. In such cases
del_timer and mod_timer are meeting to a race where mod_timer finds a
NULL handle due to deletion by del_timer.

Change the timer call sequence to submit the timer first and then do a
BAM transfer.

Change-Id: I1d75a43d928776eb24752fd97d0ef31e0d5b6a51
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
This commit is contained in:
Mukesh Kumar Savaliya 2017-03-14 13:22:20 +05:30
parent c1ef16be6d
commit d34b191ac1

View file

@ -3,7 +3,7 @@
* MSM 7k High speed uart driver * MSM 7k High speed uart driver
* *
* Copyright (c) 2008 Google Inc. * Copyright (c) 2008 Google Inc.
* Copyright (c) 2007-2016, The Linux Foundation. All rights reserved. * Copyright (c) 2007-2017, The Linux Foundation. All rights reserved.
* Modified: Nick Pelly <npelly@google.com> * Modified: Nick Pelly <npelly@google.com>
* *
* All source code in this file is licensed under the following license * All source code in this file is licensed under the following license
@ -1436,13 +1436,13 @@ static void msm_hs_submit_tx_locked(struct uart_port *uport)
hex_dump_ipc(msm_uport, tx->ipc_tx_ctxt, "Tx", hex_dump_ipc(msm_uport, tx->ipc_tx_ctxt, "Tx",
&tx_buf->buf[tx_buf->tail], (u64)src_addr, tx_count); &tx_buf->buf[tx_buf->tail], (u64)src_addr, tx_count);
sps_pipe_handle = tx->cons.pipe_handle; sps_pipe_handle = tx->cons.pipe_handle;
/* Queue transfer request to SPS */
ret = sps_transfer_one(sps_pipe_handle, src_addr, tx_count,
msm_uport, flags);
/* Set 1 second timeout */ /* Set 1 second timeout */
mod_timer(&tx->tx_timeout_timer, mod_timer(&tx->tx_timeout_timer,
jiffies + msecs_to_jiffies(MSEC_PER_SEC)); jiffies + msecs_to_jiffies(MSEC_PER_SEC));
/* Queue transfer request to SPS */
ret = sps_transfer_one(sps_pipe_handle, src_addr, tx_count,
msm_uport, flags);
MSM_HS_DBG("%s:Enqueue Tx Cmd, ret %d\n", __func__, ret); MSM_HS_DBG("%s:Enqueue Tx Cmd, ret %d\n", __func__, ret);
} }