iio: light: st_uvis25: 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. Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Link: https://patch.msgid.link/20250802164436.515988-12-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>pull/1354/merge
parent
596081d33b
commit
cb8453db63
|
|
@ -27,11 +27,6 @@ struct st_uvis25_hw {
|
|||
struct iio_trigger *trig;
|
||||
bool enabled;
|
||||
int irq;
|
||||
/* Ensure timestamp is naturally aligned */
|
||||
struct {
|
||||
u8 chan;
|
||||
aligned_s64 ts;
|
||||
} scan;
|
||||
};
|
||||
|
||||
extern const struct dev_pm_ops st_uvis25_pm_ops;
|
||||
|
|
|
|||
|
|
@ -234,15 +234,21 @@ static irqreturn_t st_uvis25_buffer_handler_thread(int irq, void *p)
|
|||
struct st_uvis25_hw *hw = iio_priv(iio_dev);
|
||||
unsigned int val;
|
||||
int err;
|
||||
/* Ensure timestamp is naturally aligned */
|
||||
struct {
|
||||
u8 chan;
|
||||
aligned_s64 ts;
|
||||
} scan = { };
|
||||
|
||||
|
||||
err = regmap_read(hw->regmap, ST_UVIS25_REG_OUT_ADDR, &val);
|
||||
if (err < 0)
|
||||
goto out;
|
||||
|
||||
hw->scan.chan = val;
|
||||
scan.chan = val;
|
||||
|
||||
iio_push_to_buffers_with_timestamp(iio_dev, &hw->scan,
|
||||
iio_get_time_ns(iio_dev));
|
||||
iio_push_to_buffers_with_ts(iio_dev, &scan, sizeof(scan),
|
||||
iio_get_time_ns(iio_dev));
|
||||
|
||||
out:
|
||||
iio_trigger_notify_done(hw->trig);
|
||||
|
|
|
|||
Loading…
Reference in New Issue