{
struct iio_event_interface *ev_int = indio_dev->event_interface;
struct iio_event_data ev;
+ unsigned long flags;
int copied;
/* Does anyone care? */
- spin_lock(&ev_int->wait.lock);
+ spin_lock_irqsave(&ev_int->wait.lock, flags);
if (test_bit(IIO_BUSY_BIT_POS, &ev_int->flags)) {
ev.id = ev_code;
if (copied != 0)
wake_up_locked_poll(&ev_int->wait, POLLIN);
}
- spin_unlock(&ev_int->wait.lock);
+ spin_unlock_irqrestore(&ev_int->wait.lock, flags);
return 0;
}
poll_wait(filep, &ev_int->wait, wait);
- spin_lock(&ev_int->wait.lock);
+ spin_lock_irq(&ev_int->wait.lock);
if (!kfifo_is_empty(&ev_int->det_events))
events = POLLIN | POLLRDNORM;
- spin_unlock(&ev_int->wait.lock);
+ spin_unlock_irq(&ev_int->wait.lock);
return events;
}
if (count < sizeof(struct iio_event_data))
return -EINVAL;
- spin_lock(&ev_int->wait.lock);
+ spin_lock_irq(&ev_int->wait.lock);
if (kfifo_is_empty(&ev_int->det_events)) {
if (filep->f_flags & O_NONBLOCK) {
ret = -EAGAIN;
goto error_unlock;
}
/* Blocking on device; waiting for something to be there */
- ret = wait_event_interruptible_locked(ev_int->wait,
+ ret = wait_event_interruptible_locked_irq(ev_int->wait,
!kfifo_is_empty(&ev_int->det_events));
if (ret)
goto error_unlock;
ret = kfifo_to_user(&ev_int->det_events, buf, count, &copied);
error_unlock:
- spin_unlock(&ev_int->wait.lock);
+ spin_unlock_irq(&ev_int->wait.lock);
return ret ? ret : copied;
}
{
struct iio_event_interface *ev_int = filep->private_data;
- spin_lock(&ev_int->wait.lock);
+ spin_lock_irq(&ev_int->wait.lock);
__clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags);
/*
* In order to maintain a clean state for reopening,
* any new __iio_push_event calls running.
*/
kfifo_reset_out(&ev_int->det_events);
- spin_unlock(&ev_int->wait.lock);
+ spin_unlock_irq(&ev_int->wait.lock);
return 0;
}
if (ev_int == NULL)
return -ENODEV;
- spin_lock(&ev_int->wait.lock);
+ spin_lock_irq(&ev_int->wait.lock);
if (__test_and_set_bit(IIO_BUSY_BIT_POS, &ev_int->flags)) {
- spin_unlock(&ev_int->wait.lock);
+ spin_unlock_irq(&ev_int->wait.lock);
return -EBUSY;
}
- spin_unlock(&ev_int->wait.lock);
+ spin_unlock_irq(&ev_int->wait.lock);
fd = anon_inode_getfd("iio:event",
&iio_event_chrdev_fileops, ev_int, O_RDONLY);
if (fd < 0) {
- spin_lock(&ev_int->wait.lock);
+ spin_lock_irq(&ev_int->wait.lock);
__clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags);
- spin_unlock(&ev_int->wait.lock);
+ spin_unlock_irq(&ev_int->wait.lock);
}
return fd;
}