Skip to content

Commit

Permalink
staging:iio:buffer add a cache of the timestamp scan index.
Browse files Browse the repository at this point in the history
Basically avoids looking it up lots of times.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Jonathan Cameron authored and Greg Kroah-Hartman committed Dec 8, 2011
1 parent 5fb21c8 commit beb8060
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/staging/iio/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ struct iio_buffer {
int scan_count;
long *scan_mask;
bool scan_timestamp;
unsigned scan_index_timestamp;
const struct iio_buffer_access_funcs *access;
const struct iio_buffer_setup_ops *setup_ops;
struct list_head scan_el_dev_attr_list;
Expand Down
3 changes: 3 additions & 0 deletions drivers/staging/iio/industrialio-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ int iio_buffer_register(struct iio_dev *indio_dev,
if (ret < 0)
goto error_cleanup_dynamic;
attrcount += ret;
if (channels[i].type == IIO_TIMESTAMP)
buffer->scan_index_timestamp =
channels[i].scan_index;
}
if (indio_dev->masklength && buffer->scan_mask == NULL) {
buffer->scan_mask = kcalloc(BITS_TO_LONGS(indio_dev->masklength),
Expand Down

0 comments on commit beb8060

Please sign in to comment.