iio: pressure: ms5611: 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> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://patch.msgid.link/20250331121317.1694135-29-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
@@ -308,7 +308,6 @@ static int ms5611_write_raw(struct iio_dev *indio_dev,
|
||||
{
|
||||
struct ms5611_state *st = iio_priv(indio_dev);
|
||||
const struct ms5611_osr *osr = NULL;
|
||||
int ret;
|
||||
|
||||
if (mask != IIO_CHAN_INFO_OVERSAMPLING_RATIO)
|
||||
return -EINVAL;
|
||||
@@ -322,9 +321,8 @@ static int ms5611_write_raw(struct iio_dev *indio_dev,
|
||||
if (!osr)
|
||||
return -EINVAL;
|
||||
|
||||
ret = iio_device_claim_direct_mode(indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!iio_device_claim_direct(indio_dev))
|
||||
return -EBUSY;
|
||||
|
||||
mutex_lock(&st->lock);
|
||||
|
||||
@@ -334,7 +332,7 @@ static int ms5611_write_raw(struct iio_dev *indio_dev,
|
||||
st->pressure_osr = osr;
|
||||
|
||||
mutex_unlock(&st->lock);
|
||||
iio_device_release_direct_mode(indio_dev);
|
||||
iio_device_release_direct(indio_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user