lkml.org 
[lkml]   [2021]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 3/4] drivers: iio: chemical: Add support for Sensirion SCD4x CO2 sensor
On Fri,  1 Oct 2021 09:02:53 +0200
Roan van Dijk <roan@protonic.nl> wrote:

> This is a driver for the SCD4x CO2 sensor from Sensirion. The sensor is
> able to measure CO2 concentration, temperature and relative humdity.
> The sensor uses a photoacoustic principle for measuring CO2 concentration.
> An I2C interface is supported by this driver in order to communicate with
> the sensor.
>
> Signed-off-by: Roan van Dijk <roan@protonic.nl>
Hi Roan,

Looks like you sent out wrong version or similar as the trigger_handler
won't work as you have it here. Otherwise looks good to me.

...

> +static irqreturn_t scd4x_trigger_handler(int irq, void *p)
> +{
> + struct iio_poll_func *pf = p;
> + struct iio_dev *indio_dev = pf->indio_dev;
> + struct scd4x_state *state = iio_priv(indio_dev);
> + struct {
> + uint16_t data[3];
> + int64_t ts __aligned(8);
> + } scan;
> + int ret;
> + uint16_t buf[3];
> +
> + memset(&scan, 0, sizeof(scan));
> + mutex_lock(&state->lock);
> + ret = scd4x_read_poll(state, buf);

scan->data and drop the local variable buf as unused.

If I've interpreted the intent right here I'm happy to make this tweak
whilst applying. If you prefer to send a v5 with it fixed up that is
fine as well.


> + mutex_unlock(&state->lock);
> + if (ret)
> + goto out;
> +
> + iio_push_to_buffers_with_timestamp(indio_dev, &scan, iio_get_time_ns(indio_dev));
> +out:
> + iio_trigger_notify_done(indio_dev->trig);
> + return IRQ_HANDLED;
> +}
> +
...

\
 
 \ /
  Last update: 2021-10-02 18:13    [W:0.153 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site