Skip to content

Commit 04c1290

Browse files
dlechjic23
authored andcommitted
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á <[email protected]> Signed-off-by: David Lechner <[email protected]> Link: https://patch.msgid.link/20250507-iio-introduce-iio_declare_buffer_with_ts-v6-7-4aee1b9f1b89@baylibre.com Signed-off-by: Jonathan Cameron <[email protected]>
1 parent edeb67f commit 04c1290

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

drivers/iio/adc/at91-sama5d2_adc.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -586,15 +586,6 @@ struct at91_adc_temp {
586586
u16 saved_oversampling;
587587
};
588588

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-
598589
struct at91_adc_state {
599590
void __iomem *base;
600591
int irq;
@@ -616,8 +607,8 @@ struct at91_adc_state {
616607
struct at91_adc_temp temp_st;
617608
struct iio_dev *indio_dev;
618609
struct device *dev;
619-
/* Ensure naturally aligned timestamp */
620-
u16 buffer[AT91_BUFFER_MAX_HWORDS] __aligned(8);
610+
/* We assume 32 channels for now, has to be increased if needed. */
611+
IIO_DECLARE_BUFFER_WITH_TS(u16, buffer, 32);
621612
/*
622613
* lock to prevent concurrent 'single conversion' requests through
623614
* sysfs.

0 commit comments

Comments
 (0)