Skip to content

Commit

Permalink
ipack/devices/ipoctal: Fix race condition during Tx
Browse files Browse the repository at this point in the history
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 <agarcia@igalia.com>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Alberto Garcia authored and Greg Kroah-Hartman committed Jan 16, 2013
1 parent 8e9a4a9 commit cc83f83
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions drivers/ipack/devices/ipoctal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit cc83f83

Please sign in to comment.