Re: [PATCH] ASoC: codecs: Use ARRAY_SIZE() to calculate PEB2466_TLV_SIZE
From: Herve Codina
Date: Mon Jan 13 2025 - 04:50:20 EST
Hi Thorsten,
On Mon, 13 Jan 2025 01:10:01 +0100
Thorsten Blum <thorsten.blum@xxxxxxxxx> wrote:
> Use the ARRAY_SIZE() macro to calculate PEB2466_TLV_SIZE and improve the
> code's readability.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
> ---
> sound/soc/codecs/peb2466.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/sound/soc/codecs/peb2466.c b/sound/soc/codecs/peb2466.c
> index bb9ca6354ae1..a989cfe058f0 100644
> --- a/sound/soc/codecs/peb2466.c
> +++ b/sound/soc/codecs/peb2466.c
> @@ -26,8 +26,7 @@ struct peb2466_lookup {
> unsigned int count;
> };
>
> -#define PEB2466_TLV_SIZE (sizeof((unsigned int []){TLV_DB_SCALE_ITEM(0, 0, 0)}) / \
> - sizeof(unsigned int))
> +#define PEB2466_TLV_SIZE ARRAY_SIZE(((unsigned int[]){TLV_DB_SCALE_ITEM(0, 0, 0)}))
>
> struct peb2466_lkup_ctrl {
> int reg;
Acked-by: Herve Codina <herve.codina@xxxxxxxxxxx>
Best regards,
Hervé