Re: [RESEND PATCH 11/14] iio: proximity: vl53l1x-i2c: poll own trigger from interrupt handler

From: Jonathan Cameron

Date: Sat Nov 14 2026 - 18:36:32 EST


On Mon, 9 Nov 2026 09:42:02 +0100
Joshua Crofts <crofts@xxxxxxxxxx> wrote:

> On Mon, 9 Nov 2026 04:28:48 +0000
> Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
>
> > From: Jonathan Cameron <jonathan.cameron@xxxxxxxxxxxxxxxx>
> >
> > Keep a pointer to the driver's trigger in struct vl53l1x_data and poll
> > that from vl53l1x_irq_handler() rather than indio_dev->trig. Only the
> > driver's own trigger is accepted, via iio_validate_own_trigger(), so
> > with the buffer enabled that is the trigger in use.
> >
> > This removes a dependency on the trig field of struct iio_dev, which
> > is to become private to the IIO core.
> >
> > Signed-off-by: Jonathan Cameron <jonathan.cameron@xxxxxxxxxxxxxxxx>
> > ---
> > drivers/iio/proximity/vl53l1x-i2c.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/proximity/vl53l1x-i2c.c b/drivers/iio/proximity/vl53l1x-i2c.c
> > index bce238d1b6de..ffc6fe45b165 100644
> > --- a/drivers/iio/proximity/vl53l1x-i2c.c
> > +++ b/drivers/iio/proximity/vl53l1x-i2c.c
> > @@ -102,6 +102,7 @@ struct vl53l1x_data {
> > enum vl53l1x_distance_mode distance_mode;
> > u8 gpio_polarity;
> > int irq;
> > + struct iio_trigger *trig;
>
> Pahole reports a 4 byte hole between irq and trig. Reordering
> like this yields a better result:
>
> struct regmap * regmap; /* 0 8 */
> struct completion completion __attribute__((__aligned__(8))); /* 8 32 */
>
> /* XXX last struct has 1 hole */
>
> struct reset_control * xshut_reset; /* 40 8 */
> struct iio_trigger * trig; /* 48 8 */
> enum vl53l1x_distance_mode distance_mode; /* 56 4 */
> int irq; /* 60 4 */
> /* --- cacheline 1 boundary (64 bytes) --- */
> u8 gpio_polarity; /* 64 1 */
>
Good point. I guess I need to poke my llm to take this into account.

tweaked whilst applying.

Thanks,

Jonathan