Linux IIO development
 help / color / mirror / Atom feed
From: Mehdi Djait <mehdi.djait.k@gmail.com>
To: mazziesaccount@gmail.com, jic23@kernel.org
Cc: linux-iio@vger.kernel.org, lars@metafoo.de,
	Mehdi Djait <mehdi.djait.k@gmail.com>
Subject: [PATCH v2] iio: accel: kionix-kx022a: Get the timestamp from the driver's private data in the trigger_handler
Date: Sat, 18 Feb 2023 14:51:11 +0100	[thread overview]
Message-ID: <20230218135111.90061-1-mehdi.djait.k@gmail.com> (raw)

The trigger_handler gets called from the IRQ thread handler using
iio_trigger_poll_chained() which will only call the bottom half of the
pollfunc and therefore pf->timestamp will not get set.

Use instead the timestamp from the driver's private data which is always
set in the IRQ handler.

Fixes: 7c1d1677b322 ("iio: accel: Support Kionix/ROHM KX022A accelerometer")
Signed-off-by: Mehdi Djait <mehdi.djait.k@gmail.com>
---
Changes since v1:
- Add Fixes tag 

Relevant discussion: https://lore.kernel.org/linux-iio/Y+%2FLpcc0Wa2VGsGO@carbian/T/#mec923c14d1324ffabfa88dde225eeb227005b48f 

 drivers/iio/accel/kionix-kx022a.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c
index f866859855cd..1c3a72380fb8 100644
--- a/drivers/iio/accel/kionix-kx022a.c
+++ b/drivers/iio/accel/kionix-kx022a.c
@@ -864,7 +864,7 @@ static irqreturn_t kx022a_trigger_handler(int irq, void *p)
 	if (ret < 0)
 		goto err_read;
 
-	iio_push_to_buffers_with_timestamp(idev, data->buffer, pf->timestamp);
+	iio_push_to_buffers_with_timestamp(idev, data->buffer, data->timestamp);
 err_read:
 	iio_trigger_notify_done(idev->trig);
 
-- 
2.30.2


             reply	other threads:[~2023-02-18 13:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-18 13:51 Mehdi Djait [this message]
2023-02-18 17:30 ` [PATCH v2] iio: accel: kionix-kx022a: Get the timestamp from the driver's private data in the trigger_handler Jonathan Cameron

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=20230218135111.90061-1-mehdi.djait.k@gmail.com \
    --to=mehdi.djait.k@gmail.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=mazziesaccount@gmail.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