mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 15:12:13 +02:00
iio: chemical: scd4x: Switch to sparse friendly iio_device_claim/release_direct()
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: Roan van Dijk <roan@protonic.nl> Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://patch.msgid.link/20250331121317.1694135-6-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
3976dc8323
commit
ba22e78635
|
|
@ -358,15 +358,14 @@ static int scd4x_read_raw(struct iio_dev *indio_dev,
|
|||
return IIO_VAL_INT;
|
||||
}
|
||||
|
||||
ret = iio_device_claim_direct_mode(indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!iio_device_claim_direct(indio_dev))
|
||||
return -EBUSY;
|
||||
|
||||
mutex_lock(&state->lock);
|
||||
ret = scd4x_read_channel(state, chan->address);
|
||||
mutex_unlock(&state->lock);
|
||||
|
||||
iio_device_release_direct_mode(indio_dev);
|
||||
iio_device_release_direct(indio_dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user