[PATCH v2 1/6] iio: introduce IIO_DECLARE_BUFFER_WITH_TS macros

Andy Shevchenko andy.shevchenko at gmail.com
Tue Apr 22 15:30:17 PDT 2025


On Wed, Apr 23, 2025 at 1:08 AM David Lechner <dlechner at baylibre.com> wrote:
>
> Add new macros to help with the common case of declaring a buffer that
> is safe to use with iio_push_to_buffers_with_ts(). This is not trivial
> to do correctly because of the alignment requirements of the timestamp.
> This will make it easier for both authors and reviewers.
>
> To avoid double __align() attributes in cases where we also need DMA
> alignment, add a 2nd variant IIO_DECLARE_DMA_BUFFER_WITH_TS.

...

> +#define _IIO_DECLARE_BUFFER_WITH_TS(type, name, count) \
> +       type name[ALIGN((count), sizeof(s64) / sizeof(type)) + sizeof(s64) / sizeof(type)]

Single leading underscore seems to me not so usual, I saw people use
double underscores to make sure that it will be visible that it's an
internal one (kinda).

...

> +_Static_assert(sizeof(IIO_DMA_MINALIGN) % sizeof(s64) == 0,

Why not static_assert() ? Because of the message? But static_assert()
supports messages AFAICS.

> +       "macros above assume that IIO_DMA_MINALIGN also ensures s64 timestamp alignment");

-- 
With Best Regards,
Andy Shevchenko



More information about the linux-arm-kernel mailing list