staging:iio: scan_index_timestamp move to iio_dev from buffer
This is just a locally cached value that is device specific (rather than buffer specific.) Hence it wants to come out of the buffer before we add multiple buffer support. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6b3b58ed15
commit
f1264809eb
|
@ -56,7 +56,6 @@ struct iio_buffer_access_funcs {
|
||||||
* @scan_el_attrs: [DRIVER] control of scan elements if that scan mode
|
* @scan_el_attrs: [DRIVER] control of scan elements if that scan mode
|
||||||
* control method is used
|
* control method is used
|
||||||
* @scan_mask: [INTERN] bitmask used in masking scan mode elements
|
* @scan_mask: [INTERN] bitmask used in masking scan mode elements
|
||||||
* @scan_index_timestamp:[INTERN] cache of the index to the timestamp
|
|
||||||
* @scan_timestamp: [INTERN] does the scan mode include a timestamp
|
* @scan_timestamp: [INTERN] does the scan mode include a timestamp
|
||||||
* @access: [DRIVER] buffer access functions associated with the
|
* @access: [DRIVER] buffer access functions associated with the
|
||||||
* implementation.
|
* implementation.
|
||||||
|
@ -74,7 +73,6 @@ struct iio_buffer {
|
||||||
struct attribute_group *scan_el_attrs;
|
struct attribute_group *scan_el_attrs;
|
||||||
long *scan_mask;
|
long *scan_mask;
|
||||||
bool scan_timestamp;
|
bool scan_timestamp;
|
||||||
unsigned scan_index_timestamp;
|
|
||||||
const struct iio_buffer_access_funcs *access;
|
const struct iio_buffer_access_funcs *access;
|
||||||
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;
|
||||||
|
|
|
@ -305,6 +305,7 @@ struct iio_buffer_setup_ops {
|
||||||
* @masklength: [INTERN] the length of the mask established from
|
* @masklength: [INTERN] the length of the mask established from
|
||||||
* channels
|
* channels
|
||||||
* @active_scan_mask: [INTERN] union of all scan masks requested by buffers
|
* @active_scan_mask: [INTERN] union of all scan masks requested by buffers
|
||||||
|
* @scan_index_timestamp:[INTERN] cache of the index to the timestamp
|
||||||
* @trig: [INTERN] current device trigger (buffer modes)
|
* @trig: [INTERN] current device trigger (buffer modes)
|
||||||
* @pollfunc: [DRIVER] function run on trigger being received
|
* @pollfunc: [DRIVER] function run on trigger being received
|
||||||
* @channels: [DRIVER] channel specification structure table
|
* @channels: [DRIVER] channel specification structure table
|
||||||
|
@ -339,6 +340,7 @@ struct iio_dev {
|
||||||
const unsigned long *available_scan_masks;
|
const unsigned long *available_scan_masks;
|
||||||
unsigned masklength;
|
unsigned masklength;
|
||||||
const unsigned long *active_scan_mask;
|
const unsigned long *active_scan_mask;
|
||||||
|
unsigned scan_index_timestamp;
|
||||||
struct iio_trigger *trig;
|
struct iio_trigger *trig;
|
||||||
struct iio_poll_func *pollfunc;
|
struct iio_poll_func *pollfunc;
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,7 @@ int iio_buffer_register(struct iio_dev *indio_dev,
|
||||||
goto error_cleanup_dynamic;
|
goto error_cleanup_dynamic;
|
||||||
attrcount += ret;
|
attrcount += ret;
|
||||||
if (channels[i].type == IIO_TIMESTAMP)
|
if (channels[i].type == IIO_TIMESTAMP)
|
||||||
buffer->scan_index_timestamp =
|
indio_dev->scan_index_timestamp =
|
||||||
channels[i].scan_index;
|
channels[i].scan_index;
|
||||||
}
|
}
|
||||||
if (indio_dev->masklength && buffer->scan_mask == NULL) {
|
if (indio_dev->masklength && buffer->scan_mask == NULL) {
|
||||||
|
@ -525,8 +525,7 @@ static int iio_compute_scan_bytes(struct iio_dev *indio_dev, const long *mask,
|
||||||
}
|
}
|
||||||
if (timestamp) {
|
if (timestamp) {
|
||||||
ch = iio_find_channel_from_si(indio_dev,
|
ch = iio_find_channel_from_si(indio_dev,
|
||||||
indio_dev
|
indio_dev->scan_index_timestamp);
|
||||||
->buffer->scan_index_timestamp);
|
|
||||||
length = ch->scan_type.storagebits / 8;
|
length = ch->scan_type.storagebits / 8;
|
||||||
bytes = ALIGN(bytes, length);
|
bytes = ALIGN(bytes, length);
|
||||||
bytes += length;
|
bytes += length;
|
||||||
|
@ -721,7 +720,7 @@ int iio_update_demux(struct iio_dev *indio_dev)
|
||||||
goto error_clear_mux_table;
|
goto error_clear_mux_table;
|
||||||
}
|
}
|
||||||
ch = iio_find_channel_from_si(indio_dev,
|
ch = iio_find_channel_from_si(indio_dev,
|
||||||
buffer->scan_index_timestamp);
|
indio_dev->scan_index_timestamp);
|
||||||
length = ch->scan_type.storagebits/8;
|
length = ch->scan_type.storagebits/8;
|
||||||
if (out_loc % length)
|
if (out_loc % length)
|
||||||
out_loc += length - out_loc % length;
|
out_loc += length - out_loc % length;
|
||||||
|
|
Loading…
Reference in New Issue