[PATCH v4 11/20] scmi: add the macro SCMI_MSG

Marek Vasut marex at denx.de
Fri Jan 24 15:40:01 CET 2025


On 1/15/25 2:28 PM, Alice Guo wrote:
> From: Peng Fan <peng.fan at nxp.com>
> 
> This patch adds the macro SCMI_MSG for protocols that do not need
> _in_array.
> 
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> Signed-off-by: Alice Guo <alice.guo at nxp.com>
> Reviewed-by: Ye Li <ye.li at nxp.com>
> ---
>   include/scmi_agent.h | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/include/scmi_agent.h b/include/scmi_agent.h
> index 755986d6c424ccc881ac0943a88735cbcfacb001..5508a126a6dc504afa6d896c78c760b1af0d3deb 100644
> --- a/include/scmi_agent.h
> +++ b/include/scmi_agent.h
> @@ -54,6 +54,17 @@ struct scmi_msg {
>   		.out_msg_sz = sizeof(_out_array),	\
>   	}
>   
> +/* Helper macro to match a message on output array references */
> +#define SCMI_MSG(_protocol, _message, _out_array)	\
> +	(struct scmi_msg){				\
> +		.protocol_id = (_protocol),		\
> +		.message_id = (_message),		\
> +		.in_msg = (uint8_t *)NULL,		\

Is the cast needed ?

> +		.in_msg_sz = 0,				\

Is the explicit assignment of in_msg/in_msg_sz even needed at all ?

> +		.out_msg = (uint8_t *)&(_out_array),	\
> +		.out_msg_sz = sizeof(_out_array),	\
> +	}
[...]


More information about the U-Boot mailing list