All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eugene Zaikonnikov <ez@norphonic.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 12/37] iio: humidity: hdc2010: Switch to sparse friendly iio_device_claim/release_direct()
Date: Tue, 01 Apr 2025 08:59:58 +0200	[thread overview]
Message-ID: <86ecyccqj1.fsf@norphonic.com> (raw)
In-Reply-To: <20250331121317.1694135-13-jic23@kernel.org>

Hi Jonathan,

Thanks for the patch. It looks good to me.

Acked-by: Eugene Zaikonnikov <ez@norphonic.com>

Jonathan Cameron <jic23@kernel.org> writes:

> 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: Eugene Zaikonnikov <ez@norphonic.com>
> ---
>  drivers/iio/humidity/hdc2010.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/iio/humidity/hdc2010.c b/drivers/iio/humidity/hdc2010.c
> index f5867659e00f..894a8b4ab193 100644
> --- a/drivers/iio/humidity/hdc2010.c
> +++ b/drivers/iio/humidity/hdc2010.c
> @@ -169,13 +169,12 @@ static int hdc2010_read_raw(struct iio_dev *indio_dev,
>  			*val = hdc2010_get_heater_status(data);
>  			return IIO_VAL_INT;
>  		}
> -		ret = iio_device_claim_direct_mode(indio_dev);
> -		if (ret)
> -			return ret;
> +		if (!iio_device_claim_direct(indio_dev))
> +			return -EBUSY;
>  		mutex_lock(&data->lock);
>  		ret = hdc2010_get_prim_measurement_word(data, chan);
>  		mutex_unlock(&data->lock);
> -		iio_device_release_direct_mode(indio_dev);
> +		iio_device_release_direct(indio_dev);
>  		if (ret < 0)
>  			return ret;
>  		*val = ret;
> @@ -184,13 +183,12 @@ static int hdc2010_read_raw(struct iio_dev *indio_dev,
>  	case IIO_CHAN_INFO_PEAK: {
>  		int ret;
>  
> -		ret = iio_device_claim_direct_mode(indio_dev);
> -		if (ret)
> -			return ret;
> +		if (!iio_device_claim_direct(indio_dev))
> +			return -EBUSY;
>  		mutex_lock(&data->lock);
>  		ret = hdc2010_get_peak_measurement_byte(data, chan);
>  		mutex_unlock(&data->lock);
> -		iio_device_release_direct_mode(indio_dev);
> +		iio_device_release_direct(indio_dev);
>  		if (ret < 0)
>  			return ret;
>  		/* Scaling up the value so we can use same offset as RAW */


-- 
Regards,

  Eugene Zaikonnikov

  Norphonic AS
  Tel: +47 98 23 97 73

  reply	other threads:[~2025-04-01  7:03 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-31 12:12 [PATCH 00/37] IIO: Sparse friendly claim of direct mode (the rest) Jonathan Cameron
2025-03-31 12:12 ` [PATCH 01/37] iio: addac: ad74115: Switch to sparse friendly iio_device_claim/release_direct() Jonathan Cameron
2025-03-31 12:12 ` [PATCH 02/37] iio: chemical: ccs811: Factor out handling of read of IIO_INFO_RAW to simplify error paths Jonathan Cameron
2025-03-31 12:12 ` [PATCH 03/37] iio: chemical: ccs811: Switch to sparse friendly iio_device_claim/release_direct() Jonathan Cameron
2025-03-31 12:12 ` [PATCH 04/37] iio: chemical: atlas-sensor: " Jonathan Cameron
2025-03-31 12:12 ` [PATCH 05/37] iio: chemical: scd4x: " Jonathan Cameron
2025-03-31 12:12 ` [PATCH 06/37] iio: common: scmi: " Jonathan Cameron
2025-03-31 12:12 ` [PATCH 07/37] iio: common: st_sensors: " Jonathan Cameron
2025-03-31 12:12 ` [PATCH 08/37] iio: gyro: adxrs290: " Jonathan Cameron
2025-03-31 12:12 ` [PATCH 09/37] iio: health: max30102: " Jonathan Cameron
2025-03-31 12:12 ` [PATCH 10/37] iio: humidity: hdc100x: Use guard(mutex) to simplify code flow Jonathan Cameron
2025-03-31 12:12 ` [PATCH 11/37] iio: humidity: hdc100x: Switch to sparse friendly iio_device_claim/release_direct() Jonathan Cameron
2025-03-31 12:12 ` [PATCH 12/37] iio: humidity: hdc2010: " Jonathan Cameron
2025-04-01  6:59   ` Eugene Zaikonnikov [this message]
2025-03-31 12:12 ` [PATCH 13/37] iio: humidity: hts211: Factor out everything under direct mode claim into helper functions Jonathan Cameron
2025-04-01  6:33   ` Lorenzo Bianconi
2025-03-31 12:12 ` [PATCH 14/37] iio: humidity: hts211: Switch to sparse friendly iio_device_claim/release_direct() Jonathan Cameron
2025-04-01  6:34   ` Lorenzo Bianconi
2025-03-31 12:12 ` [PATCH 15/37] iio: imu: inv_icm42600: " Jonathan Cameron
2025-03-31 14:27   ` Jean-Baptiste Maneyrol
2025-03-31 12:12 ` [PATCH 16/37] iio: imu: inv_mpu6050: " Jonathan Cameron
2025-03-31 13:57   ` Jean-Baptiste Maneyrol
2025-03-31 12:12 ` [PATCH 17/37] iio: imu: smi240: " Jonathan Cameron
2025-03-31 12:12 ` [PATCH 18/37] iio: imu: st_lsm6dsx: Factor out parts of st_lsm6dsx_shub_write_raw() to allow direct returns Jonathan Cameron
2025-03-31 14:31   ` David Lechner
2025-04-01  6:28     ` Lorenzo Bianconi
2025-04-06 13:15       ` Jonathan Cameron
2025-04-01  6:27   ` Lorenzo Bianconi
2025-03-31 12:12 ` [PATCH 19/37] iio: imu: st_lsm6dsx: Switch to sparse friendly claim/release_direct() Jonathan Cameron
2025-04-01  6:31   ` Lorenzo Bianconi
2025-03-31 12:13 ` [PATCH 20/37] iio: imu: st_lsm6dsx: Switch to sparse friendly iio_device_claim/release_direct() Jonathan Cameron
2025-04-01  6:29   ` Lorenzo Bianconi
2025-03-31 12:13 ` [PATCH 21/37] iio: magnetometer: mag3110: Factor out core of read/write_raw() and use guard() to simplify code flow Jonathan Cameron
2025-03-31 12:13 ` [PATCH 22/37] iio: magnetometer: mag3110: Switch to sparse friendly iio_device_claim/release_direct() Jonathan Cameron
2025-03-31 12:13 ` [PATCH 23/37] iio: magnetometer: rm3100: " Jonathan Cameron
2025-03-31 12:13 ` [PATCH 24/37] iio: pressure: dlhl60d: " Jonathan Cameron
2025-03-31 12:13 ` [PATCH 25/37] iio: pressure: icp10100: " Jonathan Cameron
2025-03-31 14:03   ` Jean-Baptiste Maneyrol
2025-03-31 12:13 ` [PATCH 26/37] iio: pressure: mpl3115: factor out core of IIO_INFO_RAW read to simplify code flow Jonathan Cameron
2025-03-31 12:13 ` [PATCH 27/37] iio: pressure: mpl3115: Switch to sparse friendly iio_device_claim/release_direct() Jonathan Cameron
2025-03-31 12:13 ` [PATCH 28/37] iio: pressure: ms5611: " Jonathan Cameron
2025-03-31 12:13 ` [PATCH 29/37] iio: pressure: rohm-bm1390: " Jonathan Cameron
2025-04-01 13:14   ` Matti Vaittinen
2025-03-31 12:13 ` [PATCH 30/37] iio: pressure: zpa2326: " Jonathan Cameron
2025-03-31 12:13 ` [PATCH 31/37] iio: proximity: hx9023s: " Jonathan Cameron
2025-03-31 12:13 ` [PATCH 32/37] iio: proximity: pulsed-light: " Jonathan Cameron
2025-03-31 12:13 ` [PATCH 33/37] iio: proximity: sx9500: " Jonathan Cameron
2025-03-31 12:13 ` [PATCH 34/37] iio: temp: maxim_thermocouple: " Jonathan Cameron
2025-03-31 12:13 ` [PATCH 35/37] iio: temp: maxim_thermocouple: Drop unused mutex.h include Jonathan Cameron
2025-03-31 12:13 ` [PATCH 36/37] staging: iio: ad5933: Switch to sparse friendly iio_device_claim/release_direct() Jonathan Cameron
2025-03-31 12:13 ` [PATCH 37/37] iio: Adjust internals of handling of direct mode claiming to suit new API Jonathan Cameron
2025-03-31 13:41   ` Andy Shevchenko
2025-03-31 14:07     ` David Lechner
2025-04-05 16:34     ` Jonathan Cameron
2025-04-05 16:46       ` Andy Shevchenko
2025-04-01 19:13 ` [PATCH 00/37] IIO: Sparse friendly claim of direct mode (the rest) David Lechner
2025-04-06 13:20   ` Jonathan Cameron
2025-04-12 18:54 ` Marcelo Schmitt

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=86ecyccqj1.fsf@norphonic.com \
    --to=ez@norphonic.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.