iio: adc: vf610_adc: vf610_adc: do not use internal iio_dev lock
authorNuno Sá <nuno.sa@analog.com>
Tue, 4 Oct 2022 13:49:03 +0000 (15:49 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 23 Nov 2022 19:43:58 +0000 (19:43 +0000)
commit4e15cad8dbf9991d430c31166040575bf972b179
treef16c0653dec9ce943c7a75bcee93b1844b65bb0d
parentf2bdea865e776b571557035eac2e8afde8ea7844
iio: adc: vf610_adc: vf610_adc: do not use internal iio_dev lock

In order to drop the internal lock usage we needed two different things:

1) The first place where 'mlock' was being used was a typical case where
iio_device_claim_direct_mode() fits perfectly.
2) In the second case, it was being used to prevent concurrent accesses
to the device and shared data but nothing was being enforced with
regards to buffering (i.e, there was nothing preventing from changing
the conversion mode while buffering). Hence, in this case, a new lock
was introduced in the state structure.

Note that the goal is not to introduce any functional change and that is
the reason why a new lock was introduced to guarantee 2).

While at it, properly include "mutex.h" for mutex related APIs.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Link: https://lore.kernel.org/r/20221004134909.1692021-11-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/vf610_adc.c