iio: adc: ad7793: claim direct mode when writing frequency
authorAlison Schofield <amsfield22@gmail.com>
Thu, 2 Jun 2016 04:28:14 +0000 (21:28 -0700)
committerJonathan Cameron <jic23@kernel.org>
Fri, 3 Jun 2016 12:01:14 +0000 (13:01 +0100)
commitafa814841c812cd1a36dbbb124542a487c2df5ee
treecdb8d71bf49fb07b0404138c21a5ecd861e291b7
parent7c7e9dad7017ff5b5f0524ea6d85dcda3c62431e
iio: adc: ad7793: claim direct mode when writing frequency

Driver was checking for direct mode and trying to lock it, but
left a gap where mode could change before the desired operation.
Use iio_device_claim_direct_mode() to guarantee device stays in
direct mode.

Refactor function to clarify look-up followed by lock sequence.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/adc/ad7793.c