Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: core: mark scan_timestamp as __private

Since there are no more direct accesses to the indio_dev->scan_timestamp
value, it can be marked as __private and use the macro ACCESS_PRIVATE()
in order to access it. Like this, static checkers will be able to inform
in case someone tries to either write to the value, or read its value
directly.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
Link: https://patch.msgid.link/20241214191421.94172-5-vassilisamir@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Vasileios Amoiridis and committed by
Jonathan Cameron
9351bbb1 6d0981f9

+3 -3
+1 -1
drivers/iio/industrialio-buffer.c
··· 1137 1137 int ret; 1138 1138 1139 1139 indio_dev->active_scan_mask = config->scan_mask; 1140 - indio_dev->scan_timestamp = config->scan_timestamp; 1140 + ACCESS_PRIVATE(indio_dev, scan_timestamp) = config->scan_timestamp; 1141 1141 indio_dev->scan_bytes = config->scan_bytes; 1142 1142 iio_dev_opaque->currentmode = config->mode; 1143 1143
+1 -1
include/linux/iio/buffer.h
··· 37 37 static inline int iio_push_to_buffers_with_timestamp(struct iio_dev *indio_dev, 38 38 void *data, int64_t timestamp) 39 39 { 40 - if (indio_dev->scan_timestamp) { 40 + if (ACCESS_PRIVATE(indio_dev, scan_timestamp)) { 41 41 size_t ts_offset = indio_dev->scan_bytes / sizeof(int64_t) - 1; 42 42 ((int64_t *)data)[ts_offset] = timestamp; 43 43 }
+1 -1
include/linux/iio/iio.h
··· 611 611 const unsigned long *available_scan_masks; 612 612 unsigned int __private masklength; 613 613 const unsigned long *active_scan_mask; 614 - bool scan_timestamp; 614 + bool __private scan_timestamp; 615 615 struct iio_trigger *trig; 616 616 struct iio_poll_func *pollfunc; 617 617 struct iio_poll_func *pollfunc_event;