]> git.baikalelectronics.ru Git - kernel.git/commit
iio: dac: ad5592r: localize locks only where needed in ad5592r_read_raw()
authorAlexandru Ardelean <alexandru.ardelean@analog.com>
Mon, 6 Jul 2020 11:02:59 +0000 (14:02 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 21 Sep 2020 17:54:18 +0000 (18:54 +0100)
commitb783b33b952d2913c57ada0c0e8d74c69c1ac177
tree62911c388a6de869ab6b715177f5f05ac4f0f384
parent2f4a6cad579b8731cc30b45569b9254711ba4738
iio: dac: ad5592r: localize locks only where needed in ad5592r_read_raw()

Since there was a recently discovered issue with these locks, it probably
makes sense to cleanup the code a bit, to prevent it from being used as an
example/reference.

This change moves the lock only where it is explicitly needed to protect
resources from potential concurrent accesses.

It also reworks the switch statements to do direct returns vs caching the
return value on a variable.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20200706110259.23947-3-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/dac/ad5592r-base.c