aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/ad7298.c
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2025-02-17 14:16:29 +0000
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2025-03-04 13:17:50 +0000
commit1a21a9842e3b2e923c69cdccb3260a6d6b2494da (patch)
tree68596cd6bd258bd6b93d59bec835aa1d1fb5aab7 /drivers/iio/adc/ad7298.c
parentiio: adc: max11410: Switch to sparse friendly iio_device_claim/release_direct() (diff)
downloadlinux-1a21a9842e3b2e923c69cdccb3260a6d6b2494da.tar.gz
linux-1a21a9842e3b2e923c69cdccb3260a6d6b2494da.zip
iio: adc: Switch to sparse friendly iio_device_claim/release_direct()
Single patch for all the relatively simple cases. These new functions allow sparse to find failures to release direct mode reducing chances of bugs over the claim_direct_mode() functions that are deprecated. Cc: Olivier Moysan <olivier.moysan@foss.st.com> Cc: Phil Reid <preid@electromag.com.au> Reviewed-by: Mike Looijmans <mike.looijmans@topic.nl> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://patch.msgid.link/20250217141630.897334-30-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/ad7298.c')
-rw-r--r--drivers/iio/adc/ad7298.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/iio/adc/ad7298.c b/drivers/iio/adc/ad7298.c
index b35bd4d9ef81..28b88092b4aa 100644
--- a/drivers/iio/adc/ad7298.c
+++ b/drivers/iio/adc/ad7298.c
@@ -232,16 +232,15 @@ static int ad7298_read_raw(struct iio_dev *indio_dev,
switch (m) {
case IIO_CHAN_INFO_RAW:
- ret = iio_device_claim_direct_mode(indio_dev);
- if (ret)
- return ret;
+ if (!iio_device_claim_direct(indio_dev))
+ return -EBUSY;
if (chan->address == AD7298_CH_TEMP)
ret = ad7298_scan_temp(st, val);
else
ret = ad7298_scan_direct(st, chan->address);
- iio_device_release_direct_mode(indio_dev);
+ iio_device_release_direct(indio_dev);
if (ret < 0)
return ret;