diff options
author | Praneeth Bajjuri <praneeth@ti.com> | 2015-01-06 17:43:49 -0600 |
---|---|---|
committer | Praneeth Bajjuri <praneeth@ti.com> | 2015-01-06 17:43:49 -0600 |
commit | 54bdef9943fdb24d2c8a316c13aa9d7ecd62766e (patch) | |
tree | a835f72b8a9d1f616cd036e181878577f74583de /drivers/iio | |
parent | f65d6e32fd752a35adfbc1176f3afcebefd2b45f (diff) | |
parent | 8e9fc4621b1c87a425273404ff95b36bed64946b (diff) |
Merge branch 'p-android-3.14' into p-ti-linux-3.14.y-android
p-android-3.14 : forked from google android-3.14 and maintained in omapzoom
p-ti-linux-3.14.y-android : Integration branch of p-ti-linux-3.14.y-common
and p-android-3.14
* p-android-3.14: (351 commits)
xt_qtaguid: Fix boot panic
netfilter: Build fixups - kuid/kguid changes & xt_socket_get/put_sk
net: kuid/kguid build fixes
cpufreq: interactive: hold reference on global cpufreq kobject if needed
futex: Ensure get_futex_key_refs() always implies a barrier
cpufreq: interactive: Use generic get_cpu_idle_time() from cpufreq.c
fix sdio.c
video: adf: export the adf_attachment_allow symbol to modules.
power: wakeup_reason: rename irq_count to irqcount
Power: Add guard condition for maximum wakeup reasons
android: base-cfg: enable DM_VERITY (used for secureboot)
drivers: usb: gadget: 64-bit related type fixes
netfilter: xt_qtaguid: 64-bit warning fixes
Staging: android: binder: More offset validation.
POWER: fix compile warnings in log_wakeup_reason
Power: add an API to log wakeup reasons
android: configs: add systrace support to recommended configs
video: adf: use %zu when printing size_t
video: adf: fix compat ioctls calling ioctl with wrong cmd
video: adf: use ADF_IOCTL_TYPE in compat ioctl definitions
...
Conflicts:
drivers/video/Kconfig
net/Makefile
Change-Id: I9a9d8928c23e94456ef650ede4177b74535561c2
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/industrialio-event.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c index f9360f497ed..b42c2a14251 100644 --- a/drivers/iio/industrialio-event.c +++ b/drivers/iio/industrialio-event.c @@ -35,6 +35,7 @@ */ struct iio_event_interface { wait_queue_head_t wait; + struct mutex read_lock; DECLARE_KFIFO(det_events, struct iio_event_data, 16); struct list_head dev_attr_list; @@ -111,14 +112,16 @@ static ssize_t iio_event_chrdev_read(struct file *filep, if (count < sizeof(struct iio_event_data)) return -EINVAL; - spin_lock_irq(&ev_int->wait.lock); + if (mutex_lock_interruptible(&ev_int->read_lock)) + return -ERESTARTSYS; + 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_irq(ev_int->wait, + ret = wait_event_interruptible(ev_int->wait, !kfifo_is_empty(&ev_int->det_events) || indio_dev->info == NULL); if (ret) @@ -133,7 +136,7 @@ static ssize_t iio_event_chrdev_read(struct file *filep, ret = kfifo_to_user(&ev_int->det_events, buf, count, &copied); error_unlock: - spin_unlock_irq(&ev_int->wait.lock); + mutex_unlock(&ev_int->read_lock); return ret ? ret : copied; } @@ -428,6 +431,7 @@ static void iio_setup_ev_int(struct iio_event_interface *ev_int) { INIT_KFIFO(ev_int->det_events); init_waitqueue_head(&ev_int->wait); + mutex_init(&ev_int->read_lock); } static const char *iio_event_group_name = "events"; @@ -491,6 +495,7 @@ int iio_device_register_eventset(struct iio_dev *indio_dev) error_free_setup_event_lines: iio_free_chan_devattr_list(&indio_dev->event_interface->dev_attr_list); + mutex_destroy(&indio_dev->event_interface->read_lock); kfree(indio_dev->event_interface); error_ret: @@ -517,5 +522,6 @@ void iio_device_unregister_eventset(struct iio_dev *indio_dev) return; iio_free_chan_devattr_list(&indio_dev->event_interface->dev_attr_list); kfree(indio_dev->event_interface->group.attrs); + mutex_destroy(&indio_dev->event_interface->read_lock); kfree(indio_dev->event_interface); } |