iio: light: st_uvis25: Switch to sparse friendly iio_device_claim/release_direct()
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 9 Mar 2025 17:06:29 +0000 (17:06 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 22 Apr 2025 18:09:56 +0000 (19:09 +0100)
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-15-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/st_uvis25_core.c

index 40a8100..124a8f9 100644 (file)
@@ -117,9 +117,8 @@ static int st_uvis25_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;
 
        switch (mask) {
        case IIO_CHAN_INFO_PROCESSED: {
@@ -144,7 +143,7 @@ static int st_uvis25_read_raw(struct iio_dev *iio_dev,
                break;
        }
 
-       iio_device_release_direct_mode(iio_dev);
+       iio_device_release_direct(iio_dev);
 
        return ret;
 }