From: Jonathan Cameron <jic23@kernel.org>
To: "Frank Li" <Frank.Li@nxp.com>,
"Marek Vasut" <marek.vasut+renesas@gmail.com>,
linux-iio@vger.kernel.org, "Nuno Sá" <noname.nuno@gmail.com>
Cc: "Marek Vasut" <marex@denx.de>,
"Mike Looijmans" <mike.looijmans@topic.nl>,
"Nuno Sá" <nuno.sa@analog.com>,
"David Lechner" <dlechner@baylibre.com>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>
Subject: [PATCH v2 8/8] iio: adc: rcar: Switch to sparse friendly iio_device_claim/release_direct()
Date: Sun, 9 Mar 2025 16:58:19 +0000 [thread overview]
Message-ID: <20250309165819.1346684-9-jic23@kernel.org> (raw)
In-Reply-To: <20250309165819.1346684-1-jic23@kernel.org>
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Marek Vasut <marek.vasut+renesas@gmail.com>
---
drivers/iio/adc/rcar-gyroadc.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c
index 11170b5852d1..221c075da198 100644
--- a/drivers/iio/adc/rcar-gyroadc.c
+++ b/drivers/iio/adc/rcar-gyroadc.c
@@ -199,13 +199,12 @@ static int rcar_gyroadc_read_raw(struct iio_dev *indio_dev,
if (!consumer)
return -EINVAL;
- ret = iio_device_claim_direct_mode(indio_dev);
- if (ret)
- return ret;
+ if (!iio_device_claim_direct(indio_dev))
+ return -EBUSY;
ret = rcar_gyroadc_set_power(priv, true);
if (ret < 0) {
- iio_device_release_direct_mode(indio_dev);
+ iio_device_release_direct(indio_dev);
return ret;
}
@@ -213,7 +212,7 @@ static int rcar_gyroadc_read_raw(struct iio_dev *indio_dev,
*val &= BIT(priv->sample_width) - 1;
ret = rcar_gyroadc_set_power(priv, false);
- iio_device_release_direct_mode(indio_dev);
+ iio_device_release_direct(indio_dev);
if (ret < 0)
return ret;
--
2.48.1
next prev parent reply other threads:[~2025-03-09 16:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-09 16:58 [PATCH v2 0/8] IIO: ADCs: Sparse friendly claim of direct mode Jonathan Cameron
2025-03-09 16:58 ` [PATCH v2 1/8] iio: adc: vf610: Move claim of direct mode to caller of vf610_read_sample and use guard(mutex) Jonathan Cameron
2025-03-09 16:58 ` [PATCH v2 2/8] iio: adc: vf610: Switch to sparse friendly iio_device_claim/release_direct() Jonathan Cameron
2025-03-09 16:58 ` [PATCH v2 3/8] iio: adc: ti-ads1100: Use guard(mutex) to allow direct returns Jonathan Cameron
2025-03-09 16:58 ` [PATCH v2 4/8] iio: adc: ti-ads1100: Switch to sparse friendly iio_device_claim/release_direct() Jonathan Cameron
2025-03-09 16:58 ` [PATCH v2 5/8] iio: adc: ti-ads1015: Use guard(mutex) and factor out code for INFO_RAW Jonathan Cameron
2025-03-10 23:18 ` David Lechner
2025-03-31 11:32 ` Jonathan Cameron
2025-03-09 16:58 ` [PATCH v2 6/8] iio: adc: ti-ads1015: Switch to sparse friendly iio_device_claim/release_direct() Jonathan Cameron
2025-03-09 16:58 ` [PATCH v2 7/8] iio: adc: mxs-lradc: " Jonathan Cameron
2025-03-09 16:58 ` Jonathan Cameron [this message]
2025-03-10 23:21 ` [PATCH v2 0/8] IIO: ADCs: Sparse friendly claim of direct mode David Lechner
2025-03-31 11:33 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250309165819.1346684-9-jic23@kernel.org \
--to=jic23@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=marek.vasut+renesas@gmail.com \
--cc=marex@denx.de \
--cc=mike.looijmans@topic.nl \
--cc=noname.nuno@gmail.com \
--cc=nuno.sa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox