Re: [PATCH 3/4] media: atomisp: queue: move circbuf types and helpers to queue_comm.h
From: Andy Shevchenko
Date: Tue Oct 13 2026 - 16:58:08 EST
On Mon, Oct 12, 2026 at 11:07:52PM +0000, Rareș-Mihai Vladu wrote:
> The remote queue code only needs the circbuf descriptor and element
> layouts plus five small descriptor helpers from the circbuf library.
> Move them into ia_css_queue_comm.h and include that header instead of
> the circbuf ones.
>
> The descriptor and element layouts are shared with the SP firmware and
> are moved unchanged, including their static_asserts.
>
> While at it, drop the OP___assert() NULL checks from the moved helpers:
> every caller passes the address of a local variable, so the pointer can
> never be NULL.
...
> +/*
> + * @brief Data structure for the circular descriptor.
> + */
> +typedef struct ia_css_circbuf_desc_s ia_css_circbuf_desc_t;
> +struct ia_css_circbuf_desc_s {
> + u8 size; /* the maximum number of elements*/
> + u8 step; /* number of bytes per element */
> + u8 start; /* index of the oldest element */
> + u8 end; /* index at which to write the new element */
> +};
> +
> +#define SIZE_OF_IA_CSS_CIRCBUF_DESC_S_STRUCT \
> + (4 * sizeof(uint8_t))
Why not sizeof(u8) ?
#define SIZE_OF_IA_CSS_CIRCBUF_DESC_S_STRUCT (4 * sizeof(u8))
...
In the same way for the rest of the similar pieces of code below.
...
> +static inline bool ia_css_circbuf_desc_is_empty(
> + ia_css_circbuf_desc_t *cb_desc)
Don't repeat wrong style, correct it here
static inline bool ia_css_circbuf_desc_is_empty(ia_css_circbuf_desc_t *cb_desc)
...
In the same way for the rest of the similar pieces of code below.
...
> +static inline uint32_t ia_css_circbuf_desc_get_num_elems(
While at it, use uXX types directly. Would it compile?
> + ia_css_circbuf_desc_t *cb_desc)
--
With Best Regards,
Andy Shevchenko