From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Sean Nyekjaer <sean@geanix.com>
Cc: linux-iio@vger.kernel.org, jic23@kernel.org,
lorenzo.bianconi83@gmail.com, martin@geanix.com
Subject: Re: [PATCH v2 5/6] iio: imu: st_lsm6dsx: always enter interrupt thread
Date: Tue, 16 Jul 2019 08:14:55 +0200 [thread overview]
Message-ID: <20190716061455.GE23126@localhost.localdomain> (raw)
In-Reply-To: <20190715081514.81129-5-sean@geanix.com>
[-- Attachment #1: Type: text/plain, Size: 1530 bytes --]
> The interrupt source can come from multiple sources,
> fifo and wake interrupts.
> Enter interrupt thread to check which interrupt that has fired.
>
> Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> ---
>
> Changes since v1:
> * None
>
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index fc450eeb9870..0503abab6efc 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -1215,19 +1215,19 @@ int st_lsm6dsx_event_setup(int id, struct st_lsm6dsx_hw *hw)
>
> static irqreturn_t st_lsm6dsx_handler_irq(int irq, void *private)
> {
> - struct st_lsm6dsx_hw *hw = private;
> -
> - return hw->sip > 0 ? IRQ_WAKE_THREAD : IRQ_NONE;
> + return IRQ_WAKE_THREAD;
> }
>
> static irqreturn_t st_lsm6dsx_handler_thread(int irq, void *private)
> {
> struct st_lsm6dsx_hw *hw = private;
> - int count;
> + int count = 0;
>
> - mutex_lock(&hw->fifo_lock);
> - count = st_lsm6dsx_read_fifo(hw);
> - mutex_unlock(&hw->fifo_lock);
> + if (hw->sip > 0) {
I think we do not need this if() statement since st_lsm6dsx_read_fifo will
return 0 in case
> + mutex_lock(&hw->fifo_lock);
> + count = st_lsm6dsx_read_fifo(hw);
> + mutex_unlock(&hw->fifo_lock);
> + }
>
> return !count ? IRQ_NONE : IRQ_HANDLED;
> }
> --
> 2.22.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2019-07-16 6:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-15 8:15 [PATCH v2 1/6] iio: imu: st_lsm6dsx: move interrupt thread to core Sean Nyekjaer
2019-07-15 8:15 ` [PATCH v2 2/6] iio: imu: st_lsm6dsx: save drdy_pin in device struct Sean Nyekjaer
2019-07-15 8:15 ` [PATCH v2 3/6] iio: imu: st_lsm6dsx: add motion events Sean Nyekjaer
2019-07-16 8:29 ` Lorenzo Bianconi
2019-07-27 21:11 ` Jonathan Cameron
2019-08-09 11:05 ` Sean Nyekjaer
2019-08-21 11:11 ` Sean Nyekjaer
2019-07-15 8:15 ` [PATCH v2 4/6] iio: imu: st_lsm6dsx: add wakeup-source option Sean Nyekjaer
2019-07-16 8:04 ` Lorenzo Bianconi
2019-07-15 8:15 ` [PATCH v2 5/6] iio: imu: st_lsm6dsx: always enter interrupt thread Sean Nyekjaer
2019-07-16 6:14 ` Lorenzo Bianconi [this message]
2019-07-15 8:15 ` [PATCH v2 6/6] iio: imu: st_lsm6dsx: add motion report function and call from interrupt Sean Nyekjaer
2019-07-16 6:11 ` Lorenzo Bianconi
2019-07-16 5:57 ` [PATCH v2 1/6] iio: imu: st_lsm6dsx: move interrupt thread to core Lorenzo Bianconi
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=20190716061455.GE23126@localhost.localdomain \
--to=lorenzo@kernel.org \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=lorenzo.bianconi83@gmail.com \
--cc=martin@geanix.com \
--cc=sean@geanix.com \
/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