forked from Minki/linux
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>
This commit is contained in:
parent
c3db00cc80
commit
7b2c33b11e
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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_ */
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user