Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: light: vcnl4000: Use a structure to make buffer arrangement explicit.

Removes the need for comments to describe the buffer passed to
iio_push_to_buffers_with_timestamp().

Reviewed-by: Mårten Lindahl <marten.lindahl@axis.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://patch.msgid.link/20250802164436.515988-15-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

+6 -3
+6 -3
drivers/iio/light/vcnl4000.c
··· 1662 1662 struct iio_dev *indio_dev = pf->indio_dev; 1663 1663 struct vcnl4000_data *data = iio_priv(indio_dev); 1664 1664 const unsigned long *active_scan_mask = indio_dev->active_scan_mask; 1665 - u16 buffer[8] __aligned(8) = {0}; /* 1x16-bit + naturally aligned ts */ 1665 + struct { 1666 + u16 chan; 1667 + aligned_s64 ts; 1668 + } scan = { }; 1666 1669 bool data_read = false; 1667 1670 unsigned long isr; 1668 1671 int val = 0; ··· 1685 1682 if (ret < 0) 1686 1683 goto end; 1687 1684 1688 - buffer[0] = val; 1685 + scan.chan = val; 1689 1686 data_read = true; 1690 1687 } 1691 1688 } ··· 1698 1695 if (!data_read) 1699 1696 goto end; 1700 1697 1701 - iio_push_to_buffers_with_timestamp(indio_dev, buffer, 1698 + iio_push_to_buffers_with_timestamp(indio_dev, &scan, 1702 1699 iio_get_time_ns(indio_dev)); 1703 1700 1704 1701 end: