mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 02:53:36 +02:00
iio: adc: ad7606: protect register access
Protect register (and bus) access from concurrent read / write. Needed in the backend operating mode. Signed-off-by: Angelo Dureghello <adureghello@baylibre.com> Link: https://patch.msgid.link/20250210-wip-bl-ad7606_add_backend_sw_mode-v4-7-160df18b1da7@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
79c47485e4
commit
0f65f59e63
|
|
@ -862,7 +862,12 @@ static int ad7606_write_raw(struct iio_dev *indio_dev,
|
|||
}
|
||||
val = (val * MICRO) + val2;
|
||||
i = find_closest(val, scale_avail_uv, cs->num_scales);
|
||||
|
||||
ret = iio_device_claim_direct_mode(indio_dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = st->write_scale(indio_dev, ch, i + cs->reg_offset);
|
||||
iio_device_release_direct_mode(indio_dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
cs->range = i;
|
||||
|
|
@ -873,7 +878,12 @@ static int ad7606_write_raw(struct iio_dev *indio_dev,
|
|||
return -EINVAL;
|
||||
i = find_closest(val, st->oversampling_avail,
|
||||
st->num_os_ratios);
|
||||
|
||||
ret = iio_device_claim_direct_mode(indio_dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = st->write_os(indio_dev, i);
|
||||
iio_device_release_direct_mode(indio_dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
st->oversampling = st->oversampling_avail[i];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user