staging: iio: remove timestamp field from trigger and pass instead through pollfuncs
authorJonathan Cameron <jic23@cam.ac.uk>
Sun, 11 Jul 2010 15:39:11 +0000 (16:39 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 22 Jul 2010 18:38:28 +0000 (11:38 -0700)
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
18 files changed:
drivers/staging/iio/accel/adis16209_ring.c
drivers/staging/iio/accel/adis16209_trigger.c
drivers/staging/iio/accel/adis16240_ring.c
drivers/staging/iio/accel/adis16240_trigger.c
drivers/staging/iio/accel/lis3l02dq_ring.c
drivers/staging/iio/adc/max1363_ring.c
drivers/staging/iio/gyro/adis16260_ring.c
drivers/staging/iio/gyro/adis16260_trigger.c
drivers/staging/iio/imu/adis16300_ring.c
drivers/staging/iio/imu/adis16300_trigger.c
drivers/staging/iio/imu/adis16350_ring.c
drivers/staging/iio/imu/adis16350_trigger.c
drivers/staging/iio/imu/adis16400_ring.c
drivers/staging/iio/imu/adis16400_trigger.c
drivers/staging/iio/industrialio-trigger.c
drivers/staging/iio/trigger.h
drivers/staging/iio/trigger/iio-trig-gpio.c
drivers/staging/iio/trigger/iio-trig-periodic-rtc.c

index 3b42a657941d6460c9dce222b19dac134a6886ae..ad715388156a11798f0546052d97a1a356fe897b 100644 (file)
@@ -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);
 }
 
index cd901a4ca3ffb8afbeec0412753e780b4535ceb7..1487effa2e3007e61f85cb0536b9775339b87724 100644 (file)
@@ -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;
 }
index 08fef633fc935cd1a0325dbda13925b2f56be406..5cced2ecead649ad5813b0a4df701daa9ca5fc3a 100644 (file)
@@ -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);
 }
 
index d58b4058688c5196e61b35bc437ab3ff2af3b8dd..2ba71fd73a47694a1b765e1469157dbcd5058a1a 100644 (file)
@@ -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;
 }
index bc0de784104b24e7ae693b20cc05b3c92955088b..28d95ed0b24599dde11ea385ab2e9148e08a697b 100644 (file)
@@ -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;
 }
index b510ca6073a11583b49d7caf927df7b93f2a1084..f9d5101e53a42742d8152d7b2b1c06cc27cee9b1 100644 (file)
@@ -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;
 
index 05e7a699112648247729dafb2ec0324d85078ad2..97d7660906e0ed97d4466af8f142b6ab74ba455d 100644 (file)
@@ -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);
 }
 
index 54afd9e047f3aa62dbbd0b5293a6c9cadcd9064d..de01537d257eb710f3e0b61eec86228d2b83797e 100644 (file)
@@ -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;
 }
index 4dee6708d7b61f6fde04ab045e2267bd752a3ba3..6b25f12df1619d1ce12af9048255533c433011fe 100644 (file)
@@ -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 */
 
index a55f383bea220529d3285aadb25270ce912639d9..64036cd99102fac1f6b933bf1eb5599d36cd8f89 100644 (file)
@@ -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;
 }
index c70816d8dbba2960e970ae1561a7a419689c5389..28c13ef9dd48937b1f1cb00031eaeda189be4b5d 100644 (file)
@@ -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);
 }
 
index fbe246a4cdb575ffb9876b51e18d1947e2814bab..76edccc85b71bac89ceae4d7b381183626fd22d1 100644 (file)
@@ -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;
 }
index 8f7d257e43444ee8855028384b82726a35ad0a9e..95f53b26b4f06349e5819d3f975d12dbb245e0bd 100644 (file)
@@ -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 */
 
index bf7c60383dd3bbdc81c2c4f6c3c512e4948ac0ef..aafe6010f1b1b3f36489482822212947231b648b 100644 (file)
@@ -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;
 }
index 2d8e5b915c3f7ece8a9b5244a3d647e18146493e..57dd9232cf0d91884dad5af732ab9e21fdbe150b 100644 (file)
@@ -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)
index 832de156259c030a2a3021669dbb73943d3ef249..4699586a593139c5049e997d1571946ed33a3793 100644 (file)
@@ -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_ */
index 3c0614eff72c8c706d7c553889653f09d7ea1080..f93cc916983242b38ea409271694b8d53a08a9ef 100644 (file)
@@ -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;
 }
 
index d8c58cbfce796b49f48ac485a24c56863bfe79ae..b0b52f84edfd76ee0bdc2a2ebfcd9efc4202ba05 100644 (file)
@@ -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)