aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorBin Gao <bin.gao@intel.com>2013-10-08 22:39:17 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-16 16:08:16 -0400
commitb6951b8a63e8764558c066369a6317bfe15dca55 (patch)
tree326d50cf4fdbee33a3205424ea5d0b236f64aa27 /drivers/tty/serial
parent09238443c61e58f7fac8a3892b14b1bee40b4316 (diff)
serial: mrst_max3110: Fix race condition between spi transfers
There is a race between termios configuration and xmit that can cause the intel_mid_ssp_spi driver to stall. Serializing spi transactions fixes the problem. Signed-off-by: Bin Gao <bin.gao@intel.com> Signed-off-by: Feng Tang <feng.tang@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/mrst_max3110.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/tty/serial/mrst_max3110.c b/drivers/tty/serial/mrst_max3110.c
index ee77e7366ed6..565779dc7aac 100644
--- a/drivers/tty/serial/mrst_max3110.c
+++ b/drivers/tty/serial/mrst_max3110.c
@@ -61,6 +61,7 @@ struct uart_max3110 {
61 struct task_struct *main_thread; 61 struct task_struct *main_thread;
62 struct task_struct *read_thread; 62 struct task_struct *read_thread;
63 struct mutex thread_mutex; 63 struct mutex thread_mutex;
64 struct mutex io_mutex;
64 65
65 u32 baud; 66 u32 baud;
66 u16 cur_conf; 67 u16 cur_conf;
@@ -90,6 +91,7 @@ static int max3110_write_then_read(struct uart_max3110 *max,
90 struct spi_transfer x; 91 struct spi_transfer x;
91 int ret; 92 int ret;
92 93
94 mutex_lock(&max->io_mutex);
93 spi_message_init(&message); 95 spi_message_init(&message);
94 memset(&x, 0, sizeof x); 96 memset(&x, 0, sizeof x);
95 x.len = len; 97 x.len = len;
@@ -104,6 +106,7 @@ static int max3110_write_then_read(struct uart_max3110 *max,
104 106
105 /* Do the i/o */ 107 /* Do the i/o */
106 ret = spi_sync(spi, &message); 108 ret = spi_sync(spi, &message);
109 mutex_unlock(&max->io_mutex);
107 return ret; 110 return ret;
108} 111}
109 112
@@ -805,6 +808,7 @@ static int serial_m3110_probe(struct spi_device *spi)
805 max->irq = (u16)spi->irq; 808 max->irq = (u16)spi->irq;
806 809
807 mutex_init(&max->thread_mutex); 810 mutex_init(&max->thread_mutex);
811 mutex_init(&max->io_mutex);
808 812
809 max->word_7bits = 0; 813 max->word_7bits = 0;
810 max->parity = 0; 814 max->parity = 0;