]> git.karo-electronics.de Git - linux-beck.git/commitdiff
iio:magnetometer:bmc150_magn: expand mutex in trigger_handler
authorHartmut Knaack <knaack.h@gmx.de>
Fri, 17 Jul 2015 08:52:30 +0000 (10:52 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 2 Aug 2015 17:03:30 +0000 (18:03 +0100)
Keep the mutex locked, until the content of data->buffer has been pushed
out.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/magnetometer/bmc150_magn.c

index 074a99da7367305d2beb09503192a992e462b822..324412d51cf8efb7cf9071fe939c3c81dad0ff7a 100644 (file)
@@ -664,7 +664,6 @@ static irqreturn_t bmc150_magn_trigger_handler(int irq, void *p)
 
        mutex_lock(&data->mutex);
        ret = bmc150_magn_read_xyz(data, data->buffer);
-       mutex_unlock(&data->mutex);
        if (ret < 0)
                goto err;
 
@@ -672,6 +671,7 @@ static irqreturn_t bmc150_magn_trigger_handler(int irq, void *p)
                                           pf->timestamp);
 
 err:
+       mutex_unlock(&data->mutex);
        iio_trigger_notify_done(indio_dev->trig);
 
        return IRQ_HANDLED;