aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-07-29 11:13:55 -0400
committerMark Brown <broonie@linaro.org>2013-07-29 13:40:59 -0400
commit564c65049eddb1a95b48958080db97eda88c98dd (patch)
treebfcb726569f7296f6875c564ba58276a0a36547a
parent60529c65ec3bc1a347f67eec1b1567efebbf7ce1 (diff)
ASoC: dapm: Move snd_soc_dapm_update from dapm context to card
The update field of a DAPM context is only assigned while the card's dapm_mutex is locked, the field is also cleared again while the mutex is stil locked. So there will only ever be one DAPM context at a time with a non-NULL update field. So it is safe to move the update field from the DAPM context struct to the card struct. Doing so will allow further cleanups in this area. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--include/sound/soc-dapm.h2
-rw-r--r--include/sound/soc.h1
-rw-r--r--sound/soc/soc-dapm.c22
3 files changed, 12 insertions, 13 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index e77c6f5a8390..3397292d94c8 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -575,8 +575,6 @@ struct snd_soc_dapm_context {
575 struct delayed_work delayed_work; 575 struct delayed_work delayed_work;
576 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */ 576 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
577 577
578 struct snd_soc_dapm_update *update;
579
580 void (*seq_notifier)(struct snd_soc_dapm_context *, 578 void (*seq_notifier)(struct snd_soc_dapm_context *,
581 enum snd_soc_dapm_type, int); 579 enum snd_soc_dapm_type, int);
582 580
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 6eabee7ec15a..b1e1f967ae1e 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1042,6 +1042,7 @@ struct snd_soc_card {
1042 /* Generic DAPM context for the card */ 1042 /* Generic DAPM context for the card */
1043 struct snd_soc_dapm_context dapm; 1043 struct snd_soc_dapm_context dapm;
1044 struct snd_soc_dapm_stats dapm_stats; 1044 struct snd_soc_dapm_stats dapm_stats;
1045 struct snd_soc_dapm_update *update;
1045 1046
1046#ifdef CONFIG_DEBUG_FS 1047#ifdef CONFIG_DEBUG_FS
1047 struct dentry *debugfs_card_root; 1048 struct dentry *debugfs_card_root;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 366daef006ed..7449e27bf133 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1425,7 +1425,7 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm,
1425 1425
1426static void dapm_widget_update(struct snd_soc_dapm_context *dapm) 1426static void dapm_widget_update(struct snd_soc_dapm_context *dapm)
1427{ 1427{
1428 struct snd_soc_dapm_update *update = dapm->update; 1428 struct snd_soc_dapm_update *update = dapm->card->update;
1429 struct snd_soc_dapm_widget_list *wlist; 1429 struct snd_soc_dapm_widget_list *wlist;
1430 struct snd_soc_dapm_widget *w = NULL; 1430 struct snd_soc_dapm_widget *w = NULL;
1431 unsigned int wi; 1431 unsigned int wi;
@@ -1959,9 +1959,9 @@ int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm,
1959 int ret; 1959 int ret;
1960 1960
1961 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 1961 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
1962 dapm->update = update; 1962 card->update = update;
1963 ret = soc_dapm_mux_update_power(dapm, kcontrol, mux, e); 1963 ret = soc_dapm_mux_update_power(dapm, kcontrol, mux, e);
1964 dapm->update = NULL; 1964 card->update = NULL;
1965 mutex_unlock(&card->dapm_mutex); 1965 mutex_unlock(&card->dapm_mutex);
1966 if (ret > 0) 1966 if (ret > 0)
1967 soc_dpcm_runtime_update(card); 1967 soc_dpcm_runtime_update(card);
@@ -2002,9 +2002,9 @@ int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm,
2002 int ret; 2002 int ret;
2003 2003
2004 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 2004 mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
2005 dapm->update = update; 2005 card->update = update;
2006 ret = soc_dapm_mixer_update_power(dapm, kcontrol, connect); 2006 ret = soc_dapm_mixer_update_power(dapm, kcontrol, connect);
2007 dapm->update = NULL; 2007 card->update = NULL;
2008 mutex_unlock(&card->dapm_mutex); 2008 mutex_unlock(&card->dapm_mutex);
2009 if (ret > 0) 2009 if (ret > 0)
2010 soc_dpcm_runtime_update(card); 2010 soc_dpcm_runtime_update(card);
@@ -2693,11 +2693,11 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
2693 update.mask = mask; 2693 update.mask = mask;
2694 update.val = val; 2694 update.val = val;
2695 2695
2696 widget->dapm->update = &update; 2696 card->update = &update;
2697 2697
2698 soc_dapm_mixer_update_power(widget->dapm, kcontrol, connect); 2698 soc_dapm_mixer_update_power(widget->dapm, kcontrol, connect);
2699 2699
2700 widget->dapm->update = NULL; 2700 card->update = NULL;
2701 } 2701 }
2702 2702
2703 mutex_unlock(&card->dapm_mutex); 2703 mutex_unlock(&card->dapm_mutex);
@@ -2775,11 +2775,11 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
2775 update.reg = e->reg; 2775 update.reg = e->reg;
2776 update.mask = mask; 2776 update.mask = mask;
2777 update.val = val; 2777 update.val = val;
2778 widget->dapm->update = &update; 2778 card->update = &update;
2779 2779
2780 soc_dapm_mux_update_power(widget->dapm, kcontrol, mux, e); 2780 soc_dapm_mux_update_power(widget->dapm, kcontrol, mux, e);
2781 2781
2782 widget->dapm->update = NULL; 2782 card->update = NULL;
2783 } 2783 }
2784 2784
2785 mutex_unlock(&card->dapm_mutex); 2785 mutex_unlock(&card->dapm_mutex);
@@ -2928,11 +2928,11 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
2928 update.reg = e->reg; 2928 update.reg = e->reg;
2929 update.mask = mask; 2929 update.mask = mask;
2930 update.val = val; 2930 update.val = val;
2931 widget->dapm->update = &update; 2931 card->update = &update;
2932 2932
2933 soc_dapm_mux_update_power(widget->dapm, kcontrol, mux, e); 2933 soc_dapm_mux_update_power(widget->dapm, kcontrol, mux, e);
2934 2934
2935 widget->dapm->update = NULL; 2935 card->update = NULL;
2936 } 2936 }
2937 2937
2938 mutex_unlock(&card->dapm_mutex); 2938 mutex_unlock(&card->dapm_mutex);