[alsa-devel] [PATCH 1/2] ASoC: improve the DMI long card code in asoc-core
Jaroslav Kysela
perex at perex.cz
Wed Nov 20 18:28:11 CET 2019
Dne 20. 11. 19 v 15:55 Pierre-Louis Bossart napsal(a):
>
>
> On 11/20/19 3:37 AM, Jaroslav Kysela wrote:
>> Add append_dmi_string() function and make the code more readable.
>>
>> Signed-off-by: Jaroslav Kysela <perex at perex.cz>
>> Cc: Mark Brown <broonie at kernel.org>
>> ---
>> sound/soc/soc-core.c | 66 +++++++++++++++++---------------------------
>> 1 file changed, 25 insertions(+), 41 deletions(-)
>>
>> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
>> index b4683d4588ee..1d1baf78818c 100644
>> --- a/sound/soc/soc-core.c
>> +++ b/sound/soc/soc-core.c
>> @@ -1755,6 +1755,23 @@ static int is_dmi_valid(const char *field)
>> return 1;
>> }
>>
>> +/*
>> + *
>> + */
>
> unneeded comments or missing text?
There should be a text, of course.
>> +static void append_dmi_string(struct snd_soc_card *card, const char *str)
>> +{
>> + char *dst = card->dmi_longname;
>> + size_t dst_len = sizeof(card->dmi_longname);
>> + size_t len;
>> +
>> + len = strlen(dst);
>> + snprintf(dst + len, dst_len - len, "-%s", str);
>> +
>> + len++; /* skip the separator "-" */
>> + if (len < dst_len)
>> + cleanup_dmi_name(dst + len);
>> +}
>> +
>> /**
>> * snd_soc_set_dmi_name() - Register DMI names to card
>> * @card: The card to register DMI names
>> @@ -1789,61 +1806,36 @@ static int is_dmi_valid(const char *field)
>> int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour)
>> {
>> const char *vendor, *product, *product_version, *board;
>> - size_t longname_buf_size = sizeof(card->snd_card->longname);
>> - size_t len;
>>
>> if (card->long_name)
>> return 0; /* long name already set by driver or from DMI */
>>
>> - /* make up dmi long name as: vendor.product.version.board */
>> + /* make up dmi long name as: vendor-product-version-board */
>
> here you are just fixing a misleading comment, yes?
> I don't see any dots to dashes substitution but better ask.
The result is LENOVO-20QE000VMC-ThinkPadX1Carbon7th-20QE000VMC. I think that
the dots were replaced by dashes as the field separators during the initial
implementation or so. I just reflect the current state.
Jaroslav
--
Jaroslav Kysela <perex at perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
More information about the Alsa-devel
mailing list