public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Vasileios Amoiridis <vassilisamir@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: jic23@kernel.org, lars@metafoo.de, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 3/3] iio: chemical: bme680: add power management
Date: Sat, 30 Nov 2024 00:50:58 +0100	[thread overview]
Message-ID: <Z0pTYltyzN7cbmIs@vamoirid-laptop> (raw)
In-Reply-To: <Z0nQm_HX326_xcSu@smile.fi.intel.com>

On Fri, Nov 29, 2024 at 04:32:59PM +0200, Andy Shevchenko wrote:
> On Thu, Nov 28, 2024 at 08:32:46PM +0100, Vasileios Amoiridis wrote:
> > Add runtime power management to the device.
> 
> ...
> 
> > +	struct bme680_data *data = iio_priv(indio_dev);
> > +	struct device *dev = regmap_get_device(data->regmap);
> > +	int ret;
> > +
> > +	pm_runtime_get_sync(dev);
> > +	ret = __bme680_read_raw(indio_dev, chan, val, val2, mask);
> 
> Does it make sense to read something if previous call failed?
> Most likely you wanted to use
> 
> 
> 	ret = pm_runtime_resume_and_get(dev)
> 	if (ret)
> 		return ret;
> 
> 	ret = __bme680_read_raw(indio_dev, chan, val, val2, mask);
> 
> > +	pm_runtime_mark_last_busy(dev);
> > +	pm_runtime_put_autosuspend(dev);
> > +
> > +	return ret;
> 
> ...
> 
> > +static int bme680_write_raw(struct iio_dev *indio_dev,
> > +			    struct iio_chan_spec const *chan,
> > +			    int val, int val2, long mask)
> 
> Ditto.
> 
> ...
> 
> > +{
> > +	struct bme680_data *data = iio_priv(indio_dev);
> > +	struct device *dev = regmap_get_device(data->regmap);
> > +
> > +	pm_runtime_get_sync(dev);
> 
> No error check?
> 
> > +	return 0;
> > +}
> 
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
>

Hi Andy,

Thank you very much for the review once again!

To be honest, it was a bit difficult to find out exactly which functions
to use from the PM API. It was a bit tricky to understand which ones are
overlapping. Indeed, what you propose here looks better. I will fix it
in the next round. Thanks.

Cheers,
Vasilis

      reply	other threads:[~2024-11-29 23:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-28 19:32 [PATCH v4 0/3] iio: chemical bme680: 2nd round of cleanup Vasileios Amoiridis
2024-11-28 19:32 ` [PATCH v4 1/3] dt-bindings: iio: bosch,bme680: Move from trivial-devices and add supplies Vasileios Amoiridis
2024-11-29  7:12   ` Krzysztof Kozlowski
2024-11-29 23:49     ` Vasileios Amoiridis
2024-11-28 19:32 ` [PATCH v4 2/3] iio: chemical: bme680: add regulators Vasileios Amoiridis
2024-11-29 14:33   ` Andy Shevchenko
2024-11-30 14:26   ` Jonathan Cameron
2024-12-02 18:26     ` Vasileios Amoiridis
2024-11-28 19:32 ` [PATCH v4 3/3] iio: chemical: bme680: add power management Vasileios Amoiridis
2024-11-29 14:32   ` Andy Shevchenko
2024-11-29 23:50     ` Vasileios Amoiridis [this message]

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=Z0pTYltyzN7cbmIs@vamoirid-laptop \
    --to=vassilisamir@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@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