iio: humidity: hts211: 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: Lorenzo Bianconi <lorenzo@kernel.org> Reviewed-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Link: https://patch.msgid.link/20250331121317.1694135-15-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
@@ -464,13 +464,12 @@ static int hts221_read_raw(struct iio_dev *iio_dev,
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = iio_device_claim_direct_mode(iio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!iio_device_claim_direct(iio_dev))
|
||||
return -EBUSY;
|
||||
|
||||
ret = __hts221_read_raw(iio_dev, ch, val, val2, mask);
|
||||
|
||||
iio_device_release_direct_mode(iio_dev);
|
||||
iio_device_release_direct(iio_dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -504,13 +503,12 @@ static int hts221_write_raw(struct iio_dev *iio_dev,
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = iio_device_claim_direct_mode(iio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!iio_device_claim_direct(iio_dev))
|
||||
return -EBUSY;
|
||||
|
||||
ret = __hts221_write_raw(iio_dev, chan, val, mask);
|
||||
|
||||
iio_device_release_direct_mode(iio_dev);
|
||||
iio_device_release_direct(iio_dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user