]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
iio: core: implement iio_device_{claim|release}_direct_mode()
authorAlison Schofield <amsfield22@gmail.com>
Wed, 9 Mar 2016 19:30:12 +0000 (11:30 -0800)
committerJonathan Cameron <jic23@kernel.org>
Sat, 12 Mar 2016 11:17:19 +0000 (11:17 +0000)
commit08a33805518e7845486f88287e8aace6f8439391
treeb1eccda86f0d406bcd95f24c7c234220ee5d408d
parente8731180fbf6fd45351b587d67cdc0685ce99a7a
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>
drivers/iio/industrialio-core.c
include/linux/iio/iio.h