ASoC: soc-core: remove card->dmi_longname
PATCH v2 1/1 ASoC: soc-core: remove card->dmi_longname
Current Card has dmi_longname[80] (when CONFIG_DMI), but no need to have it in Card, we can alloc it. Tidyup it.
This is prepare for Card capsuling
---
v1 -> v2
- Tidyup tidyup comment
- tidyup #define position
- check dmi_longname before use
include/sound/soc.h | 3 --- sound/soc/soc-core.c | 25 +++++++++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-)
include/sound/soc.h +0 -3
@@ -976,9 +976,6 @@ struct snd_soc_card {const char *long_name;const char *driver_name;const char *components; -#ifdef CONFIG_DMI -char dmi_longname[80 ]; -#endif /* CONFIG_DMI */ #ifdef CONFIG_PCI /*
sound/soc/soc-core.c +15 -10
@@ -1880,12 +1880,12 @@ static int is_dmi_valid(const char *field) }/* -* Append a string to card->dmi_longname with character cleanups. +* Append a string to dmi_longname with character cleanups. */ -static void append_dmi_string (struct snd_soc_card *card,const char *str) +#define DMI_LONGNAME_LEN 80 +static void append_dmi_string (char *dst,const char *str) { -char *dst = card->dmi_longname; -size_t dst_len =sizeof (card->dmi_longname); +size_t dst_len =DMI_LONGNAME_LEN ;size_t len; len =strlen (dst);
@@ -1929,6 +1929,7 @@ static void append_dmi_string(struct snd_soc_card *card, const char *str)static int snd_soc_set_dmi_name (struct snd_soc_card *card) {const char *vendor, *product, *board; +char *dmi_longname;if (card->long_name)return 0 ;/* long name already set by driver or from DMI */
@@ -1943,27 +1944,31 @@ static int snd_soc_set_dmi_name(struct snd_soc_card *card)return 0 ; } -snprintf (card->dmi_longname,sizeof (card->dmi_longname),"%s" , vendor); -cleanup_dmi_name (card->dmi_longname); + dmi_longname =devm_kzalloc (card->dev,DMI_LONGNAME_LEN ,GFP_KERNEL ); +if (!dmi_longname) +return -ENOMEM ; + +snprintf (dmi_longname,DMI_LONGNAME_LEN ,"%s" , vendor); +cleanup_dmi_name (dmi_longname); product =dmi_get_system_info (DMI_PRODUCT_NAME );if (product &&is_dmi_valid (product)) {const char *product_version =dmi_get_system_info (DMI_PRODUCT_VERSION ); -append_dmi_string (card, product); +append_dmi_string (dmi_longname, product);/* * some vendors like Lenovo may only put a self-explanatory * name in the product version field */ if (product_version &&is_dmi_valid (product_version)) -append_dmi_string (card, product_version); +append_dmi_string (dmi_longname, product_version); } board =dmi_get_system_info (DMI_BOARD_NAME );if (board &&is_dmi_valid (board)) {if (!product ||strcasecmp (board, product)) -append_dmi_string (card, board); +append_dmi_string (dmi_longname, board); }else if (!product) {/* fall back to using legacy name */ dev_warn (card->dev,"ASoC: no DMI board/product name!\n" );
@@ -1971,7 +1976,7 @@ static int snd_soc_set_dmi_name(struct snd_soc_card *card) }/* set the card long name */ - card->long_name = card->dmi_longname; + card->long_name = dmi_longname;return 0 ; }
Signature · 1 line
2.43.0
Mark Brown
maintainerQuoted 1 line · Kuninori Morimoto
ASoC: soc-core: remove
card->dmi_longname
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.2
Thanks!
[1/1] ASoC: soc-core: remove card->dmi_longname
https://git.kernel.org/broonie/sound/c/66c75c7e0498
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark