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: hx711: 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@baylibre.com>
Link: https://patch.msgid.link/20250418-iio-prefer-aligned_s64-timestamp-v1-3-4c6080710516@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

David Lechner and committed by
Jonathan Cameron
6b7c0e9d 0c2cdd1a

+7 -4
+7 -4
drivers/iio/adc/hx711.c
··· 87 87 * triggered buffer 88 88 * 2x32-bit channel + 64-bit naturally aligned timestamp 89 89 */ 90 - u32 buffer[4] __aligned(8); 90 + struct { 91 + u32 channel[2]; 92 + aligned_s64 timestamp; 93 + } buffer; 91 94 /* 92 95 * delay after a rising edge on SCK until the data is ready DOUT 93 96 * this is dependent on the hx711 where the datasheet tells a ··· 364 361 365 362 mutex_lock(&hx711_data->lock); 366 363 367 - memset(hx711_data->buffer, 0, sizeof(hx711_data->buffer)); 364 + memset(&hx711_data->buffer, 0, sizeof(hx711_data->buffer)); 368 365 369 366 iio_for_each_active_channel(indio_dev, i) { 370 - hx711_data->buffer[j] = hx711_reset_read(hx711_data, 367 + hx711_data->buffer.channel[j] = hx711_reset_read(hx711_data, 371 368 indio_dev->channels[i].channel); 372 369 j++; 373 370 } 374 371 375 - iio_push_to_buffers_with_timestamp(indio_dev, hx711_data->buffer, 372 + iio_push_to_buffers_with_timestamp(indio_dev, &hx711_data->buffer, 376 373 pf->timestamp); 377 374 378 375 mutex_unlock(&hx711_data->lock);