iio: pressure: rohm-bm1390: 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: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://patch.msgid.link/20250331121317.1694135-30-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Jonathan Cameron
2025-03-31 13:13:09 +01:00
parent 1bfa7698bc
commit 71a998e791

View File

@@ -319,12 +319,11 @@ static int bm1390_read_raw(struct iio_dev *idev,
return -EINVAL;
case IIO_CHAN_INFO_RAW:
ret = iio_device_claim_direct_mode(idev);
if (ret)
return ret;
if (!iio_device_claim_direct(idev))
return -EBUSY;
ret = bm1390_read_data(data, chan, val, val2);
iio_device_release_direct_mode(idev);
iio_device_release_direct(idev);
if (ret)
return ret;