iio: adc: mcp3422: fix locking scope
authorAngelo Compagnucci <angelo.compagnucci@gmail.com>
Wed, 19 Aug 2020 07:55:25 +0000 (09:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Sep 2020 06:46:10 +0000 (08:46 +0200)
commit91e8f0d6b347efe495aa9a0bdcb7b0cee1fb567e
treef7c54fb8ccf1ac3b03bcba0e6c844161f4010646
parent250f4087fc60a64c0f7954020da35cafa0a5af24
iio: adc: mcp3422: fix locking scope

commit 3f1093d83d7164e4705e4232ccf76da54adfda85 upstream.

Locking should be held for the entire reading sequence involving setting
the channel, waiting for the channel switch and reading from the
channel.
If not, reading from a channel can result mixing with the reading from
another channel.

Fixes: 07914c84ba30 ("iio: adc: Add driver for Microchip MCP3422/3/4 high resolution ADC")
Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Link: https://lore.kernel.org/r/20200819075525.1395248-1-angelo.compagnucci@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/adc/mcp3422.c