ipack/devices/ipoctal: protect the channel data processing with a spinlock
authorSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Mon, 10 Dec 2012 10:50:05 +0000 (11:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jan 2013 02:24:38 +0000 (18:24 -0800)
We protect important data such as TX buffer pointer, nb_bytes counter and status
registers of the device, from accessing several times at the same time.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ipack/devices/ipoctal.c

index 9cd5572457ffc6108def4f360237ab4eee4f196a..5ce2c4c5bb3231a164b1ae905ef37e5811f4c174 100644 (file)
@@ -191,6 +191,8 @@ static void ipoctal_irq_channel(struct ipoctal_channel *channel)
        tty = tty_port_tty_get(&channel->tty_port);
        if (!tty)
                return;
+
+       spin_lock(&channel->lock);
        /* The HW is organized in pair of channels.  See which register we need
         * to read from */
        isr = ioread8(&channel->block_regs->r.isr);
@@ -216,6 +218,7 @@ static void ipoctal_irq_channel(struct ipoctal_channel *channel)
 
        tty_flip_buffer_push(tty);
        tty_kref_put(tty);
+       spin_unlock(&channel->lock);
 }
 
 static irqreturn_t ipoctal_irq_handler(void *arg)
This page took 0.024532 seconds and 5 git commands to generate.