diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2010-07-11 16:39:11 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-07-22 11:38:28 -0700 |
commit | 7b2c33b11ef003d83c87a58201ff42313e13eff4 (patch) | |
tree | 15a38e57525a000767840fe769d2270fe76bda8c | |
parent | c3db00cc80cf01f9a2033c3f3eb03345d0024761 (diff) |
staging: iio: remove timestamp field from trigger and pass instead through pollfuncs
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/iio/accel/adis16209_ring.c | 4 | ||||
-rw-r--r-- | drivers/staging/iio/accel/adis16209_trigger.c | 3 | ||||
-rw-r--r-- | drivers/staging/iio/accel/adis16240_ring.c | 4 | ||||
-rw-r--r-- | drivers/staging/iio/accel/adis16240_trigger.c | 3 | ||||
-rw-r--r-- | drivers/staging/iio/accel/lis3l02dq_ring.c | 9 | ||||
-rw-r--r-- | drivers/staging/iio/adc/max1363_ring.c | 2 | ||||
-rw-r--r-- | drivers/staging/iio/gyro/adis16260_ring.c | 4 | ||||
-rw-r--r-- | drivers/staging/iio/gyro/adis16260_trigger.c | 3 | ||||
-rw-r--r-- | drivers/staging/iio/imu/adis16300_ring.c | 4 | ||||
-rw-r--r-- | drivers/staging/iio/imu/adis16300_trigger.c | 3 | ||||
-rw-r--r-- | drivers/staging/iio/imu/adis16350_ring.c | 4 | ||||
-rw-r--r-- | drivers/staging/iio/imu/adis16350_trigger.c | 3 | ||||
-rw-r--r-- | drivers/staging/iio/imu/adis16400_ring.c | 4 | ||||
-rw-r--r-- | drivers/staging/iio/imu/adis16400_trigger.c | 3 | ||||
-rw-r--r-- | drivers/staging/iio/industrialio-trigger.c | 10 | ||||
-rw-r--r-- | drivers/staging/iio/trigger.h | 12 | ||||
-rw-r--r-- | drivers/staging/iio/trigger/iio-trig-gpio.c | 3 | ||||
-rw-r--r-- | drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 3 |
18 files changed, 39 insertions, 42 deletions
diff --git a/drivers/staging/iio/accel/adis16209_ring.c b/drivers/staging/iio/accel/adis16209_ring.c index 3b42a657941d..ad715388156a 100644 --- a/drivers/staging/iio/accel/adis16209_ring.c +++ b/drivers/staging/iio/accel/adis16209_ring.c @@ -68,10 +68,10 @@ static struct attribute_group adis16209_scan_el_group = { * adis16209_poll_func_th() top half interrupt handler called by trigger * @private_data: iio_dev **/ -static void adis16209_poll_func_th(struct iio_dev *indio_dev) +static void adis16209_poll_func_th(struct iio_dev *indio_dev, s64 time) { struct adis16209_state *st = iio_dev_get_devdata(indio_dev); - st->last_timestamp = indio_dev->trig->timestamp; + st->last_timestamp = time; schedule_work(&st->work_trigger_to_ring); } diff --git a/drivers/staging/iio/accel/adis16209_trigger.c b/drivers/staging/iio/accel/adis16209_trigger.c index cd901a4ca3ff..1487effa2e30 100644 --- a/drivers/staging/iio/accel/adis16209_trigger.c +++ b/drivers/staging/iio/accel/adis16209_trigger.c @@ -23,8 +23,7 @@ static int adis16209_data_rdy_trig_poll(struct iio_dev *dev_info, struct adis16209_state *st = iio_dev_get_devdata(dev_info); struct iio_trigger *trig = st->trig; - trig->timestamp = timestamp; - iio_trigger_poll(trig); + iio_trigger_poll(trig, timestamp); return IRQ_HANDLED; } diff --git a/drivers/staging/iio/accel/adis16240_ring.c b/drivers/staging/iio/accel/adis16240_ring.c index 08fef633fc93..5cced2ecead6 100644 --- a/drivers/staging/iio/accel/adis16240_ring.c +++ b/drivers/staging/iio/accel/adis16240_ring.c @@ -62,10 +62,10 @@ static struct attribute_group adis16240_scan_el_group = { * adis16240_poll_func_th() top half interrupt handler called by trigger * @private_data: iio_dev **/ -static void adis16240_poll_func_th(struct iio_dev *indio_dev) +static void adis16240_poll_func_th(struct iio_dev *indio_dev, s64 time) { struct adis16240_state *st = iio_dev_get_devdata(indio_dev); - st->last_timestamp = indio_dev->trig->timestamp; + st->last_timestamp = time; schedule_work(&st->work_trigger_to_ring); } diff --git a/drivers/staging/iio/accel/adis16240_trigger.c b/drivers/staging/iio/accel/adis16240_trigger.c index d58b4058688c..2ba71fd73a47 100644 --- a/drivers/staging/iio/accel/adis16240_trigger.c +++ b/drivers/staging/iio/accel/adis16240_trigger.c @@ -23,8 +23,7 @@ static int adis16240_data_rdy_trig_poll(struct iio_dev *dev_info, struct adis16240_state *st = iio_dev_get_devdata(dev_info); struct iio_trigger *trig = st->trig; - trig->timestamp = timestamp; - iio_trigger_poll(trig); + iio_trigger_poll(trig, timestamp); return IRQ_HANDLED; } diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c index bc0de784104b..28d95ed0b245 100644 --- a/drivers/staging/iio/accel/lis3l02dq_ring.c +++ b/drivers/staging/iio/accel/lis3l02dq_ring.c @@ -103,10 +103,10 @@ static struct attribute_group lis3l02dq_scan_el_group = { * lis3l02dq_poll_func_th() top half interrupt handler called by trigger * @private_data: iio_dev **/ -static void lis3l02dq_poll_func_th(struct iio_dev *indio_dev) +static void lis3l02dq_poll_func_th(struct iio_dev *indio_dev, s64 time) { - struct lis3l02dq_state *st = iio_dev_get_devdata(indio_dev); - st->last_timestamp = indio_dev->trig->timestamp; + struct lis3l02dq_state *st = iio_dev_get_devdata(indio_dev); + st->last_timestamp = time; schedule_work(&st->work_trigger_to_ring); /* Indicate that this interrupt is being handled */ @@ -128,8 +128,7 @@ static int lis3l02dq_data_rdy_trig_poll(struct iio_dev *dev_info, struct lis3l02dq_state *st = iio_dev_get_devdata(dev_info); struct iio_trigger *trig = st->trig; - trig->timestamp = timestamp; - iio_trigger_poll(trig); + iio_trigger_poll(trig, timestamp); return IRQ_HANDLED; } diff --git a/drivers/staging/iio/adc/max1363_ring.c b/drivers/staging/iio/adc/max1363_ring.c index b510ca6073a1..f9d5101e53a4 100644 --- a/drivers/staging/iio/adc/max1363_ring.c +++ b/drivers/staging/iio/adc/max1363_ring.c @@ -113,7 +113,7 @@ static int max1363_ring_preenable(struct iio_dev *indio_dev) * then. Some triggers will generate their own time stamp. Currently * there is no way of notifying them when no one cares. **/ -static void max1363_poll_func_th(struct iio_dev *indio_dev) +static void max1363_poll_func_th(struct iio_dev *indio_dev, s64 time) { struct max1363_state *st = indio_dev->dev_data; diff --git a/drivers/staging/iio/gyro/adis16260_ring.c b/drivers/staging/iio/gyro/adis16260_ring.c index 05e7a6991126..97d7660906e0 100644 --- a/drivers/staging/iio/gyro/adis16260_ring.c +++ b/drivers/staging/iio/gyro/adis16260_ring.c @@ -59,10 +59,10 @@ static struct attribute_group adis16260_scan_el_group = { * adis16260_poll_func_th() top half interrupt handler called by trigger * @private_data: iio_dev **/ -static void adis16260_poll_func_th(struct iio_dev *indio_dev) +static void adis16260_poll_func_th(struct iio_dev *indio_dev, s64 time) { struct adis16260_state *st = iio_dev_get_devdata(indio_dev); - st->last_timestamp = indio_dev->trig->timestamp; + st->last_timestamp = time; schedule_work(&st->work_trigger_to_ring); } diff --git a/drivers/staging/iio/gyro/adis16260_trigger.c b/drivers/staging/iio/gyro/adis16260_trigger.c index 54afd9e047f3..de01537d257e 100644 --- a/drivers/staging/iio/gyro/adis16260_trigger.c +++ b/drivers/staging/iio/gyro/adis16260_trigger.c @@ -23,8 +23,7 @@ static int adis16260_data_rdy_trig_poll(struct iio_dev *dev_info, struct adis16260_state *st = iio_dev_get_devdata(dev_info); struct iio_trigger *trig = st->trig; - trig->timestamp = timestamp; - iio_trigger_poll(trig); + iio_trigger_poll(trig, timestamp); return IRQ_HANDLED; } diff --git a/drivers/staging/iio/imu/adis16300_ring.c b/drivers/staging/iio/imu/adis16300_ring.c index 4dee6708d7b6..6b25f12df161 100644 --- a/drivers/staging/iio/imu/adis16300_ring.c +++ b/drivers/staging/iio/imu/adis16300_ring.c @@ -75,10 +75,10 @@ static struct attribute_group adis16300_scan_el_group = { * adis16300_poll_func_th() top half interrupt handler called by trigger * @private_data: iio_dev **/ -static void adis16300_poll_func_th(struct iio_dev *indio_dev) +static void adis16300_poll_func_th(struct iio_dev *indio_dev, s64 time) { struct adis16300_state *st = iio_dev_get_devdata(indio_dev); - st->last_timestamp = indio_dev->trig->timestamp; + st->last_timestamp = time; schedule_work(&st->work_trigger_to_ring); /* Indicate that this interrupt is being handled */ diff --git a/drivers/staging/iio/imu/adis16300_trigger.c b/drivers/staging/iio/imu/adis16300_trigger.c index a55f383bea22..64036cd99102 100644 --- a/drivers/staging/iio/imu/adis16300_trigger.c +++ b/drivers/staging/iio/imu/adis16300_trigger.c @@ -23,8 +23,7 @@ static int adis16300_data_rdy_trig_poll(struct iio_dev *dev_info, struct adis16300_state *st = iio_dev_get_devdata(dev_info); struct iio_trigger *trig = st->trig; - trig->timestamp = timestamp; - iio_trigger_poll(trig); + iio_trigger_poll(trig, timestamp); return IRQ_HANDLED; } diff --git a/drivers/staging/iio/imu/adis16350_ring.c b/drivers/staging/iio/imu/adis16350_ring.c index c70816d8dbba..28c13ef9dd48 100644 --- a/drivers/staging/iio/imu/adis16350_ring.c +++ b/drivers/staging/iio/imu/adis16350_ring.c @@ -81,10 +81,10 @@ static struct attribute_group adis16350_scan_el_group = { * adis16350_poll_func_th() top half interrupt handler called by trigger * @private_data: iio_dev **/ -static void adis16350_poll_func_th(struct iio_dev *indio_dev) +static void adis16350_poll_func_th(struct iio_dev *indio_dev, s64 time) { struct adis16350_state *st = iio_dev_get_devdata(indio_dev); - st->last_timestamp = indio_dev->trig->timestamp; + st->last_timestamp = time; schedule_work(&st->work_trigger_to_ring); } diff --git a/drivers/staging/iio/imu/adis16350_trigger.c b/drivers/staging/iio/imu/adis16350_trigger.c index fbe246a4cdb5..76edccc85b71 100644 --- a/drivers/staging/iio/imu/adis16350_trigger.c +++ b/drivers/staging/iio/imu/adis16350_trigger.c @@ -23,8 +23,7 @@ static int adis16350_data_rdy_trig_poll(struct iio_dev *dev_info, struct adis16350_state *st = iio_dev_get_devdata(dev_info); struct iio_trigger *trig = st->trig; - trig->timestamp = timestamp; - iio_trigger_poll(trig); + iio_trigger_poll(trig, timestamp); return IRQ_HANDLED; } diff --git a/drivers/staging/iio/imu/adis16400_ring.c b/drivers/staging/iio/imu/adis16400_ring.c index 8f7d257e4344..95f53b26b4f0 100644 --- a/drivers/staging/iio/imu/adis16400_ring.c +++ b/drivers/staging/iio/imu/adis16400_ring.c @@ -84,10 +84,10 @@ static struct attribute_group adis16400_scan_el_group = { * adis16400_poll_func_th() top half interrupt handler called by trigger * @private_data: iio_dev **/ -static void adis16400_poll_func_th(struct iio_dev *indio_dev) +static void adis16400_poll_func_th(struct iio_dev *indio_dev, s64 time) { struct adis16400_state *st = iio_dev_get_devdata(indio_dev); - st->last_timestamp = indio_dev->trig->timestamp; + st->last_timestamp = time; schedule_work(&st->work_trigger_to_ring); /* Indicate that this interrupt is being handled */ diff --git a/drivers/staging/iio/imu/adis16400_trigger.c b/drivers/staging/iio/imu/adis16400_trigger.c index bf7c60383dd3..aafe6010f1b1 100644 --- a/drivers/staging/iio/imu/adis16400_trigger.c +++ b/drivers/staging/iio/imu/adis16400_trigger.c @@ -23,8 +23,7 @@ static int adis16400_data_rdy_trig_poll(struct iio_dev *dev_info, struct adis16400_state *st = iio_dev_get_devdata(dev_info); struct iio_trigger *trig = st->trig; - trig->timestamp = timestamp; - iio_trigger_poll(trig); + iio_trigger_poll(trig, timestamp); return IRQ_HANDLED; } diff --git a/drivers/staging/iio/industrialio-trigger.c b/drivers/staging/iio/industrialio-trigger.c index 2d8e5b915c3f..57dd9232cf0d 100644 --- a/drivers/staging/iio/industrialio-trigger.c +++ b/drivers/staging/iio/industrialio-trigger.c @@ -172,7 +172,7 @@ struct iio_trigger *iio_trigger_find_by_name(const char *name, size_t len) } EXPORT_SYMBOL(iio_trigger_find_by_name); -void iio_trigger_poll(struct iio_trigger *trig) +void iio_trigger_poll(struct iio_trigger *trig, s64 time) { struct iio_poll_func *pf_cursor; @@ -184,7 +184,8 @@ void iio_trigger_poll(struct iio_trigger *trig) } list_for_each_entry(pf_cursor, &trig->pollfunc_list, list) { if (pf_cursor->poll_func_main) { - pf_cursor->poll_func_main(pf_cursor->private_data); + pf_cursor->poll_func_main(pf_cursor->private_data, + time); trig->use_count++; } } @@ -197,8 +198,7 @@ void iio_trigger_notify_done(struct iio_trigger *trig) if (trig->use_count == 0 && trig->try_reenable) if (trig->try_reenable(trig)) { /* Missed and interrupt so launch new poll now */ - trig->timestamp = 0; - iio_trigger_poll(trig); + iio_trigger_poll(trig, 0); } } EXPORT_SYMBOL(iio_trigger_notify_done); @@ -400,7 +400,7 @@ EXPORT_SYMBOL(iio_device_unregister_trigger_consumer); int iio_alloc_pollfunc(struct iio_dev *indio_dev, void (*immediate)(struct iio_dev *indio_dev), - void (*main)(struct iio_dev *private_data)) + void (*main)(struct iio_dev *private_data, s64 time)) { indio_dev->pollfunc = kzalloc(sizeof(*indio_dev->pollfunc), GFP_KERNEL); if (indio_dev->pollfunc == NULL) diff --git a/drivers/staging/iio/trigger.h b/drivers/staging/iio/trigger.h index 832de156259c..4699586a5931 100644 --- a/drivers/staging/iio/trigger.h +++ b/drivers/staging/iio/trigger.h @@ -21,7 +21,6 @@ * @pollfunc_list_lock: [INTERN] protection of the polling function list * @pollfunc_list: [INTERN] list of functions to run on trigger. * @control_attrs: [DRIVER] sysfs attributes relevant to trigger type - * @timestamp: [INTERN] timestamp usesd by some trigs (e.g. datardy) * @owner: [DRIVER] used to monitor usage count of the trigger. * @use_count: use count for the trigger * @set_trigger_state: [DRIVER] switch on/off the trigger on demand @@ -39,7 +38,6 @@ struct iio_trigger { spinlock_t pollfunc_list_lock; struct list_head pollfunc_list; const struct attribute_group *control_attrs; - s64 timestamp; struct module *owner; int use_count; @@ -120,7 +118,7 @@ int iio_trigger_dettach_poll_func(struct iio_trigger *trig, * * Typically called in relevant hardware interrupt handler. **/ -void iio_trigger_poll(struct iio_trigger *trig); +void iio_trigger_poll(struct iio_trigger *trig, s64 time); void iio_trigger_notify_done(struct iio_trigger *trig); /** @@ -144,13 +142,13 @@ struct iio_poll_func { struct list_head list; void *private_data; void (*poll_func_immediate)(struct iio_dev *indio_dev); - void (*poll_func_main)(struct iio_dev *private_data); + void (*poll_func_main)(struct iio_dev *private_data, s64 time); }; int iio_alloc_pollfunc(struct iio_dev *indio_dev, void (*immediate)(struct iio_dev *indio_dev), - void (*main)(struct iio_dev *private_data)); + void (*main)(struct iio_dev *private_data, s64 time)); /* * Two functions for common case where all that happens is a pollfunc @@ -163,4 +161,8 @@ struct iio_trigger *iio_allocate_trigger(void); void iio_free_trigger(struct iio_trigger *trig); + +struct iio_simple_trigger { + struct iio_trigger trig; +}; #endif /* _IIO_TRIGGER_H_ */ diff --git a/drivers/staging/iio/trigger/iio-trig-gpio.c b/drivers/staging/iio/trigger/iio-trig-gpio.c index 3c0614eff72c..f93cc9169832 100644 --- a/drivers/staging/iio/trigger/iio-trig-gpio.c +++ b/drivers/staging/iio/trigger/iio-trig-gpio.c @@ -42,7 +42,8 @@ struct iio_gpio_trigger_info { static irqreturn_t iio_gpio_trigger_poll(int irq, void *private) { - iio_trigger_poll(private); + /* Timestamp not currently provided */ + iio_trigger_poll(private, 0); return IRQ_HANDLED; } diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c index d8c58cbfce79..b0b52f84edfd 100644 --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c @@ -98,7 +98,8 @@ static const struct attribute_group iio_trig_prtc_attr_group = { static void iio_prtc_trigger_poll(void *private_data) { - iio_trigger_poll(private_data); + /* Timestamp is not provided currently */ + iio_trigger_poll(private_data, 0); } static int iio_trig_periodic_rtc_probe(struct platform_device *dev) |