Re: [PATCH v1 08/13] iio: chemical: bme680: add power management

Andy Shevchenko
2024-10-12T20:40:10Z

Fri, Oct 11, 2024 at 09:02:32PM +0200, Vasileios Aoiridis kirjoitti:
> On Fri, Oct 11, 2024 at 01:10:20PM +0300, Andy Shevchenko wrote:
> > On Thu, Oct 10, 2024 at 11:00:25PM +0200, vamoirid wrote:

...

> > > +extern const struct dev_pm_ops bmp280_dev_pm_ops;
> >
> > Is pm.h being included already in this header? Otherwise you need to add it.
>
> No it is not, and indeed I need to add it. Probably because it was
> included by some other file I didn't get an error from gcc?

Yeah, it's called a "proxy" header in general meaning. We should try hard not
to use such headers (meaning not to use them in a "proxy" mode).

...

> > > struct regmap *regmap;
> > > struct bme680_calib bme680;
> > > struct mutex lock; /* Protect multiple serial R/W ops to device. */
> > > + struct device *dev;
> >
> > Is it the same that you may get wia regmap_get_device()?
> >
>
> Yes it is the same. Maybe I can try and see if I can use the following
>
> regmap_get_device(data->regmap)
>
> in the places where the pm functions are used in order to not declare a
> new value inside the struct bme680_data. But in general, is this approach
> prefered?

Since there is a getter already available, I prefer not to shortcut it via
adding a duplicating information to the data structure.

> > > u8 oversampling_temp;
> > > u8 oversampling_press;
> > > u8 oversampling_humid;

--
With Best Regards,
Andy Shevchenko