From: Jonathan Cameron Date: Mon, 31 Mar 2025 12:12:49 +0000 (+0100) Subject: iio: health: max30102: Switch to sparse friendly iio_device_claim/release_direct() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6c9dc1e8f296effd17f36a4653f6928c17a16dce;p=users%2Fjedix%2Flinux-maple.git iio: health: max30102: 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. This particular case is about ensuring the mode does not change rather than ensuring we are in direct mode. A follow up may cleanup the buffer mode claim. Reviewed-by: David Lechner Reviewed-by: Marcelo Schmitt Link: https://patch.msgid.link/20250331121317.1694135-10-jic23@kernel.org Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/health/max30102.c b/drivers/iio/health/max30102.c index 1d074eb6a8c5e..dacc489f72932 100644 --- a/drivers/iio/health/max30102.c +++ b/drivers/iio/health/max30102.c @@ -484,11 +484,11 @@ any_mode_retry: * things cannot concurrently change. And we just keep * trying until we get one of the modes... */ - if (iio_device_claim_direct_mode(indio_dev)) + if (!iio_device_claim_direct(indio_dev)) goto any_mode_retry; ret = max30102_get_temp(data, val, true); - iio_device_release_direct_mode(indio_dev); + iio_device_release_direct(indio_dev); } else { ret = max30102_get_temp(data, val, false); iio_device_release_buffer_mode(indio_dev);