summaryrefslogtreecommitdiff
path: root/include/linux/iio
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2022-02-07 17:38:38 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2022-04-10 18:23:01 +0300
commit51570c9d4b3a678f77a50ac139f67290e946ec86 (patch)
tree2c7bdbe7c725c6ef27de8b355b820c8ac27af316 /include/linux/iio
parent8c576f87ad7eb639b8bd4472a9bb830e0696dda5 (diff)
downloadlinux-51570c9d4b3a678f77a50ac139f67290e946ec86.tar.xz
iio: core: Move the currentmode entry to the opaque structure
This entry should, under no situation, be modified by device drivers. Now that we have limited its read access to device drivers really needing it and did so through a dedicated helper, we can easily move this variable to the opaque structure in order to prevent any further modification from non-authorized code (out of the core, basically). Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/20220207143840.707510-12-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'include/linux/iio')
-rw-r--r--include/linux/iio/iio-opaque.h4
-rw-r--r--include/linux/iio/iio.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/iio/iio-opaque.h b/include/linux/iio/iio-opaque.h
index 2be12b7b5dc5..6b3586b3f952 100644
--- a/include/linux/iio/iio-opaque.h
+++ b/include/linux/iio/iio-opaque.h
@@ -7,6 +7,9 @@
* struct iio_dev_opaque - industrial I/O device opaque information
* @indio_dev: public industrial I/O device information
* @id: used to identify device internally
+ * @currentmode: operating mode currently in use, may be eventually
+ * checked by device drivers but should be considered
+ * read-only as this is a core internal bit
* @driver_module: used to make it harder to undercut users
* @info_exist_lock: lock to prevent use during removal
* @trig_readonly: mark the current trigger immutable
@@ -36,6 +39,7 @@
*/
struct iio_dev_opaque {
struct iio_dev indio_dev;
+ int currentmode;
int id;
struct module *driver_module;
struct mutex info_exist_lock;
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 31098ffa7dc9..85cb924debd9 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -494,9 +494,6 @@ struct iio_buffer_setup_ops {
* also be filed up by the IIO core, as a result of
* enabling particular features in the driver
* (see iio_triggered_event_setup()).
- * @currentmode: [INTERN] operating mode currently in use, may be
- * eventually checked by device drivers but should be
- * considered read-only as this is a core internal bit
* @dev: [DRIVER] device structure, should be assigned a parent
* and owner
* @buffer: [DRIVER] any buffer present
@@ -523,7 +520,6 @@ struct iio_buffer_setup_ops {
*/
struct iio_dev {
int modes;
- int currentmode;
struct device dev;
struct iio_buffer *buffer;