iio: adc: ad7791: claim direct mode when writing frequency
authorAlison Schofield <amsfield22@gmail.com>
Wed, 1 Jun 2016 04:35:49 +0000 (21:35 -0700)
committerJonathan Cameron <jic23@kernel.org>
Fri, 3 Jun 2016 12:12:50 +0000 (13:12 +0100)
commitd7203ad864db0b34f0e106ec0659890c4e58c143
treef1e4612e277b371c44c13099c8342ca2066259a3
parentafa814841c812cd1a36dbbb124542a487c2df5ee
iio: adc: ad7791: 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/ad7791.c