Commit 564c6504 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown

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: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 60529c65
...@@ -575,8 +575,6 @@ struct snd_soc_dapm_context { ...@@ -575,8 +575,6 @@ struct snd_soc_dapm_context {
struct delayed_work delayed_work; struct delayed_work delayed_work;
unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */ unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
struct snd_soc_dapm_update *update;
void (*seq_notifier)(struct snd_soc_dapm_context *, void (*seq_notifier)(struct snd_soc_dapm_context *,
enum snd_soc_dapm_type, int); enum snd_soc_dapm_type, int);
......
...@@ -1042,6 +1042,7 @@ struct snd_soc_card { ...@@ -1042,6 +1042,7 @@ struct snd_soc_card {
/* Generic DAPM context for the card */ /* Generic DAPM context for the card */
struct snd_soc_dapm_context dapm; struct snd_soc_dapm_context dapm;
struct snd_soc_dapm_stats dapm_stats; struct snd_soc_dapm_stats dapm_stats;
struct snd_soc_dapm_update *update;
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_card_root; struct dentry *debugfs_card_root;
......
...@@ -1425,7 +1425,7 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm, ...@@ -1425,7 +1425,7 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm,
static void dapm_widget_update(struct snd_soc_dapm_context *dapm) static void dapm_widget_update(struct snd_soc_dapm_context *dapm)
{ {
struct snd_soc_dapm_update *update = dapm->update; struct snd_soc_dapm_update *update = dapm->card->update;
struct snd_soc_dapm_widget_list *wlist; struct snd_soc_dapm_widget_list *wlist;
struct snd_soc_dapm_widget *w = NULL; struct snd_soc_dapm_widget *w = NULL;
unsigned int wi; unsigned int wi;
...@@ -1959,9 +1959,9 @@ int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm, ...@@ -1959,9 +1959,9 @@ int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm,
int ret; int ret;
mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
dapm->update = update; card->update = update;
ret = soc_dapm_mux_update_power(dapm, kcontrol, mux, e); ret = soc_dapm_mux_update_power(dapm, kcontrol, mux, e);
dapm->update = NULL; card->update = NULL;
mutex_unlock(&card->dapm_mutex); mutex_unlock(&card->dapm_mutex);
if (ret > 0) if (ret > 0)
soc_dpcm_runtime_update(card); soc_dpcm_runtime_update(card);
...@@ -2002,9 +2002,9 @@ int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm, ...@@ -2002,9 +2002,9 @@ int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm,
int ret; int ret;
mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
dapm->update = update; card->update = update;
ret = soc_dapm_mixer_update_power(dapm, kcontrol, connect); ret = soc_dapm_mixer_update_power(dapm, kcontrol, connect);
dapm->update = NULL; card->update = NULL;
mutex_unlock(&card->dapm_mutex); mutex_unlock(&card->dapm_mutex);
if (ret > 0) if (ret > 0)
soc_dpcm_runtime_update(card); soc_dpcm_runtime_update(card);
...@@ -2693,11 +2693,11 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, ...@@ -2693,11 +2693,11 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
update.mask = mask; update.mask = mask;
update.val = val; update.val = val;
widget->dapm->update = &update; card->update = &update;
soc_dapm_mixer_update_power(widget->dapm, kcontrol, connect); soc_dapm_mixer_update_power(widget->dapm, kcontrol, connect);
widget->dapm->update = NULL; card->update = NULL;
} }
mutex_unlock(&card->dapm_mutex); mutex_unlock(&card->dapm_mutex);
...@@ -2775,11 +2775,11 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, ...@@ -2775,11 +2775,11 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
update.reg = e->reg; update.reg = e->reg;
update.mask = mask; update.mask = mask;
update.val = val; update.val = val;
widget->dapm->update = &update; card->update = &update;
soc_dapm_mux_update_power(widget->dapm, kcontrol, mux, e); soc_dapm_mux_update_power(widget->dapm, kcontrol, mux, e);
widget->dapm->update = NULL; card->update = NULL;
} }
mutex_unlock(&card->dapm_mutex); mutex_unlock(&card->dapm_mutex);
...@@ -2928,11 +2928,11 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, ...@@ -2928,11 +2928,11 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
update.reg = e->reg; update.reg = e->reg;
update.mask = mask; update.mask = mask;
update.val = val; update.val = val;
widget->dapm->update = &update; card->update = &update;
soc_dapm_mux_update_power(widget->dapm, kcontrol, mux, e); soc_dapm_mux_update_power(widget->dapm, kcontrol, mux, e);
widget->dapm->update = NULL; card->update = NULL;
} }
mutex_unlock(&card->dapm_mutex); mutex_unlock(&card->dapm_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment