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

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: at91-sama5d2: use IIO_DECLARE_BUFFER_WITH_TS

Use IIO_DECLARE_BUFFER_WITH_TS() to declare the buffer that gets used
with iio_push_to_buffers_with_ts(). This makes the code a bit easier to
read and understand.

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250507-iio-introduce-iio_declare_buffer_with_ts-v6-7-4aee1b9f1b89@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

David Lechner and committed by
Jonathan Cameron
04c12907 edeb67fb

+2 -11
+2 -11
drivers/iio/adc/at91-sama5d2_adc.c
··· 586 586 u16 saved_oversampling; 587 587 }; 588 588 589 - /* 590 - * Buffer size requirements: 591 - * No channels * bytes_per_channel(2) + timestamp bytes (8) 592 - * Divided by 2 because we need half words. 593 - * We assume 32 channels for now, has to be increased if needed. 594 - * Nobody minds a buffer being too big. 595 - */ 596 - #define AT91_BUFFER_MAX_HWORDS ((32 * 2 + 8) / 2) 597 - 598 589 struct at91_adc_state { 599 590 void __iomem *base; 600 591 int irq; ··· 607 616 struct at91_adc_temp temp_st; 608 617 struct iio_dev *indio_dev; 609 618 struct device *dev; 610 - /* Ensure naturally aligned timestamp */ 611 - u16 buffer[AT91_BUFFER_MAX_HWORDS] __aligned(8); 619 + /* We assume 32 channels for now, has to be increased if needed. */ 620 + IIO_DECLARE_BUFFER_WITH_TS(u16, buffer, 32); 612 621 /* 613 622 * lock to prevent concurrent 'single conversion' requests through 614 623 * sysfs.