mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 22:56:27 +08:00
Merge remote-tracking branch 'asoc/fix/dapm' into asoc-linus
This commit is contained in:
commit
61710a655f
@ -1716,6 +1716,7 @@ card_probe_error:
|
||||
if (card->remove)
|
||||
card->remove(card);
|
||||
|
||||
snd_soc_dapm_free(&card->dapm);
|
||||
soc_cleanup_card_debugfs(card);
|
||||
snd_card_free(card->snd_card);
|
||||
|
||||
|
@ -358,9 +358,10 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
|
||||
data->widget =
|
||||
snd_soc_dapm_new_control_unlocked(widget->dapm,
|
||||
&template);
|
||||
kfree(name);
|
||||
if (!data->widget) {
|
||||
ret = -ENOMEM;
|
||||
goto err_name;
|
||||
goto err_data;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -389,11 +390,12 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
|
||||
|
||||
data->value = template.on_val;
|
||||
|
||||
data->widget = snd_soc_dapm_new_control(widget->dapm,
|
||||
&template);
|
||||
data->widget = snd_soc_dapm_new_control_unlocked(
|
||||
widget->dapm, &template);
|
||||
kfree(name);
|
||||
if (!data->widget) {
|
||||
ret = -ENOMEM;
|
||||
goto err_name;
|
||||
goto err_data;
|
||||
}
|
||||
|
||||
snd_soc_dapm_add_path(widget->dapm, data->widget,
|
||||
@ -408,8 +410,6 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
|
||||
|
||||
return 0;
|
||||
|
||||
err_name:
|
||||
kfree(name);
|
||||
err_data:
|
||||
kfree(data);
|
||||
return ret;
|
||||
@ -418,8 +418,6 @@ err_data:
|
||||
static void dapm_kcontrol_free(struct snd_kcontrol *kctl)
|
||||
{
|
||||
struct dapm_kcontrol_data *data = snd_kcontrol_chip(kctl);
|
||||
if (data->widget)
|
||||
kfree(data->widget->name);
|
||||
kfree(data->wlist);
|
||||
kfree(data);
|
||||
}
|
||||
@ -1952,6 +1950,7 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct snd_soc_dapm_widget *w = file->private_data;
|
||||
struct snd_soc_card *card = w->dapm->card;
|
||||
char *buf;
|
||||
int in, out;
|
||||
ssize_t ret;
|
||||
@ -1961,6 +1960,8 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
mutex_lock(&card->dapm_mutex);
|
||||
|
||||
/* Supply widgets are not handled by is_connected_{input,output}_ep() */
|
||||
if (w->is_supply) {
|
||||
in = 0;
|
||||
@ -2007,6 +2008,8 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
|
||||
p->sink->name);
|
||||
}
|
||||
|
||||
mutex_unlock(&card->dapm_mutex);
|
||||
|
||||
ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
|
||||
|
||||
kfree(buf);
|
||||
@ -2281,11 +2284,15 @@ static ssize_t dapm_widget_show(struct device *dev,
|
||||
struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
|
||||
int i, count = 0;
|
||||
|
||||
mutex_lock(&rtd->card->dapm_mutex);
|
||||
|
||||
for (i = 0; i < rtd->num_codecs; i++) {
|
||||
struct snd_soc_codec *codec = rtd->codec_dais[i]->codec;
|
||||
count += dapm_widget_show_codec(codec, buf + count);
|
||||
}
|
||||
|
||||
mutex_unlock(&rtd->card->dapm_mutex);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@ -3334,16 +3341,10 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm,
|
||||
}
|
||||
|
||||
prefix = soc_dapm_prefix(dapm);
|
||||
if (prefix) {
|
||||
if (prefix)
|
||||
w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name);
|
||||
if (widget->sname)
|
||||
w->sname = kasprintf(GFP_KERNEL, "%s %s", prefix,
|
||||
widget->sname);
|
||||
} else {
|
||||
else
|
||||
w->name = kasprintf(GFP_KERNEL, "%s", widget->name);
|
||||
if (widget->sname)
|
||||
w->sname = kasprintf(GFP_KERNEL, "%s", widget->sname);
|
||||
}
|
||||
if (w->name == NULL) {
|
||||
kfree(w);
|
||||
return NULL;
|
||||
@ -3792,7 +3793,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!w->sname || !strstr(w->sname, dai_w->name))
|
||||
if (!w->sname || !strstr(w->sname, dai_w->sname))
|
||||
continue;
|
||||
|
||||
if (dai_w->id == snd_soc_dapm_dai_in) {
|
||||
|
Loading…
Reference in New Issue
Block a user