aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/iio
diff options
context:
space:
mode:
authorAlexandru Ardelean <alexandru.ardelean@analog.com>2020-02-25 12:33:19 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2020-03-08 17:28:51 +0000
commit2303248b291f537f0414a644a53483c71023136f (patch)
treebf004798d8952726117f91d52b1b3d8fd49adb2d /include/linux/iio
parentiio: imu: adis: update 'adis_data' struct doc-string (diff)
downloadlinux-dev-2303248b291f537f0414a644a53483c71023136f.tar.xz
linux-dev-2303248b291f537f0414a644a53483c71023136f.zip
iio: imu: adis: add a note better explaining state_lock
The 'state_lock' mutex was renamed from 'txrx_lock' in a previous patch and is intended to be used by ADIS drivers to protect the state of devices during consecutive R/W ops. The initial patch that introduced this change did not do a good [well, any] job at explaining this. This patch adds a comment to the 'state_lock' better explaining it's use. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'include/linux/iio')
-rw-r--r--include/linux/iio/imu/adis.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
index 20339025c75f..dd8219138c2e 100644
--- a/include/linux/iio/imu/adis.h
+++ b/include/linux/iio/imu/adis.h
@@ -98,6 +98,17 @@ struct adis {
const struct adis_data *data;
struct adis_burst *burst;
+ /**
+ * The state_lock is meant to be used during operations that require
+ * a sequence of SPI R/W in order to protect the SPI transfer
+ * information (fields 'xfer', 'msg' & 'current_page') between
+ * potential concurrent accesses.
+ * This lock is used by all "adis_{functions}" that have to read/write
+ * registers. These functions also have unlocked variants
+ * (see "__adis_{functions}"), which don't hold this lock.
+ * This allows users of the ADIS library to group SPI R/W into
+ * the drivers, but they also must manage this lock themselves.
+ */
struct mutex state_lock;
struct spi_message msg;
struct spi_transfer *xfer;