From: Jonathan Cameron <jic23@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Gustavo Silva <gustavograzs@gmail.com>,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
lars@metafoo.de, gerald.loacker@wolfvision.net,
devicetree@vger.kernel.org, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/6] iio: chemical: ens160: add triggered buffer support
Date: Sun, 19 May 2024 15:03:51 +0100 [thread overview]
Message-ID: <20240519150351.6c248b1d@jic23-huawei> (raw)
In-Reply-To: <b8775460-5519-4294-9218-d8e814e05305@wanadoo.fr>
On Mon, 13 May 2024 21:13:07 +0200
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> Le 12/05/2024 à 23:04, Gustavo Silva a écrit :
> > ENS160 supports a data ready interrupt. Use it in combination with
> > triggered buffer for continuous data readings.
> >
> > Signed-off-by: Gustavo Silva <gustavograzs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > ---
>
> ...
>
> > +static irqreturn_t ens160_trigger_handler(int irq, void *p)
> > +{
> > + struct iio_poll_func *pf = p;
> > + struct iio_dev *indio_dev = pf->indio_dev;
> > + struct ens160_data *data = iio_priv(indio_dev);
> > + __le16 val;
> > + int ret, i, j = 0;
> > +
> > + mutex_lock(&data->mutex);
> > +
> > + for_each_set_bit(i, indio_dev->active_scan_mask,
> > + indio_dev->masklength) {
> > + ret = regmap_bulk_read(data->regmap,
> > + ENS160_REG_DATA_TVOC + 2 * i, &val, 2U);
> > + if (ret)
> > + goto err;
> > +
> > + data->scan.chans[j++] = val;
>
> Is it safe? How can we know if it has been only *partly* updated? Does
> it matter to know?
You've lost me. What do you mean by partly updated?
This won't push anything to the kfifo etc unless all succeeded.
Or is there a race with something else in here?
>
> CJ
>
> > + }
> > +
> > + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
> > + pf->timestamp);
> > +err:
> > + mutex_unlock(&data->mutex);
> > + iio_trigger_notify_done(indio_dev->trig);
> > +
> > + return IRQ_HANDLED;
> > +}
>
> ...
next prev parent reply other threads:[~2024-05-19 14:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-12 21:04 [PATCH 0/6] Add driver for ENS160 sensor Gustavo Silva
2024-05-12 21:04 ` [PATCH 1/6] dt-bindings: vendor-prefixes: add ScioSense Gustavo Silva
2024-05-13 16:02 ` Conor Dooley
2024-05-12 21:04 ` [PATCH 2/6] dt-bindings: Add ENS160 as trivial device Gustavo Silva
2024-05-13 16:09 ` Conor Dooley
2024-05-19 12:33 ` Jonathan Cameron
2024-05-12 21:04 ` [PATCH 3/6] iio: chemical: add driver for ENS160 sensor Gustavo Silva
2024-05-13 19:12 ` Christophe JAILLET
2024-05-19 13:24 ` Jonathan Cameron
2024-05-22 23:41 ` Gustavo Silva
2024-05-19 14:01 ` Jonathan Cameron
2024-05-26 0:29 ` Gustavo Silva
2024-05-26 12:20 ` Jonathan Cameron
2024-05-12 21:04 ` [PATCH 4/6] iio: chemical: ens160: add triggered buffer support Gustavo Silva
2024-05-13 19:13 ` Christophe JAILLET
2024-05-19 14:03 ` Jonathan Cameron [this message]
2024-05-20 6:50 ` Christophe JAILLET
2024-05-13 23:50 ` kernel test robot
2024-05-19 14:18 ` Jonathan Cameron
2024-05-12 21:04 ` [PATCH 5/6] iio: chemical: ens160: add power management support Gustavo Silva
2024-05-19 14:18 ` Jonathan Cameron
2024-05-12 21:04 ` [PATCH 6/6] MAINTAINERS: Add ScioSense ENS160 Gustavo Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240519150351.6c248b1d@jic23-huawei \
--to=jic23@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gerald.loacker@wolfvision.net \
--cc=gustavograzs@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).