diff options
| author | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2025-08-02 17:44:35 +0100 |
|---|---|---|
| committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2025-08-16 15:59:34 +0100 |
| commit | 2bbaf41ac9f70092bbd48d779a176d2ee6a0131f (patch) | |
| tree | 4a901e5336c03c7cfd15d7e600933aefa27fb074 | |
| parent | 19487b50ac7f26c0287d65bb697a4a3aca616d9b (diff) | |
iio: light: vl6180: Use iio_push_to_buffers_with_ts() to allow source size runtime check
Use iio_push_to_buffers_with_ts() to allow source size runtime check.
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.
Cc: Abhash Jha <abhashkumarjha123@gmail.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://patch.msgid.link/20250802164436.515988-16-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| -rw-r--r-- | drivers/iio/light/vl6180.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/iio/light/vl6180.c b/drivers/iio/light/vl6180.c index 38706424089c..c1314b144367 100644 --- a/drivers/iio/light/vl6180.c +++ b/drivers/iio/light/vl6180.c @@ -96,11 +96,6 @@ struct vl6180_data { unsigned int als_it_ms; unsigned int als_meas_rate; unsigned int range_meas_rate; - - struct { - u16 chan[2]; - aligned_s64 timestamp; - } scan; }; enum { VL6180_ALS, VL6180_RANGE, VL6180_PROX }; @@ -545,6 +540,11 @@ static irqreturn_t vl6180_trigger_handler(int irq, void *priv) struct vl6180_data *data = iio_priv(indio_dev); s64 time_ns = iio_get_time_ns(indio_dev); int ret, bit, i = 0; + struct { + u16 chan[2]; + aligned_s64 timestamp; + } scan = { }; + iio_for_each_active_channel(indio_dev, bit) { if (vl6180_chan_regs_table[bit].word) @@ -560,10 +560,10 @@ static irqreturn_t vl6180_trigger_handler(int irq, void *priv) return IRQ_HANDLED; } - data->scan.chan[i++] = ret; + scan.chan[i++] = ret; } - 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); iio_trigger_notify_done(indio_dev->trig); /* Clear the interrupt flag after data read */ |
