Re: [PATCH v2 2/2] iio: pressure: ms5637: Add variant specific temperature compensation
From: Louis Adamian
Date: Fri Aug 07 2026 - 14:34:03 EST
On Fri, 7 Aug 2026 00:27:30 +0300
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> On Wed, Aug 05, 2026 at 01:06:51PM -0400, Louis Adamian wrote:
> > On Thu, 11 Jun 2026 22:32:02 +0300
> > Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> > > On Thu, Jun 11, 2026 at 03:10:26PM -0400, Louis Adamian wrote:
> > > > On Wed, 10 Jun 2026 21:37:58 +0300
> > > > Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> > > > > On Tue, Jun 09, 2026 at 10:04:58PM -0400, Louis Adamian
> > > > > wrote:
>
> ...
>
> > > > > > struct ms_tp_dev {
> > > > > > struct i2c_client *client;
> > > > >
> [...]
> > > > >
> > > > > Please, check with `pahole` if this is the best layout.
> > > >
> > > > I will correct the packing on this per pahole's finding.
> [...]
> > > > >
> > > > > Can this be simply embedded into ms_tp_dev (and copied there
> > > > > if required)?
> > > >
> > > > Copying in ms_tp_comp_consts provides no benefit over
> > > > referencing the pointer; the values are per-descriptor, not
> > > > per-instance and never modified. I'll keep the pointer (same as
> > > > ms_tp_hw_data).
> > >
> > > Okay, let me ask differently then: Can we use the same data type
> > > in ms_tp_dev instead of adding basically the same fields as in
> > > ms_tp_data?
> > >
> > Sorry for the very slow reply. Yes, for v3 ms_tp_dev will hold a
> > single const ms_tp_data *data instead of its own hw and
> > comp_consts. This drops the duplicated hw that predates this
> > series.
> >
> > One thing worth noting before I do that: ms_tp_data is currently
> > private to ms5637.c and will need to be moved to ms_sensors_i2c.h
> > for ms_tp_dev to point to it. I don't think this is a problem; it
> > matches how ms_tp_hw_data is defined now, but let me know if you
> > would like to avoid it.
>
> The pointer may be opaque, in that case it's not needed to be exposed.
>
ms_sensors_i2c.c dereferences both ->hw->prom_len in
ms_sensors_tp_read_prom and ->comp_consts in
ms_sensors_read_temp_and_pressure, so an opaque ms_tp_data would require
passing both pointers as parameters. I plan on moving ms_tp_data into
ms_sensors_i2c.h, dropping the original duplicate hw, unless you prefer
otherwise.
--
Thanks,
Louis