]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: light: adjd_s311: Use iio_push_to_buffers_with_ts() to allow source size runtime...
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 2 Aug 2025 16:44:28 +0000 (17:44 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 16 Aug 2025 14:51:54 +0000 (15:51 +0100)
Also move the structure used as the source to the stack as it is only 16
bytes and not the target of an DMA or similar.

Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://patch.msgid.link/20250802164436.515988-9-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/adjd_s311.c

index cf96e3dd8bc675e97e62f2cb456bf6e28537472a..edb3d9dc8bed3730cccf6b4bc90995eee84c7bc0 100644 (file)
 
 struct adjd_s311_data {
        struct i2c_client *client;
-       struct {
-               s16 chans[4];
-               aligned_s64 ts;
-       } scan;
 };
 
 enum adjd_s311_channel_idx {
@@ -120,6 +116,10 @@ static irqreturn_t adjd_s311_trigger_handler(int irq, void *p)
        struct adjd_s311_data *data = iio_priv(indio_dev);
        s64 time_ns = iio_get_time_ns(indio_dev);
        int i, j = 0;
+       struct {
+               s16 chans[4];
+               aligned_s64 ts;
+       } scan = { };
 
        int ret = adjd_s311_req_data(indio_dev);
        if (ret < 0)
@@ -131,10 +131,10 @@ static irqreturn_t adjd_s311_trigger_handler(int irq, void *p)
                if (ret < 0)
                        goto done;
 
-               data->scan.chans[j++] = ret & ADJD_S311_DATA_MASK;
+               scan.chans[j++] = ret & ADJD_S311_DATA_MASK;
        }
 
-       iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, time_ns);
+       iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan), time_ns);
 
 done:
        iio_trigger_notify_done(indio_dev->trig);