mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 08:02:27 +02:00
iio: light: rohm-bu27034: 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. Acked-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250309170633.1347476-11-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
7e8c0ec196
commit
e08acc4c82
|
|
@ -998,9 +998,8 @@ static int bu27034_read_raw(struct iio_dev *idev,
|
|||
return -EINVAL;
|
||||
|
||||
/* Don't mess with measurement enabling while buffering */
|
||||
ret = iio_device_claim_direct_mode(idev);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!iio_device_claim_direct(idev))
|
||||
return -EBUSY;
|
||||
|
||||
mutex_lock(&data->mutex);
|
||||
/*
|
||||
|
|
@ -1011,7 +1010,7 @@ static int bu27034_read_raw(struct iio_dev *idev,
|
|||
ret = result_get(data, chan->channel, val);
|
||||
|
||||
mutex_unlock(&data->mutex);
|
||||
iio_device_release_direct_mode(idev);
|
||||
iio_device_release_direct(idev);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
@ -1050,9 +1049,8 @@ static int bu27034_write_raw(struct iio_dev *idev,
|
|||
struct bu27034_data *data = iio_priv(idev);
|
||||
int ret;
|
||||
|
||||
ret = iio_device_claim_direct_mode(idev);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!iio_device_claim_direct(idev))
|
||||
return -EBUSY;
|
||||
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_SCALE:
|
||||
|
|
@ -1069,7 +1067,7 @@ static int bu27034_write_raw(struct iio_dev *idev,
|
|||
break;
|
||||
}
|
||||
|
||||
iio_device_release_direct_mode(idev);
|
||||
iio_device_release_direct(idev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user