Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: adc: ti-adc161s626: Stop using iio_device_claim_direct_scoped()

This complex cleanup.h use case of conditional guards has proved
to be more trouble that it is worth in terms of false positive compiler
warnings and hard to read code.

Move directly to the new claim/release_direct() that allow sparse
to check for unbalanced context

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250209180624.701140-19-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

+7 -7
+7 -7
drivers/iio/adc/ti-adc161s626.c
··· 137 137 138 138 switch (mask) { 139 139 case IIO_CHAN_INFO_RAW: 140 - iio_device_claim_direct_scoped(return -EBUSY, indio_dev) { 141 - ret = ti_adc_read_measurement(data, chan, val); 142 - if (ret) 143 - return ret; 144 - return IIO_VAL_INT; 145 - } 146 - unreachable(); 140 + if (!iio_device_claim_direct(indio_dev)) 141 + return -EBUSY; 142 + ret = ti_adc_read_measurement(data, chan, val); 143 + iio_device_release_direct(indio_dev); 144 + if (ret) 145 + return ret; 146 + return IIO_VAL_INT; 147 147 case IIO_CHAN_INFO_SCALE: 148 148 ret = regulator_get_voltage(data->ref); 149 149 if (ret < 0)