From 22de71ba03311cdc1063757c50a1488cb90a1fca Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 12 May 2011 16:14:04 +0100 Subject: ASoC: core - allow ASoC more flexible machine name Allow ASoC machine drivers to register a driver name and a longname. This allows user space to determine the flavour of machine driver. Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sound/soc/soc-core.c') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a477e218aa2..c1a4cf480c7 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1926,9 +1926,11 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) card->num_dapm_routes); snprintf(card->snd_card->shortname, sizeof(card->snd_card->shortname), - "%s", card->name); - snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), "%s", card->name); + snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), + "%s", card->long_name ? card->long_name : card->name); + snprintf(card->snd_card->driver, sizeof(card->snd_card->driver), + "%s", card->driver_name); if (card->late_probe) { ret = card->late_probe(card); -- cgit v1.2.3-70-g09d2 From 34e268d87d60da7968d7300aae7d575be9d16ae7 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Thu, 12 May 2011 16:50:10 -0700 Subject: ASoC: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning Enabling DEBUG_STRICT_USER_COPY_CHECKS causes the following warning: In file included from arch/x86/include/asm/uaccess.h:573, from include/linux/poll.h:14, from include/sound/pcm.h:29, from include/sound/ac97_codec.h:31, from sound/soc/soc-core.c:34: In function 'copy_from_user', inlined from 'codec_reg_write_file' at sound/soc/soc-core.c:252: arch/x86/include/asm/uaccess_64.h:65: warning: call to 'copy_from_user_overflow' declared with attribute warning: copy_from_user() buffer size is not provably correct presumably due to buf_size being signed causing GCC to fail to see that buf_size can't become negative. Acked-by: Liam Girdwood Signed-off-by: Stephen Boyd Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/soc/soc-core.c') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c1a4cf480c7..5968745213f 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -242,7 +242,7 @@ static ssize_t codec_reg_write_file(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos) { char buf[32]; - int buf_size; + size_t buf_size; char *start = buf; unsigned long reg, value; int step = 1; -- cgit v1.2.3-70-g09d2 From 2b39535b9e54888649923beaab443af212b6c0fd Mon Sep 17 00:00:00 2001 From: Jarkko Nikula Date: Fri, 20 May 2011 15:47:40 +0300 Subject: ASoC: core: Don't set "(null)" as a driver name Commit 22de71b ("ASoC: core - allow ASoC more flexible machine name") writes "(null)" to driver name string in struct snd_card if card->driver_name is NULL. This causes segmentation faults with some user space ALSA utilities like aplay and arecord. Fix this by using the card->name if no driver name is specified. Signed-off-by: Jarkko Nikula Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/soc/soc-core.c') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 5968745213f..bb7cd581294 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1930,7 +1930,7 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), "%s", card->long_name ? card->long_name : card->name); snprintf(card->snd_card->driver, sizeof(card->snd_card->driver), - "%s", card->driver_name); + "%s", card->driver_name ? card->driver_name : card->name); if (card->late_probe) { ret = card->late_probe(card); -- cgit v1.2.3-70-g09d2 From 61b61e3c5c9bf37ca2915ac981f444989ab22f10 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Tue, 24 May 2011 13:57:43 +0100 Subject: ASoC: core - fix module reference counting for CPU DAIs Currently CODEC and platform drivers have their module reference count incremented soc_probe_dai_link() whilst CPU DAI drivers have their reference count incremented in soc_bind_dai_link(). CPU DAIs should have their reference count incremented in soc_probe_dai_link() just like the CODEC and platform drivers. Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sound/soc/soc-core.c') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index bb7cd581294..07991d43879 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1306,10 +1306,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num) /* no, then find CPU DAI from registered DAIs*/ list_for_each_entry(cpu_dai, &dai_list, list) { if (!strcmp(cpu_dai->name, dai_link->cpu_dai_name)) { - - if (!try_module_get(cpu_dai->dev->driver->owner)) - return -ENODEV; - rtd->cpu_dai = cpu_dai; goto find_codec; } @@ -1621,12 +1617,17 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num) rtd->pmdown_time = pmdown_time; /* probe the cpu_dai */ + if (!cpu_dai->probed) { + if (!try_module_get(cpu_dai->dev->driver->owner)) + return -ENODEV; + if (cpu_dai->driver->probe) { ret = cpu_dai->driver->probe(cpu_dai); if (ret < 0) { printk(KERN_ERR "asoc: failed to probe CPU DAI %s\n", cpu_dai->name); + module_put(cpu_dai->dev->driver->owner); return ret; } } -- cgit v1.2.3-70-g09d2 From 92505299a131b47992d318f2875d5629ac870d87 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Tue, 24 May 2011 17:38:52 +0100 Subject: ASoC: core - remove superfluous new line. Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sound/soc/soc-core.c') diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 07991d43879..d75043ed7fc 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1617,7 +1617,6 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num) rtd->pmdown_time = pmdown_time; /* probe the cpu_dai */ - if (!cpu_dai->probed) { if (!try_module_get(cpu_dai->dev->driver->owner)) return -ENODEV; -- cgit v1.2.3-70-g09d2