diff options
author | Alison Schofield <amsfield22@gmail.com> | 2016-03-09 22:30:12 +0300 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-03-12 14:17:19 +0300 |
commit | 08a33805518e7845486f88287e8aace6f8439391 (patch) | |
tree | b1eccda86f0d406bcd95f24c7c234220ee5d408d /include/linux/iio/iio.h | |
parent | e8731180fbf6fd45351b587d67cdc0685ce99a7a (diff) | |
download | linux-08a33805518e7845486f88287e8aace6f8439391.tar.xz |
iio: core: implement iio_device_{claim|release}_direct_mode()
It is often the case that the driver wants to be sure a device stays
in direct mode while it is executing a task or series of tasks. To
accomplish this today, the driver performs this sequence: 1) take the
device state lock, 2) verify it is not in a buffered mode, 3) execute
some tasks, and 4) release that lock.
This patch introduces a pair of helper functions that simplify these
steps and make it more semantically expressive.
iio_device_claim_direct_mode()
If the device is not in any buffered mode it is guaranteed
to stay that way until iio_release_direct_mode() is called.
iio_device_release_direct_mode()
Release the claim. Device is no longer guaranteed to stay
in direct mode.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'include/linux/iio/iio.h')
-rw-r--r-- | include/linux/iio/iio.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index b2b16772c651..0b2773ada0ba 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -527,6 +527,8 @@ void iio_device_unregister(struct iio_dev *indio_dev); int devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev); void devm_iio_device_unregister(struct device *dev, struct iio_dev *indio_dev); int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp); +int iio_device_claim_direct_mode(struct iio_dev *indio_dev); +void iio_device_release_direct_mode(struct iio_dev *indio_dev); extern struct bus_type iio_bus_type; |