iio: light: tcs3414: use iio helper function to guarantee direct mode
authorAlison Schofield <amsfield22@gmail.com>
Tue, 7 Jun 2016 05:09:21 +0000 (22:09 -0700)
committerJonathan Cameron <jic23@kernel.org>
Sat, 11 Jun 2016 16:14:08 +0000 (17:14 +0100)
commitb67869791084662e7428e4598129651c29c93667
treec76b221426bd42e14381eed3ae5c54f2e108f1de
parent9e18265443d3a76462eafc3a0863c217aeaf62ac
iio: light: tcs3414: use iio helper function to guarantee direct mode

Replace the code that guarantees the device stays in direct mode
with iio_device_claim_direct_mode() which does same.  This allows
removal of an unused lock in the device private global data.

Also prevents a possible race around a buffer being enabled whilst
a read is going on.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/light/tcs3414.c