From: Jonathan Cameron Date: Sun, 9 Mar 2025 17:06:16 +0000 (+0000) Subject: iio: light: apds9306: Switch to sparse friendly iio_device_claim/release_direct() X-Git-Tag: v6.16-rc1~30^2~4^2~196 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=354eedf0083f4d7b22743b84e9419a560e862377;p=linux-block.git iio: light: apds9306: 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: Subhajit Ghosh Reviewed-by: David Lechner Link: https://patch.msgid.link/20250309170633.1347476-2-jic23@kernel.org Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/light/apds9306.c b/drivers/iio/light/apds9306.c index 5ed7e17f49e7..e9b237de180a 100644 --- a/drivers/iio/light/apds9306.c +++ b/drivers/iio/light/apds9306.c @@ -831,11 +831,10 @@ static int apds9306_read_raw(struct iio_dev *indio_dev, * Changing device parameters during adc operation, resets * the ADC which has to avoided. */ - ret = iio_device_claim_direct_mode(indio_dev); - if (ret) - return ret; + if (!iio_device_claim_direct(indio_dev)) + return -EBUSY; ret = apds9306_read_data(data, val, reg); - iio_device_release_direct_mode(indio_dev); + iio_device_release_direct(indio_dev); if (ret) return ret;