]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: light: isl29125: Use iio_push_to_buffers_with_ts() to allow source size runtime...
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 2 Aug 2025 16:44:29 +0000 (17:44 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 16 Aug 2025 14:52:46 +0000 (15:52 +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-10-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/light/isl29125.c

index 6bc23b164cc5546feb7bf5c31883e19404a0aabe..3acb8a4f1d120b3c8b6b3346506ddf7838df4e1c 100644 (file)
 struct isl29125_data {
        struct i2c_client *client;
        u8 conf1;
-       /* Ensure timestamp is naturally aligned */
-       struct {
-               u16 chans[3];
-               aligned_s64 timestamp;
-       } scan;
 };
 
 #define ISL29125_CHANNEL(_color, _si) { \
@@ -179,6 +174,11 @@ static irqreturn_t isl29125_trigger_handler(int irq, void *p)
        struct iio_dev *indio_dev = pf->indio_dev;
        struct isl29125_data *data = iio_priv(indio_dev);
        int i, j = 0;
+       /* Ensure timestamp is naturally aligned */
+       struct {
+               u16 chans[3];
+               aligned_s64 timestamp;
+       } scan = { };
 
        iio_for_each_active_channel(indio_dev, i) {
                int ret = i2c_smbus_read_word_data(data->client,
@@ -186,10 +186,10 @@ static irqreturn_t isl29125_trigger_handler(int irq, void *p)
                if (ret < 0)
                        goto done;
 
-               data->scan.chans[j++] = ret;
+               scan.chans[j++] = ret;
        }
 
-       iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
+       iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
                iio_get_time_ns(indio_dev));
 
 done: