[PATCH RFC 1/6] iio: create accessor for iio_dev->scan_timestamp

From: Vasileios Amoiridis
Date: Fri Nov 29 2024 - 19:27:41 EST


"scan_timestamp" is supposed to be an internal member of the iio device
structure. However, there are some drivers that are using it directly.

For that reason, the following accessor is created:

iio_is_soft_ts_enabled()

The goal of this accessor, is to ultimately mark "scan_timestamp" as
a __private member of the struct iio_dev.

Signed-off-by: Vasileios Amoiridis <vassilisamir@xxxxxxxxx>
---
include/linux/iio/iio.h | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index ae65890d4567..5661794d1127 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -902,6 +902,15 @@ int iio_active_scan_mask_index(struct iio_dev *indio_dev);
for_each_set_bit((chan), (indio_dev)->active_scan_mask, \
iio_get_masklength(indio_dev))

+/**
+ * iio_is_soft_ts_enabled - Check if the software timestamp is enabled
+ * @indio_dev: the IIO device
+ */
+static inline bool iio_is_soft_ts_enabled(const struct iio_dev *indio_dev)
+{
+ return indio_dev->scan_timestamp;
+}
+
ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals);

int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer,
--
2.43.0