lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z0pTYltyzN7cbmIs@vamoirid-laptop>
Date: Sat, 30 Nov 2024 00:50:58 +0100
From: Vasileios Amoiridis <vassilisamir@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: jic23@...nel.org, lars@...afoo.de, robh@...nel.org, krzk+dt@...nel.org,
	conor+dt@...nel.org, linux-iio@...r.kernel.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 3/3] iio: chemical: bme680: add power management

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ