Re: [PATCH v3 6/6] iio: pressure: Add triggered buffer support for BMP280 driver

From: Jonathan Cameron
Date: Sat Apr 06 2024 - 06:03:21 EST



> > >
> > > +static irqreturn_t bmp280_buffer_handler(int irq, void *p)
> > > +{
> > > + struct iio_poll_func *pf = p;
> > > + struct iio_dev *indio_dev = pf->indio_dev;
> > > + struct bmp280_data *data = iio_priv(indio_dev);
> > > + s32 adc_temp, adc_press, adc_humidity;
> > > + u8 size_of_burst_read;
> > > + int ret, chan_value;
> > > +
> > > + guard(mutex)(&data->lock);
> > > +
> > > + if (test_bit(BME280_HUMID, indio_dev->active_scan_mask))
> >
> > This confuses me a little. Is it allowing reuse of this function for
> > multiple devices or aiming to optimise the read in the case of
> > the humidity channel being disabled (in which case I don't think
> > it works because you aren't providing that combination in avail_scan_masks.)
> >
> > Add a comment to explain.
> >
>
> Hi Jonathan,
>
> It is aimed to reuse the function both for BMP280 and BME280 so that's why is
> there, it's not in case humidity channel is disabled. I can add a comment it
> is definitely not obvious. Thanks for pointing this out.
>
> By applying the changes that you pointed out + by implementing the changes
> that you proposed in a previous patch to split the t_fine calculation this
> patch will become much cleaner, thanks a lot!

A comment would do the job nicely. Thanks,

J