diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-09-20 06:41:54 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-09-21 09:54:23 -0400 |
commit | f0e8ed858edb327802ee65fd695cc1538286226f (patch) | |
tree | a9d199786e89f82ac68aa2f78850c59f095f774d /sound | |
parent | f93dc4b6c975baeef9267a62451b370fbc586f3f (diff) |
ASoC: Ensure we generate a driver name
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>
Diffstat (limited to 'sound')
-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 d2ef014af215..ef69f5a02709 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/bitops.h> | 30 | #include <linux/bitops.h> |
31 | #include <linux/debugfs.h> | 31 | #include <linux/debugfs.h> |
32 | #include <linux/platform_device.h> | 32 | #include <linux/platform_device.h> |
33 | #include <linux/ctype.h> | ||
33 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
34 | #include <sound/ac97_codec.h> | 35 | #include <sound/ac97_codec.h> |
35 | #include <sound/core.h> | 36 | #include <sound/core.h> |
@@ -1434,9 +1435,20 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) | |||
1434 | "%s", card->name); | 1435 | "%s", card->name); |
1435 | snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), | 1436 | snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), |
1436 | "%s", card->long_name ? card->long_name : card->name); | 1437 | "%s", card->long_name ? card->long_name : card->name); |
1437 | if (card->driver_name) | 1438 | snprintf(card->snd_card->driver, sizeof(card->snd_card->driver), |
1438 | strlcpy(card->snd_card->driver, card->driver_name, | 1439 | "%s", card->driver_name ? card->driver_name : card->name); |
1439 | sizeof(card->snd_card->driver)); | 1440 | for (i = 0; i < ARRAY_SIZE(card->snd_card->driver); i++) { |
1441 | switch (card->snd_card->driver[i]) { | ||
1442 | case '_': | ||
1443 | case '-': | ||
1444 | case '\0': | ||
1445 | break; | ||
1446 | default: | ||
1447 | if (!isalnum(card->snd_card->driver[i])) | ||
1448 | card->snd_card->driver[i] = '_'; | ||
1449 | break; | ||
1450 | } | ||
1451 | } | ||
1440 | 1452 | ||
1441 | if (card->late_probe) { | 1453 | if (card->late_probe) { |
1442 | ret = card->late_probe(card); | 1454 | ret = card->late_probe(card); |