[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c4498c59-cf64-4a8b-82b9-01d0571779c7@gmail.com>
Date: Wed, 31 Jan 2024 17:41:08 +0000
From: Ivan Orlov <ivan.orlov0322@...il.com>
To: Amadeusz Sławiński
<amadeuszx.slawinski@...ux.intel.com>, perex@...ex.cz, tiwai@...e.com
Cc: linux-sound@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] ALSA: pcm: Add missing formats to formats list
On 1/26/24 09:01, Amadeusz Sławiński wrote:
> On 1/25/2024 11:35 PM, Ivan Orlov wrote:
>> Add 4 missing formats to 'snd_pcm_format_names' array in order to be
>> able to get their names with 'snd_pcm_format_name' function.
>>
>> Signed-off-by: Ivan Orlov <ivan.orlov0322@...il.com>
>> ---
>> sound/core/pcm.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
>> index a09f0154e6a7..d0788126cbab 100644
>> --- a/sound/core/pcm.c
>> +++ b/sound/core/pcm.c
>> @@ -211,6 +211,10 @@ static const char * const snd_pcm_format_names[] = {
>> FORMAT(DSD_U32_LE),
>> FORMAT(DSD_U16_BE),
>> FORMAT(DSD_U32_BE),
>> + FORMAT(S20_LE),
>> + FORMAT(S20_BE),
>> + FORMAT(U20_LE),
>> + FORMAT(U20_BE),
>> };
>> /**
>
> Maybe we can also add some kind of static_assert to check at compile
> time that all formats are handled, something like:
> static_assert(ARRAY_SIZE(snd_pcm_format_names) == SNDRV_PCM_FORMAT_LAST
> + 1);
>
> Although looking at definitions there is a hole between
> SNDRV_PCM_FORMAT_U20_BE & SNDRV_PCM_FORMAT_SPECIAL, which will cause
> this idea to fail.
>
> Perhaps with comment:
> static_assert(ARRAY_SIZE(snd_pcm_format_names) == SNDRV_PCM_FORMAT_LAST
> + 1 - 2); /* -2 for formats reserved for future use */
> ?
Hi Amadeusz,
Thank you for the review and sorry for the late answer. Yes, I believe
it could be a nice improvement! Could I send a patch and specify you in
Suggested-by tag?
--
Kind regards,
Ivan Orlov
Powered by blists - more mailing lists