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