From: Ivan Orlov <ivan.orlov0322@gmail.com>
To: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>,
perex@perex.cz, tiwai@suse.com
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] ALSA: pcm: Add missing formats to formats list
Date: Wed, 31 Jan 2024 17:41:08 +0000 [thread overview]
Message-ID: <c4498c59-cf64-4a8b-82b9-01d0571779c7@gmail.com> (raw)
In-Reply-To: <3b5bf4b7-a4ec-44be-975b-04590777a965@linux.intel.com>
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@gmail.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
next prev parent reply other threads:[~2024-01-31 17:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 22:35 Ivan Orlov
2024-01-25 22:35 ` [PATCH 2/3] ALSA: pcm: Fix snd_pcm_format_name function Ivan Orlov
2024-01-25 22:35 ` [PATCH 3/3] ALSA: core: Add sound core KUnit test Ivan Orlov
2024-01-26 9:01 ` [PATCH 1/3] ALSA: pcm: Add missing formats to formats list Amadeusz Sławiński
2024-01-31 17:41 ` Ivan Orlov [this message]
2024-02-01 8:54 ` Amadeusz Sławiński
2024-01-30 13:15 ` Takashi Iwai
2024-01-31 17:42 ` Ivan Orlov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c4498c59-cf64-4a8b-82b9-01d0571779c7@gmail.com \
--to=ivan.orlov0322@gmail.com \
--cc=amadeuszx.slawinski@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®