From cc83f833c77c1d233e3843af18c1abf8d561d1fa Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Mon, 10 Dec 2012 11:49:57 +0100 Subject: ipack/devices/ipoctal: Fix race condition during Tx In order to transmit data, the driver enables Tx and sleeps until *board_write is set to 1 by the interrupt handler. It can happen, though, that the data is sent even before the process is asleep. In this case *board_write must be set to 1 anyway, otherwise we will be waiting for a condition that will never be true. Signed-off-by: Alberto Garcia Signed-off-by: Samuel Iglesias Gonsalvez Signed-off-by: Greg Kroah-Hartman --- drivers/ipack/devices/ipoctal.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'drivers/ipack/devices/ipoctal.c') diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c index 576d53d9267..e66135da63c 100644 --- a/drivers/ipack/devices/ipoctal.c +++ b/drivers/ipack/devices/ipoctal.c @@ -195,13 +195,10 @@ static void ipoctal_irq_tx(struct ipoctal_channel *channel) *pointer_write = *pointer_write % PAGE_SIZE; channel->nb_bytes--; - if ((channel->nb_bytes == 0) && - (waitqueue_active(&channel->queue))) { - - if (channel->board_id != IPACK1_DEVICE_ID_SBS_OCTAL_485) { - *channel->board_write = 1; - wake_up_interruptible(&channel->queue); - } + if (channel->nb_bytes == 0 && + channel->board_id != IPACK1_DEVICE_ID_SBS_OCTAL_485) { + *channel->board_write = 1; + wake_up_interruptible(&channel->queue); } } -- cgit v1.2.3-70-g09d2