diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2011-05-18 14:41:33 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-05-19 16:14:51 -0700 |
commit | f3dadc1dd2ac91529c39ee0015fc91e2ea474453 (patch) | |
tree | 2e87dd2bab11f8579bb9591576cad0b3c88f6c79 /drivers/staging/iio/accel/adis16203_trigger.c | |
parent | 05c2858d2f62c364f00c35b9607d2135a719a452 (diff) |
staging:iio:accel:adis16203 move to irqchip based trigger handling.
Untested.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/accel/adis16203_trigger.c')
-rw-r--r-- | drivers/staging/iio/accel/adis16203_trigger.c | 51 |
1 files changed, 16 insertions, 35 deletions
diff --git a/drivers/staging/iio/accel/adis16203_trigger.c b/drivers/staging/iio/accel/adis16203_trigger.c index dbc75bde9705..b55404961b5f 100644 --- a/drivers/staging/iio/accel/adis16203_trigger.c +++ b/drivers/staging/iio/accel/adis16203_trigger.c @@ -12,16 +12,6 @@ #include "../trigger.h" #include "adis16203.h" -/** - * adis16203_data_rdy_trig_poll() the event handler for the data rdy trig - **/ -static irqreturn_t adis16203_data_rdy_trig_poll(int irq, void *private) -{ - disable_irq_nosync(irq); - iio_trigger_poll(private, iio_get_time_ns()); - return IRQ_HANDLED; -} - static DEVICE_ATTR(name, S_IRUGO, iio_trigger_read_name, NULL); static struct attribute *adis16203_trigger_attrs[] = { @@ -46,63 +36,54 @@ static int adis16203_data_rdy_trigger_set_state(struct iio_trigger *trig, return adis16203_set_irq(&st->indio_dev->dev, state); } -/** - * adis16203_trig_try_reen() try renabling irq for data rdy trigger - * @trig: the datardy trigger - **/ -static int adis16203_trig_try_reen(struct iio_trigger *trig) -{ - struct adis16203_state *st = trig->private_data; - enable_irq(st->us->irq); - return 0; -} - int adis16203_probe_trigger(struct iio_dev *indio_dev) { int ret; struct adis16203_state *st = indio_dev->dev_data; + char *name; - st->trig = iio_allocate_trigger(); - if (st->trig == NULL) { + name = kasprintf(GFP_KERNEL, + "adis16203-dev%d", + indio_dev->id); + if (name == NULL) { ret = -ENOMEM; goto error_ret; } + st->trig = iio_allocate_trigger_named(name); + if (st->trig == NULL) { + ret = -ENOMEM; + goto error_free_name; + } + ret = request_irq(st->us->irq, - adis16203_data_rdy_trig_poll, + &iio_trigger_generic_data_rdy_poll, IRQF_TRIGGER_RISING, "adis16203", st->trig); if (ret) goto error_free_trig; - st->trig->name = kasprintf(GFP_KERNEL, - "adis16203-dev%d", - indio_dev->id); - if (!st->trig->name) { - ret = -ENOMEM; - goto error_free_irq; - } + st->trig->dev.parent = &st->us->dev; st->trig->owner = THIS_MODULE; st->trig->private_data = st; st->trig->set_trigger_state = &adis16203_data_rdy_trigger_set_state; - st->trig->try_reenable = &adis16203_trig_try_reen; st->trig->control_attrs = &adis16203_trigger_attr_group; ret = iio_trigger_register(st->trig); /* select default trigger */ indio_dev->trig = st->trig; if (ret) - goto error_free_trig_name; + goto error_free_irq; return 0; -error_free_trig_name: - kfree(st->trig->name); error_free_irq: free_irq(st->us->irq, st->trig); error_free_trig: iio_free_trigger(st->trig); +error_free_name: + kfree(name); error_ret: return ret; } |