[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250418-iio-prefer-aligned_s64-timestamp-v1-4-4c6080710516@baylibre.com>
Date: Fri, 18 Apr 2025 14:58:23 -0500
From: David Lechner <dlechner@...libre.com>
To: Jonathan Cameron <jic23@...nel.org>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, Eugen Hristev <eugen.hristev@...aro.org>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Claudiu Beznea <claudiu.beznea@...on.dev>,
Andreas Klinger <ak@...klinger.de>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, imx@...ts.linux.dev,
linux-stm32@...md-mailman.stormreply.com,
David Lechner <dlechner@...libre.com>
Subject: [PATCH 04/10] iio: adc: mxs-lradc-adc: use struct with aligned_s64
timestamp
Use a struct with aligned s64_timestamp instead of a padded array for
the buffer used for iio_push_to_buffers_with_ts(). This makes it easier
to see the correctness of the size and alignment of the buffer.
Signed-off-by: David Lechner <dlechner@...libre.com>
---
drivers/iio/adc/mxs-lradc-adc.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/adc/mxs-lradc-adc.c b/drivers/iio/adc/mxs-lradc-adc.c
index 92baf3f5f5601b863c694eb03b6d8f287e4fe6ab..73e42f0ebcaeaaa437ba5c64ecdd7759a1191e6c 100644
--- a/drivers/iio/adc/mxs-lradc-adc.c
+++ b/drivers/iio/adc/mxs-lradc-adc.c
@@ -116,7 +116,10 @@ struct mxs_lradc_adc {
void __iomem *base;
/* Maximum of 8 channels + 8 byte ts */
- u32 buffer[10] __aligned(8);
+ struct {
+ u32 data[8];
+ aligned_u64 ts;
+ } buffer;
struct iio_trigger *trig;
struct completion completion;
spinlock_t lock;
@@ -418,14 +421,14 @@ static irqreturn_t mxs_lradc_adc_trigger_handler(int irq, void *p)
unsigned int i, j = 0;
for_each_set_bit(i, iio->active_scan_mask, LRADC_MAX_TOTAL_CHANS) {
- adc->buffer[j] = readl(adc->base + LRADC_CH(j));
+ adc->buffer.data[j] = readl(adc->base + LRADC_CH(j));
writel(chan_value, adc->base + LRADC_CH(j));
- adc->buffer[j] &= LRADC_CH_VALUE_MASK;
- adc->buffer[j] /= LRADC_DELAY_TIMER_LOOP;
+ adc->buffer.data[j] &= LRADC_CH_VALUE_MASK;
+ adc->buffer.data[j] /= LRADC_DELAY_TIMER_LOOP;
j++;
}
- iio_push_to_buffers_with_ts(iio, adc->buffer, sizeof(adc->buffer),
+ iio_push_to_buffers_with_ts(iio, &adc->buffer, sizeof(adc->buffer),
pf->timestamp);
iio_trigger_notify_done(iio->trig);
--
2.43.0
Powered by blists - more mailing lists