public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Bharadwaj Raju <bharadwaj.raju777@gmail.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel-mentees@lists.linux.dev
Cc: LKML <linux-kernel@vger.kernel.org>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Nuno Sá" <nuno.sa@analog.com>, "Rob Herring" <robh@kernel.org>,
	"Shuah Khan" <shuah@kernel.org>
Subject: Re: [PATCH 5/5] iio: imu: icm20948: add runtime power management support
Date: Sun, 31 Aug 2025 21:23:08 +0200	[thread overview]
Message-ID: <33ca2805-aa52-4b27-9fa9-ec582b7129f2@web.de> (raw)
In-Reply-To: <20250831-icm20948-v1-5-1fe560a38de4@gmail.com>

…
> @@ -24,17 +24,24 @@ static const struct iio_chan_spec
>  static int inv_icm20948_temp_read_sensor(struct inv_icm20948_state *state,
>  					 s16 *temp)
>  {
> -	guard(mutex)(&state->lock);
> +	int ret;
> +
> +	pm_runtime_get_sync(state->dev);
> +	mutex_lock(&state->lock);
>  
>  	__be16 raw;
> -	int ret = regmap_bulk_read(state->regmap, INV_ICM20948_REG_TEMP_DATA,
> +	ret = regmap_bulk_read(state->regmap, INV_ICM20948_REG_TEMP_DATA,
>  				   &raw, sizeof(raw));
>  	if (ret)
> -		return ret;
> +		goto out;
>  
>  	*temp = __be16_to_cpu(raw);
> +	ret = 0;
>  
> -	return 0;
> +out:
> +	mutex_unlock(&state->lock);
> +	pm_runtime_put_autosuspend(state->dev);
> +	return ret;
>  }
…

Does anything hinder you with the continued application of scope-based resource management
for such a function implementation?

Regards,
Markus

  reply	other threads:[~2025-08-31 19:23 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-30 18:42 [PATCH 0/5] iio: imu: New driver for InvenSense ICM-20948 9-Axis sensor Bharadwaj Raju
2025-08-30 18:42 ` [PATCH 1/5] dt-bindings: iio: imu: Add ICM-20948 Bharadwaj Raju
2025-08-31 12:57   ` Krzysztof Kozlowski
2025-09-01  3:29   ` Krzysztof Kozlowski
2025-08-30 18:42 ` [PATCH 2/5] iio: imu: add inv_icm20948 Bharadwaj Raju
2025-08-30 20:42   ` Andy Shevchenko
2025-09-01 19:19   ` Jonathan Cameron
2025-08-30 18:42 ` [PATCH 3/5] iio: imu: icm20948: add support for gyroscope Bharadwaj Raju
2025-08-31 12:58   ` Krzysztof Kozlowski
2025-08-31 23:09   ` kernel test robot
2025-09-01  1:36   ` kernel test robot
2025-09-01 19:31   ` Jonathan Cameron
2025-08-30 18:42 ` [PATCH 4/5] MAINTAINERS: add entry for inv_icm20948 driver Bharadwaj Raju
2025-09-01 19:32   ` Jonathan Cameron
2025-08-30 18:42 ` [PATCH 5/5] iio: imu: icm20948: add runtime power management support Bharadwaj Raju
2025-08-31 19:23   ` Markus Elfring [this message]
2025-09-01  6:08     ` Greg KH
2025-09-01 19:40   ` 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=33ca2805-aa52-4b27-9fa9-ec582b7129f2@web.de \
    --to=markus.elfring@web.de \
    --cc=andy@kernel.org \
    --cc=bharadwaj.raju777@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=shuah@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox