]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
f894de1d271f997ea2c69dda59e7d58dfef7e3e0
[thirdparty/kernel/stable-queue.git] /
1 From 03fada47311a3e668f73efc9278c4a559e64ee85 Mon Sep 17 00:00:00 2001
2 From: Mehdi Djait <mehdi.djait.k@gmail.com>
3 Date: Sat, 18 Feb 2023 14:51:11 +0100
4 Subject: iio: accel: kionix-kx022a: Get the timestamp from the driver's private data in the trigger_handler
5
6 From: Mehdi Djait <mehdi.djait.k@gmail.com>
7
8 commit 03fada47311a3e668f73efc9278c4a559e64ee85 upstream.
9
10 The trigger_handler gets called from the IRQ thread handler using
11 iio_trigger_poll_chained() which will only call the bottom half of the
12 pollfunc and therefore pf->timestamp will not get set.
13
14 Use instead the timestamp from the driver's private data which is always
15 set in the IRQ handler.
16
17 Fixes: 7c1d1677b322 ("iio: accel: Support Kionix/ROHM KX022A accelerometer")
18 Link: https://lore.kernel.org/linux-iio/Y+6QoBLh1k82cJVN@carbian/
19 Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
20 Signed-off-by: Mehdi Djait <mehdi.djait.k@gmail.com>
21 Link: https://lore.kernel.org/r/20230218135111.90061-1-mehdi.djait.k@gmail.com
22 Cc: <Stable@vger.kernel.org>
23 Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26 drivers/iio/accel/kionix-kx022a.c | 2 +-
27 1 file changed, 1 insertion(+), 1 deletion(-)
28
29 diff --git a/drivers/iio/accel/kionix-kx022a.c b/drivers/iio/accel/kionix-kx022a.c
30 index f866859855cd..1c3a72380fb8 100644
31 --- a/drivers/iio/accel/kionix-kx022a.c
32 +++ b/drivers/iio/accel/kionix-kx022a.c
33 @@ -864,7 +864,7 @@ static irqreturn_t kx022a_trigger_handler(int irq, void *p)
34 if (ret < 0)
35 goto err_read;
36
37 - iio_push_to_buffers_with_timestamp(idev, data->buffer, pf->timestamp);
38 + iio_push_to_buffers_with_timestamp(idev, data->buffer, data->timestamp);
39 err_read:
40 iio_trigger_notify_done(idev->trig);
41
42 --
43 2.40.0
44