diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-09-20 11:41:54 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-02-13 11:06:08 -0800 |
commit | 10f672f1a199240bc2a77d6f81e1d37f33ba743e (patch) | |
tree | 29974eb8e5b07583e9ffc6f9327714dab2c203bb | |
parent | c27711dc7f2cff89cee6a47026d936672cb29350 (diff) | |
download | kernel_samsung_aries-10f672f1a199240bc2a77d6f81e1d37f33ba743e.zip kernel_samsung_aries-10f672f1a199240bc2a77d6f81e1d37f33ba743e.tar.gz kernel_samsung_aries-10f672f1a199240bc2a77d6f81e1d37f33ba743e.tar.bz2 |
ASoC: Ensure we generate a driver name
commit f0e8ed858edb327802ee65fd695cc1538286226f upstream.
Commit 873bd4c (ASoC: Don't set invalid name string to snd_card->driver
field) broke generation of a driver name for all ASoC cards relying on the
automatic generation of one. Fix this by using the old default with spaces
replaced by underscores.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | sound/soc/soc-core.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 493ae7c..e2bfe1d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -30,6 +30,7 @@ #include <linux/bitops.h> #include <linux/debugfs.h> #include <linux/platform_device.h> +#include <linux/ctype.h> #include <linux/slab.h> #include <sound/ac97_codec.h> #include <sound/core.h> @@ -1931,9 +1932,20 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) "%s", card->name); snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), "%s", card->long_name ? card->long_name : card->name); - if (card->driver_name) - strlcpy(card->snd_card->driver, card->driver_name, - sizeof(card->snd_card->driver)); + snprintf(card->snd_card->driver, sizeof(card->snd_card->driver), + "%s", card->driver_name ? card->driver_name : card->name); + for (i = 0; i < ARRAY_SIZE(card->snd_card->driver); i++) { + switch (card->snd_card->driver[i]) { + case '_': + case '-': + case '\0': + break; + default: + if (!isalnum(card->snd_card->driver[i])) + card->snd_card->driver[i] = '_'; + break; + } + } if (card->late_probe) { ret = card->late_probe(card); |