aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/soc-dapm.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 5a4376b41926..5c01ac1cfc0a 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -115,6 +115,12 @@ static int dapm_down_seq[] = {
115 [snd_soc_dapm_post] = 14, 115 [snd_soc_dapm_post] = 14,
116}; 116};
117 117
118static void dapm_assert_locked(struct snd_soc_dapm_context *dapm)
119{
120 if (dapm->card && dapm->card->instantiated)
121 lockdep_assert_held(&dapm->card->dapm_mutex);
122}
123
118static void pop_wait(u32 pop_time) 124static void pop_wait(u32 pop_time)
119{ 125{
120 if (pop_time) 126 if (pop_time)
@@ -148,6 +154,8 @@ static bool dapm_dirty_widget(struct snd_soc_dapm_widget *w)
148 154
149static void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason) 155static void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason)
150{ 156{
157 dapm_assert_locked(w->dapm);
158
151 if (!dapm_dirty_widget(w)) { 159 if (!dapm_dirty_widget(w)) {
152 dev_vdbg(w->dapm->dev, "Marking %s dirty due to %s\n", 160 dev_vdbg(w->dapm->dev, "Marking %s dirty due to %s\n",
153 w->name, reason); 161 w->name, reason);
@@ -360,6 +368,8 @@ static void dapm_reset(struct snd_soc_card *card)
360{ 368{
361 struct snd_soc_dapm_widget *w; 369 struct snd_soc_dapm_widget *w;
362 370
371 lockdep_assert_held(&card->dapm_mutex);
372
363 memset(&card->dapm_stats, 0, sizeof(card->dapm_stats)); 373 memset(&card->dapm_stats, 0, sizeof(card->dapm_stats));
364 374
365 list_for_each_entry(w, &card->widgets, list) { 375 list_for_each_entry(w, &card->widgets, list) {
@@ -1823,6 +1833,8 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event)
1823 ASYNC_DOMAIN_EXCLUSIVE(async_domain); 1833 ASYNC_DOMAIN_EXCLUSIVE(async_domain);
1824 enum snd_soc_bias_level bias; 1834 enum snd_soc_bias_level bias;
1825 1835
1836 lockdep_assert_held(&card->dapm_mutex);
1837
1826 trace_snd_soc_dapm_start(card); 1838 trace_snd_soc_dapm_start(card);
1827 1839
1828 list_for_each_entry(d, &card->dapm_list, list) { 1840 list_for_each_entry(d, &card->dapm_list, list) {
@@ -2118,6 +2130,8 @@ static int soc_dapm_mux_update_power(struct snd_soc_card *card,
2118 struct snd_soc_dapm_path *path; 2130 struct snd_soc_dapm_path *path;
2119 int found = 0; 2131 int found = 0;
2120 2132
2133 lockdep_assert_held(&card->dapm_mutex);
2134
2121 /* find dapm widget path assoc with kcontrol */ 2135 /* find dapm widget path assoc with kcontrol */
2122 dapm_kcontrol_for_each_path(path, kcontrol) { 2136 dapm_kcontrol_for_each_path(path, kcontrol) {
2123 if (!path->name || !e->texts[mux]) 2137 if (!path->name || !e->texts[mux])
@@ -2168,6 +2182,8 @@ static int soc_dapm_mixer_update_power(struct snd_soc_card *card,
2168 struct snd_soc_dapm_path *path; 2182 struct snd_soc_dapm_path *path;
2169 int found = 0; 2183 int found = 0;
2170 2184
2185 lockdep_assert_held(&card->dapm_mutex);
2186
2171 /* find dapm widget path assoc with kcontrol */ 2187 /* find dapm widget path assoc with kcontrol */
2172 dapm_kcontrol_for_each_path(path, kcontrol) { 2188 dapm_kcontrol_for_each_path(path, kcontrol) {
2173 found = 1; 2189 found = 1;
@@ -2333,6 +2349,8 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
2333{ 2349{
2334 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); 2350 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true);
2335 2351
2352 dapm_assert_locked(dapm);
2353
2336 if (!w) { 2354 if (!w) {
2337 dev_err(dapm->dev, "ASoC: DAPM unknown pin %s\n", pin); 2355 dev_err(dapm->dev, "ASoC: DAPM unknown pin %s\n", pin);
2338 return -EINVAL; 2356 return -EINVAL;