]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iio: core: mark scan_timestamp as __private
authorVasileios Amoiridis <vassilisamir@gmail.com>
Sat, 14 Dec 2024 19:14:21 +0000 (20:14 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 28 Dec 2024 14:28:14 +0000 (14:28 +0000)
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>
drivers/iio/industrialio-buffer.c
include/linux/iio/buffer.h
include/linux/iio/iio.h

index 2708f87df7198f7ac79dd533f7502db44535638a..a80f7cc25a27109cfe22ce447c4117fc94bc8310 100644 (file)
@@ -1137,7 +1137,7 @@ static int iio_enable_buffers(struct iio_dev *indio_dev,
        int ret;
 
        indio_dev->active_scan_mask = config->scan_mask;
-       indio_dev->scan_timestamp = config->scan_timestamp;
+       ACCESS_PRIVATE(indio_dev, scan_timestamp) = config->scan_timestamp;
        indio_dev->scan_bytes = config->scan_bytes;
        iio_dev_opaque->currentmode = config->mode;
 
index 418b1307d3f2cb7765026ef50fdc451c832470cd..3b8d618bb3dfaa6e32c2c713b12d11af6bb22ec2 100644 (file)
@@ -37,7 +37,7 @@ int iio_pop_from_buffer(struct iio_buffer *buffer, void *data);
 static inline int iio_push_to_buffers_with_timestamp(struct iio_dev *indio_dev,
        void *data, int64_t timestamp)
 {
-       if (indio_dev->scan_timestamp) {
+       if (ACCESS_PRIVATE(indio_dev, scan_timestamp)) {
                size_t ts_offset = indio_dev->scan_bytes / sizeof(int64_t) - 1;
                ((int64_t *)data)[ts_offset] = timestamp;
        }
index ae65890d456772f11eee76bd1a2cafbc5f16b7ec..56161e02f002cbe3a835cefce0e702c0f9776c81 100644 (file)
@@ -611,7 +611,7 @@ struct iio_dev {
        const unsigned long             *available_scan_masks;
        unsigned int                    __private masklength;
        const unsigned long             *active_scan_mask;
-       bool                            scan_timestamp;
+       bool                            __private scan_timestamp;
        struct iio_trigger              *trig;
        struct iio_poll_func            *pollfunc;
        struct iio_poll_func            *pollfunc_event;