From a39bdb236edfdec694f8229d511eee400994bafd Mon Sep 17 00:00:00 2001 From: Arjan van de Ven Date: Thu, 17 Jun 2010 11:02:06 +0100 Subject: [PATCH] --- yaml --- r: 207879 b: refs/heads/master c: 68c16b4117cc746a91897d629b61e5f2af18c225 h: refs/heads/master i: 207877: 188c45cc8ef4e02efe93e3fa505a73f4f1bd743e 207875: f9c96f0d0c15e92e66a5a259d0c9d637acd77d17 207871: e428368543ab352ea9e68b8304d5fa43fee9c8e7 v: v3 --- [refs] | 2 +- trunk/drivers/serial/mrst_max3110.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index 586827ab8175..f05c094648ec 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 99dd3f6b7e2ef5179f67503a401a99141708687a +refs/heads/master: 68c16b4117cc746a91897d629b61e5f2af18c225 diff --git a/trunk/drivers/serial/mrst_max3110.c b/trunk/drivers/serial/mrst_max3110.c index f9c01aeb6f80..0341853e0c28 100644 --- a/trunk/drivers/serial/mrst_max3110.c +++ b/trunk/drivers/serial/mrst_max3110.c @@ -56,8 +56,7 @@ struct uart_max3110 { wait_queue_head_t wq; struct task_struct *main_thread; struct task_struct *read_thread; - int mthread_up; - spinlock_t lock; + struct mutex thread_mutex;; u32 baud; u16 cur_conf; @@ -397,7 +396,8 @@ static int max3110_main_thread(void *_max) atomic_read(&max->con_tx_need) || atomic_read(&max->uart_tx_need)) || kthread_should_stop()); - max->mthread_up = 1; + + mutex_lock(&max->thread_mutex); #ifdef CONFIG_MRST_MAX3110_IRQ if (atomic_read(&max->irq_pending)) { @@ -417,7 +417,7 @@ static int max3110_main_thread(void *_max) transmit_char(max); atomic_set(&max->uart_tx_need, 0); } - max->mthread_up = 0; + mutex_unlock(&max->thread_mutex); } while (!kthread_should_stop()); return ret; @@ -444,8 +444,9 @@ static int max3110_read_thread(void *_max) pr_info(PR_FMT "start read thread\n"); do { - if (!max->mthread_up) - max3110_console_receive(max); + mutex_lock(&max->thread_mutex); + max3110_console_receive(max); + mutex_unlock(&max->thread_mutex); set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(HZ / 20); @@ -745,7 +746,7 @@ static int serial_m3110_probe(struct spi_device *spi) max->name = spi->modalias; /* use spi name as the name */ max->irq = (u16)spi->irq; - spin_lock_init(&max->lock); + mutex_init(&max->thread_mutex); max->word_7bits = 0; max->parity = 0;