mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
iio: light: gp2ap020a00f: 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. Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-3-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
@@ -1283,12 +1283,11 @@ static int gp2ap020a00f_read_raw(struct iio_dev *indio_dev,
|
||||
int err = -EINVAL;
|
||||
|
||||
if (mask == IIO_CHAN_INFO_RAW) {
|
||||
err = iio_device_claim_direct_mode(indio_dev);
|
||||
if (err)
|
||||
return err;
|
||||
if (!iio_device_claim_direct(indio_dev))
|
||||
return -EBUSY;
|
||||
|
||||
err = gp2ap020a00f_read_channel(data, chan, val);
|
||||
iio_device_release_direct_mode(indio_dev);
|
||||
iio_device_release_direct(indio_dev);
|
||||
}
|
||||
return err < 0 ? err : IIO_VAL_INT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user