Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325098
b: refs/heads/master
c: f38bc92
h: refs/heads/master
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Jonathan Cameron committed Sep 6, 2012
1 parent 7d27974 commit 46b2860
Show file tree
Hide file tree
Showing 3 changed files with 19 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: ed5514c925a0e1266e70630092a77bd0c89aee1f
refs/heads/master: f38bc926d022ebd67baad6ac7fc22c95fbc6238c
2 changes: 2 additions & 0 deletions trunk/drivers/staging/iio/trigger/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ config IIO_GPIO_TRIGGER
config IIO_SYSFS_TRIGGER
tristate "SYSFS trigger"
depends on SYSFS
depends on HAVE_IRQ_WORK
select IRQ_WORK
help
Provides support for using SYSFS entry as IIO triggers.
If unsure, say N (but it's safe to say "Y").
Expand Down
17 changes: 16 additions & 1 deletion trunk/drivers/staging/iio/trigger/iio-trig-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/irq_work.h>

#include <linux/iio/iio.h>
#include <linux/iio/trigger.h>

struct iio_sysfs_trig {
struct iio_trigger *trig;
struct irq_work work;
int id;
struct list_head l;
};
Expand Down Expand Up @@ -89,11 +91,21 @@ static struct device iio_sysfs_trig_dev = {
.release = &iio_trigger_sysfs_release,
};

static void iio_sysfs_trigger_work(struct irq_work *work)
{
struct iio_sysfs_trig *trig = container_of(work, struct iio_sysfs_trig,
work);

iio_trigger_poll(trig->trig, 0);
}

static ssize_t iio_sysfs_trigger_poll(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct iio_trigger *trig = to_iio_trigger(dev);
iio_trigger_poll_chained(trig, 0);
struct iio_sysfs_trig *sysfs_trig = trig->private_data;

irq_work_queue(&sysfs_trig->work);

return count;
}
Expand Down Expand Up @@ -148,6 +160,9 @@ static int iio_sysfs_trigger_probe(int id)
t->trig->dev.groups = iio_sysfs_trigger_attr_groups;
t->trig->ops = &iio_sysfs_trigger_ops;
t->trig->dev.parent = &iio_sysfs_trig_dev;
t->trig->private_data = t;

init_irq_work(&t->work, iio_sysfs_trigger_work);

ret = iio_trigger_register(t->trig);
if (ret)
Expand Down

0 comments on commit 46b2860

Please sign in to comment.