Re: [PATCH] iio: pressure: dps310: wait for a new sample after a ratio change

From: Andy Shevchenko

Date: Mon Oct 26 2026 - 05:06:49 EST


On Mon, Oct 26, 2026 at 02:46:05AM +0000, Jonathan Cameron wrote:
> On Mon, 19 Oct 2026 22:06:49 +0300
> Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> > On Mon, Oct 19, 2026 at 06:33:28PM +0300, Rupesh Majhi wrote:

...

> > > /* Make sure sleep time is <= 30ms for usleep_range */
> > > #define DPS310_POLL_SLEEP_US(t) min(30000, (t) / 8)
> >
> > Seems the use of USEC_PER_SEC below should be postponed to a regular cleanup.
> > Because otherwise it will be inconsistent with the above where it would need
> > to be 30 * USEC_PER_MSEC
> Do we want to have the extra churn on the below?

I would bother in case there is no clean up patch attached and we will be left
with the good *temporary* inconsistency that lasts for years :-)

If Rupesh is going to add the patch to clean up that (before or after this patch)
I wouldn't be triggered.

> I'm not that bothered by a temporary state of different styles.
> Nice indeed to have a follow up tidying up other cases though!
>
> There is quite a bit going on around this driver, so I'm going to pick this
> one up for the testing branch of iio.git rather than the faster path.

> > > -/* Silently handle error in rate value here */
> > > -#define DPS310_POLL_TIMEOUT_US(rc) ((rc) <= 0 ? 1000000 : 1000000 / (rc))
> > > +/* A period plus a measurement time; silently handle error in rate value */
> > > +#define DPS310_POLL_TIMEOUT_US(rc) (2 * USEC_PER_SEC / max(rc, 1))

My comment basically based on the existence of the no-multiplier style, and
this patch *changes* it here, but not there. And it's *this* patch that brings
inconsistency.

However, this is quite a minor thingy, so up to you.

--
With Best Regards,
Andy Shevchenko