mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
staging:iio:buffer move setup ops from buffer instance to iio_dev
These callbacks should not be buffer instance specific. Hence move them out of the buffer. Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
3771a0a88b
commit
1612244f8a
23 changed files with 46 additions and 46 deletions
|
@ -118,7 +118,7 @@ int adis16201_configure_ring(struct iio_dev *indio_dev)
|
||||||
/* Effectively select the ring buffer implementation */
|
/* Effectively select the ring buffer implementation */
|
||||||
ring->scan_timestamp = true;
|
ring->scan_timestamp = true;
|
||||||
ring->access = &ring_sw_access_funcs;
|
ring->access = &ring_sw_access_funcs;
|
||||||
ring->setup_ops = &adis16201_ring_setup_ops;
|
indio_dev->setup_ops = &adis16201_ring_setup_ops;
|
||||||
ring->owner = THIS_MODULE;
|
ring->owner = THIS_MODULE;
|
||||||
|
|
||||||
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
||||||
|
|
|
@ -120,7 +120,7 @@ int adis16203_configure_ring(struct iio_dev *indio_dev)
|
||||||
/* Effectively select the ring buffer implementation */
|
/* Effectively select the ring buffer implementation */
|
||||||
ring->scan_timestamp = true;
|
ring->scan_timestamp = true;
|
||||||
ring->access = &ring_sw_access_funcs;
|
ring->access = &ring_sw_access_funcs;
|
||||||
ring->setup_ops = &adis16203_ring_setup_ops;
|
indio_dev->setup_ops = &adis16203_ring_setup_ops;
|
||||||
ring->owner = THIS_MODULE;
|
ring->owner = THIS_MODULE;
|
||||||
|
|
||||||
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
||||||
|
|
|
@ -115,7 +115,7 @@ int adis16204_configure_ring(struct iio_dev *indio_dev)
|
||||||
/* Effectively select the ring buffer implementation */
|
/* Effectively select the ring buffer implementation */
|
||||||
ring->access = &ring_sw_access_funcs;
|
ring->access = &ring_sw_access_funcs;
|
||||||
ring->scan_timestamp = true;
|
ring->scan_timestamp = true;
|
||||||
ring->setup_ops = &adis16204_ring_setup_ops;
|
indio_dev->setup_ops = &adis16204_ring_setup_ops;
|
||||||
ring->owner = THIS_MODULE;
|
ring->owner = THIS_MODULE;
|
||||||
|
|
||||||
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
||||||
|
|
|
@ -115,7 +115,7 @@ int adis16209_configure_ring(struct iio_dev *indio_dev)
|
||||||
/* Effectively select the ring buffer implementation */
|
/* Effectively select the ring buffer implementation */
|
||||||
ring->access = &ring_sw_access_funcs;
|
ring->access = &ring_sw_access_funcs;
|
||||||
ring->scan_timestamp = true;
|
ring->scan_timestamp = true;
|
||||||
ring->setup_ops = &adis16209_ring_setup_ops;
|
indio_dev->setup_ops = &adis16209_ring_setup_ops;
|
||||||
ring->owner = THIS_MODULE;
|
ring->owner = THIS_MODULE;
|
||||||
|
|
||||||
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
||||||
|
|
|
@ -112,7 +112,7 @@ int adis16240_configure_ring(struct iio_dev *indio_dev)
|
||||||
/* Effectively select the ring buffer implementation */
|
/* Effectively select the ring buffer implementation */
|
||||||
ring->access = &ring_sw_access_funcs;
|
ring->access = &ring_sw_access_funcs;
|
||||||
ring->scan_timestamp = true;
|
ring->scan_timestamp = true;
|
||||||
ring->setup_ops = &adis16240_ring_setup_ops;
|
indio_dev->setup_ops = &adis16240_ring_setup_ops;
|
||||||
ring->owner = THIS_MODULE;
|
ring->owner = THIS_MODULE;
|
||||||
|
|
||||||
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
||||||
|
|
|
@ -438,7 +438,7 @@ int lis3l02dq_configure_buffer(struct iio_dev *indio_dev)
|
||||||
indio_dev->buffer->access = &lis3l02dq_access_funcs;
|
indio_dev->buffer->access = &lis3l02dq_access_funcs;
|
||||||
|
|
||||||
buffer->scan_timestamp = true;
|
buffer->scan_timestamp = true;
|
||||||
buffer->setup_ops = &lis3l02dq_buffer_setup_ops;
|
indio_dev->setup_ops = &lis3l02dq_buffer_setup_ops;
|
||||||
buffer->owner = THIS_MODULE;
|
buffer->owner = THIS_MODULE;
|
||||||
|
|
||||||
/* Functions are NULL as we set handler below */
|
/* Functions are NULL as we set handler below */
|
||||||
|
|
|
@ -348,7 +348,7 @@ static const struct iio_buffer_setup_ops sca3000_ring_setup_ops = {
|
||||||
|
|
||||||
void sca3000_register_ring_funcs(struct iio_dev *indio_dev)
|
void sca3000_register_ring_funcs(struct iio_dev *indio_dev)
|
||||||
{
|
{
|
||||||
indio_dev->buffer->setup_ops = &sca3000_ring_setup_ops;
|
indio_dev->setup_ops = &sca3000_ring_setup_ops;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -592,7 +592,7 @@ static int ad7192_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ring buffer functions - here trigger setup related */
|
/* Ring buffer functions - here trigger setup related */
|
||||||
indio_dev->buffer->setup_ops = &ad7192_ring_setup_ops;
|
indio_dev->setup_ops = &ad7192_ring_setup_ops;
|
||||||
|
|
||||||
/* Flag that polled ring buffering is possible */
|
/* Flag that polled ring buffering is possible */
|
||||||
indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
|
indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
|
||||||
|
|
|
@ -174,7 +174,7 @@ int ad7298_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ring buffer functions - here trigger setup related */
|
/* Ring buffer functions - here trigger setup related */
|
||||||
indio_dev->buffer->setup_ops = &ad7298_ring_setup_ops;
|
indio_dev->setup_ops = &ad7298_ring_setup_ops;
|
||||||
indio_dev->buffer->scan_timestamp = true;
|
indio_dev->buffer->scan_timestamp = true;
|
||||||
|
|
||||||
/* Flag that polled ring buffering is possible */
|
/* Flag that polled ring buffering is possible */
|
||||||
|
|
|
@ -137,7 +137,7 @@ int ad7476_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ring buffer functions - here trigger setup related */
|
/* Ring buffer functions - here trigger setup related */
|
||||||
indio_dev->buffer->setup_ops = &ad7476_ring_setup_ops;
|
indio_dev->setup_ops = &ad7476_ring_setup_ops;
|
||||||
indio_dev->buffer->scan_timestamp = true;
|
indio_dev->buffer->scan_timestamp = true;
|
||||||
|
|
||||||
/* Flag that polled ring buffering is possible */
|
/* Flag that polled ring buffering is possible */
|
||||||
|
|
|
@ -150,7 +150,7 @@ int ad7606_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
|
|
||||||
/* Ring buffer functions - here trigger setup related */
|
/* Ring buffer functions - here trigger setup related */
|
||||||
|
|
||||||
indio_dev->buffer->setup_ops = &ad7606_ring_setup_ops;
|
indio_dev->setup_ops = &ad7606_ring_setup_ops;
|
||||||
indio_dev->buffer->scan_timestamp = true ;
|
indio_dev->buffer->scan_timestamp = true ;
|
||||||
|
|
||||||
INIT_WORK(&st->poll_work, &ad7606_poll_bh_to_ring);
|
INIT_WORK(&st->poll_work, &ad7606_poll_bh_to_ring);
|
||||||
|
|
|
@ -459,7 +459,7 @@ static int ad7793_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ring buffer functions - here trigger setup related */
|
/* Ring buffer functions - here trigger setup related */
|
||||||
indio_dev->buffer->setup_ops = &ad7793_ring_setup_ops;
|
indio_dev->setup_ops = &ad7793_ring_setup_ops;
|
||||||
|
|
||||||
/* Flag that polled ring buffering is possible */
|
/* Flag that polled ring buffering is possible */
|
||||||
indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
|
indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
|
||||||
|
|
|
@ -176,7 +176,7 @@ int ad7887_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
goto error_deallocate_sw_rb;
|
goto error_deallocate_sw_rb;
|
||||||
}
|
}
|
||||||
/* Ring buffer functions - here trigger setup related */
|
/* Ring buffer functions - here trigger setup related */
|
||||||
indio_dev->buffer->setup_ops = &ad7887_ring_setup_ops;
|
indio_dev->setup_ops = &ad7887_ring_setup_ops;
|
||||||
|
|
||||||
/* Flag that polled ring buffering is possible */
|
/* Flag that polled ring buffering is possible */
|
||||||
indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
|
indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
|
||||||
|
|
|
@ -183,7 +183,7 @@ int ad799x_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ring buffer functions - here trigger setup related */
|
/* Ring buffer functions - here trigger setup related */
|
||||||
indio_dev->buffer->setup_ops = &ad799x_buf_setup_ops;
|
indio_dev->setup_ops = &ad799x_buf_setup_ops;
|
||||||
indio_dev->buffer->scan_timestamp = true;
|
indio_dev->buffer->scan_timestamp = true;
|
||||||
|
|
||||||
/* Flag that polled ring buffering is possible */
|
/* Flag that polled ring buffering is possible */
|
||||||
|
|
|
@ -155,7 +155,7 @@ int max1363_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
/* Effectively select the ring buffer implementation */
|
/* Effectively select the ring buffer implementation */
|
||||||
indio_dev->buffer->access = &ring_sw_access_funcs;
|
indio_dev->buffer->access = &ring_sw_access_funcs;
|
||||||
/* Ring buffer functions - here trigger setup related */
|
/* Ring buffer functions - here trigger setup related */
|
||||||
indio_dev->buffer->setup_ops = &max1363_ring_setup_ops;
|
indio_dev->setup_ops = &max1363_ring_setup_ops;
|
||||||
|
|
||||||
/* Flag that polled ring buffering is possible */
|
/* Flag that polled ring buffering is possible */
|
||||||
indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
|
indio_dev->modes |= INDIO_BUFFER_TRIGGERED;
|
||||||
|
|
|
@ -65,21 +65,6 @@ struct iio_buffer_access_funcs {
|
||||||
int (*enable)(struct iio_buffer *buffer);
|
int (*enable)(struct iio_buffer *buffer);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* struct iio_buffer_setup_ops - buffer setup related callbacks
|
|
||||||
* @preenable: [DRIVER] function to run prior to marking buffer enabled
|
|
||||||
* @postenable: [DRIVER] function to run after marking buffer enabled
|
|
||||||
* @predisable: [DRIVER] function to run prior to marking buffer
|
|
||||||
* disabled
|
|
||||||
* @postdisable: [DRIVER] function to run after marking buffer disabled
|
|
||||||
*/
|
|
||||||
struct iio_buffer_setup_ops {
|
|
||||||
int (*preenable)(struct iio_dev *);
|
|
||||||
int (*postenable)(struct iio_dev *);
|
|
||||||
int (*predisable)(struct iio_dev *);
|
|
||||||
int (*postdisable)(struct iio_dev *);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct iio_buffer - general buffer structure
|
* struct iio_buffer - general buffer structure
|
||||||
* @indio_dev: industrial I/O device structure
|
* @indio_dev: industrial I/O device structure
|
||||||
|
@ -108,7 +93,6 @@ struct iio_buffer {
|
||||||
bool scan_timestamp;
|
bool scan_timestamp;
|
||||||
unsigned scan_index_timestamp;
|
unsigned scan_index_timestamp;
|
||||||
const struct iio_buffer_access_funcs *access;
|
const struct iio_buffer_access_funcs *access;
|
||||||
const struct iio_buffer_setup_ops *setup_ops;
|
|
||||||
struct list_head scan_el_dev_attr_list;
|
struct list_head scan_el_dev_attr_list;
|
||||||
struct attribute_group scan_el_group;
|
struct attribute_group scan_el_group;
|
||||||
wait_queue_head_t pollq;
|
wait_queue_head_t pollq;
|
||||||
|
|
|
@ -117,7 +117,7 @@ int adis16260_configure_ring(struct iio_dev *indio_dev)
|
||||||
/* Effectively select the ring buffer implementation */
|
/* Effectively select the ring buffer implementation */
|
||||||
ring->access = &ring_sw_access_funcs;
|
ring->access = &ring_sw_access_funcs;
|
||||||
ring->scan_timestamp = true;
|
ring->scan_timestamp = true;
|
||||||
ring->setup_ops = &adis16260_ring_setup_ops;
|
indio_dev->setup_ops = &adis16260_ring_setup_ops;
|
||||||
ring->owner = THIS_MODULE;
|
ring->owner = THIS_MODULE;
|
||||||
|
|
||||||
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
||||||
|
|
|
@ -271,6 +271,21 @@ struct iio_info {
|
||||||
const unsigned long *scan_mask);
|
const unsigned long *scan_mask);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct iio_buffer_setup_ops - buffer setup related callbacks
|
||||||
|
* @preenable: [DRIVER] function to run prior to marking buffer enabled
|
||||||
|
* @postenable: [DRIVER] function to run after marking buffer enabled
|
||||||
|
* @predisable: [DRIVER] function to run prior to marking buffer
|
||||||
|
* disabled
|
||||||
|
* @postdisable: [DRIVER] function to run after marking buffer disabled
|
||||||
|
*/
|
||||||
|
struct iio_buffer_setup_ops {
|
||||||
|
int (*preenable)(struct iio_dev *);
|
||||||
|
int (*postenable)(struct iio_dev *);
|
||||||
|
int (*predisable)(struct iio_dev *);
|
||||||
|
int (*postdisable)(struct iio_dev *);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct iio_dev - industrial I/O device
|
* struct iio_dev - industrial I/O device
|
||||||
* @id: [INTERN] used to identify device internally
|
* @id: [INTERN] used to identify device internally
|
||||||
|
@ -324,6 +339,7 @@ struct iio_dev {
|
||||||
struct attribute_group chan_attr_group;
|
struct attribute_group chan_attr_group;
|
||||||
const char *name;
|
const char *name;
|
||||||
const struct iio_info *info;
|
const struct iio_info *info;
|
||||||
|
const struct iio_buffer_setup_ops *setup_ops;
|
||||||
struct cdev chrdev;
|
struct cdev chrdev;
|
||||||
#define IIO_MAX_GROUPS 6
|
#define IIO_MAX_GROUPS 6
|
||||||
const struct attribute_group *groups[IIO_MAX_GROUPS + 1];
|
const struct attribute_group *groups[IIO_MAX_GROUPS + 1];
|
||||||
|
|
|
@ -149,7 +149,7 @@ int iio_simple_dummy_configure_buffer(struct iio_dev *indio_dev)
|
||||||
* Tell the core what device type specific functions should
|
* Tell the core what device type specific functions should
|
||||||
* be run on either side of buffer capture enable / disable.
|
* be run on either side of buffer capture enable / disable.
|
||||||
*/
|
*/
|
||||||
buffer->setup_ops = &iio_simple_dummy_buffer_setup_ops;
|
indio_dev->setup_ops = &iio_simple_dummy_buffer_setup_ops;
|
||||||
buffer->owner = THIS_MODULE;
|
buffer->owner = THIS_MODULE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -611,7 +611,7 @@ static int ad5933_register_ring_funcs_and_init(struct iio_dev *indio_dev)
|
||||||
indio_dev->buffer->access = &ring_sw_access_funcs;
|
indio_dev->buffer->access = &ring_sw_access_funcs;
|
||||||
|
|
||||||
/* Ring buffer functions - here trigger setup related */
|
/* Ring buffer functions - here trigger setup related */
|
||||||
indio_dev->buffer->setup_ops = &ad5933_ring_setup_ops;
|
indio_dev->setup_ops = &ad5933_ring_setup_ops;
|
||||||
|
|
||||||
indio_dev->modes |= INDIO_BUFFER_HARDWARE;
|
indio_dev->modes |= INDIO_BUFFER_HARDWARE;
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ int adis16400_configure_ring(struct iio_dev *indio_dev)
|
||||||
/* Effectively select the ring buffer implementation */
|
/* Effectively select the ring buffer implementation */
|
||||||
ring->access = &ring_sw_access_funcs;
|
ring->access = &ring_sw_access_funcs;
|
||||||
ring->scan_timestamp = true;
|
ring->scan_timestamp = true;
|
||||||
ring->setup_ops = &adis16400_ring_setup_ops;
|
indio_dev->setup_ops = &adis16400_ring_setup_ops;
|
||||||
ring->owner = THIS_MODULE;
|
ring->owner = THIS_MODULE;
|
||||||
|
|
||||||
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
||||||
|
|
|
@ -428,8 +428,8 @@ ssize_t iio_buffer_store_enable(struct device *dev,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (requested_state) {
|
if (requested_state) {
|
||||||
if (buffer->setup_ops->preenable) {
|
if (indio_dev->setup_ops->preenable) {
|
||||||
ret = buffer->setup_ops->preenable(indio_dev);
|
ret = indio_dev->setup_ops->preenable(indio_dev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR
|
||||||
"Buffer not started:"
|
"Buffer not started:"
|
||||||
|
@ -466,8 +466,8 @@ ssize_t iio_buffer_store_enable(struct device *dev,
|
||||||
goto error_ret;
|
goto error_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer->setup_ops->postenable) {
|
if (indio_dev->setup_ops->postenable) {
|
||||||
ret = buffer->setup_ops->postenable(indio_dev);
|
ret = indio_dev->setup_ops->postenable(indio_dev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printk(KERN_INFO
|
printk(KERN_INFO
|
||||||
"Buffer not started:"
|
"Buffer not started:"
|
||||||
|
@ -475,23 +475,23 @@ ssize_t iio_buffer_store_enable(struct device *dev,
|
||||||
if (buffer->access->unmark_in_use)
|
if (buffer->access->unmark_in_use)
|
||||||
buffer->access->unmark_in_use(buffer);
|
buffer->access->unmark_in_use(buffer);
|
||||||
indio_dev->currentmode = previous_mode;
|
indio_dev->currentmode = previous_mode;
|
||||||
if (buffer->setup_ops->postdisable)
|
if (indio_dev->setup_ops->postdisable)
|
||||||
buffer->setup_ops->
|
indio_dev->setup_ops->
|
||||||
postdisable(indio_dev);
|
postdisable(indio_dev);
|
||||||
goto error_ret;
|
goto error_ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (buffer->setup_ops->predisable) {
|
if (indio_dev->setup_ops->predisable) {
|
||||||
ret = buffer->setup_ops->predisable(indio_dev);
|
ret = indio_dev->setup_ops->predisable(indio_dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error_ret;
|
goto error_ret;
|
||||||
}
|
}
|
||||||
if (buffer->access->unmark_in_use)
|
if (buffer->access->unmark_in_use)
|
||||||
buffer->access->unmark_in_use(buffer);
|
buffer->access->unmark_in_use(buffer);
|
||||||
indio_dev->currentmode = INDIO_DIRECT_MODE;
|
indio_dev->currentmode = INDIO_DIRECT_MODE;
|
||||||
if (buffer->setup_ops->postdisable) {
|
if (indio_dev->setup_ops->postdisable) {
|
||||||
ret = buffer->setup_ops->postdisable(indio_dev);
|
ret = indio_dev->setup_ops->postdisable(indio_dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error_ret;
|
goto error_ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ int ade7758_configure_ring(struct iio_dev *indio_dev)
|
||||||
|
|
||||||
/* Effectively select the ring buffer implementation */
|
/* Effectively select the ring buffer implementation */
|
||||||
indio_dev->buffer->access = &ring_sw_access_funcs;
|
indio_dev->buffer->access = &ring_sw_access_funcs;
|
||||||
indio_dev->buffer->setup_ops = &ade7758_ring_setup_ops;
|
indio_dev->setup_ops = &ade7758_ring_setup_ops;
|
||||||
indio_dev->buffer->owner = THIS_MODULE;
|
indio_dev->buffer->owner = THIS_MODULE;
|
||||||
|
|
||||||
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
indio_dev->pollfunc = iio_alloc_pollfunc(&iio_pollfunc_store_time,
|
||||||
|
|
Loading…
Add table
Reference in a new issue