Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 289044
b: refs/heads/master
c: e18045e
h: refs/heads/master
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Greg Kroah-Hartman committed Feb 9, 2012
1 parent 3419fb4 commit 1fef7ea
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 43ba1100af11f34cc67bdf6b359667cfa851e6a8
refs/heads/master: e18045ed75ec682a26a385b0072dcc030fd12a7e
23 changes: 22 additions & 1 deletion trunk/drivers/staging/iio/industrialio-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/kernel.h>
#include <linux/kfifo.h>
#include <linux/module.h>
#include <linux/poll.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
Expand Down Expand Up @@ -57,14 +58,33 @@ int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp)

copied = kfifo_put(&ev_int->det_events, &ev);
if (copied != 0)
wake_up_locked(&ev_int->wait);
wake_up_locked_poll(&ev_int->wait, POLLIN);
}
spin_unlock(&ev_int->wait.lock);

return 0;
}
EXPORT_SYMBOL(iio_push_event);

/**
* iio_event_poll() - poll the event queue to find out if it has data
*/
static unsigned int iio_event_poll(struct file *filep,
struct poll_table_struct *wait)
{
struct iio_event_interface *ev_int = filep->private_data;
unsigned int events = 0;

poll_wait(filep, &ev_int->wait, wait);

spin_lock(&ev_int->wait.lock);
if (!kfifo_is_empty(&ev_int->det_events))
events = POLLIN | POLLRDNORM;
spin_unlock(&ev_int->wait.lock);

return events;
}

static ssize_t iio_event_chrdev_read(struct file *filep,
char __user *buf,
size_t count,
Expand Down Expand Up @@ -118,6 +138,7 @@ static int iio_event_chrdev_release(struct inode *inode, struct file *filep)

static const struct file_operations iio_event_chrdev_fileops = {
.read = iio_event_chrdev_read,
.poll = iio_event_poll,
.release = iio_event_chrdev_release,
.owner = THIS_MODULE,
.llseek = noop_llseek,
Expand Down

0 comments on commit 1fef7ea

Please sign in to comment.