iio: adc: ti-ads1015: use iio_device_claim_direct_mode()
authorAkinobu Mita <akinobu.mita@gmail.com>
Thu, 20 Jul 2017 15:24:26 +0000 (00:24 +0900)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 20 Aug 2017 14:41:17 +0000 (15:41 +0100)
commit47d8cf41d501902be523b9e3cf1909413cc19e97
treee5b8cb3ad7dcd6aa31c72090b0f961c2af5e2c6f
parent4de43d250672ae9f34ed4d9279235807ca4d66d3
iio: adc: ti-ads1015: use iio_device_claim_direct_mode()

While the iio buffer for the ti-ads1015 driver is enabled, reading the
raw ADC channel data is restricted.  We usually use the
iio_device_claim_direct_mode()/iio_device_release_direct_mode() pair for
that.

This change consequently reverses the locking order for the driver's
private lock and indio_dev->mlock which acquired by
iio_device_claim_direct_mode() internally. But it's safe because there is
no other dependency between these locks.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ti-ads1015.c