[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z0nQm_HX326_xcSu@smile.fi.intel.com>
Date: Fri, 29 Nov 2024 16:32:59 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Vasileios Amoiridis <vassilisamir@...il.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 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
Powered by blists - more mailing lists