From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: broonie@kernel.org
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
lgirdwood@gmail.com
Subject: [PATCH 1/3] ASoC: wm_adsp: Correct some missing locking
Date: Tue, 24 Jan 2017 11:43:59 +0000 [thread overview]
Message-ID: <1485258241-10575-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> (raw)
The recent refactoring overlooked some places which should be covered by
the pwr_lock, all code that affects or depends on the power status of
the DSP should be covered, this patch adds the missing coverage.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
sound/soc/codecs/wm_adsp.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 73dbe4c..08a4a61 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -2575,6 +2575,8 @@ int wm_adsp2_early_event(struct snd_soc_dapm_widget *w,
queue_work(system_unbound_wq, &dsp->boot_work);
break;
case SND_SOC_DAPM_PRE_PMD:
+ mutex_lock(&dsp->pwr_lock);
+
wm_adsp_debugfs_clear(dsp);
dsp->fw_id = 0;
@@ -2590,6 +2592,8 @@ int wm_adsp2_early_event(struct snd_soc_dapm_widget *w,
wm_adsp_free_alg_regions(dsp);
+ mutex_unlock(&dsp->pwr_lock);
+
adsp_dbg(dsp, "Shutdown complete\n");
break;
default:
@@ -2612,8 +2616,12 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,
case SND_SOC_DAPM_POST_PMU:
flush_work(&dsp->boot_work);
- if (!dsp->booted)
- return -EIO;
+ mutex_lock(&dsp->pwr_lock);
+
+ if (!dsp->booted) {
+ ret = -EIO;
+ goto err;
+ }
ret = wm_adsp2_ena(dsp);
if (ret != 0)
@@ -2633,14 +2641,10 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,
dsp->running = true;
- mutex_lock(&dsp->pwr_lock);
-
if (wm_adsp_fw[dsp->fw].num_caps != 0) {
ret = wm_adsp_buffer_init(dsp);
- if (ret < 0) {
- mutex_unlock(&dsp->pwr_lock);
+ if (ret < 0)
goto err;
- }
}
mutex_unlock(&dsp->pwr_lock);
@@ -2685,6 +2689,7 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,
err:
regmap_update_bits(dsp->regmap, dsp->base + ADSP2_CONTROL,
ADSP2_SYS_ENA | ADSP2_CORE_ENA | ADSP2_START, 0);
+ mutex_unlock(&dsp->pwr_lock);
return ret;
}
EXPORT_SYMBOL_GPL(wm_adsp2_event);
--
2.1.4
next reply other threads:[~2017-01-24 11:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 11:43 Charles Keepax [this message]
2017-01-24 11:44 ` [PATCH 2/3] ASoC: wm_adsp: Set booted/running flags at the end of bring up Charles Keepax
2017-01-24 18:39 ` Applied "ASoC: wm_adsp: Set booted/running flags at the end of bring up" to the asoc tree Mark Brown
2017-01-24 11:44 ` [PATCH 3/3] ASoC: wm_adsp: Fixup wm_adsp2_boot_work error paths Charles Keepax
2017-01-24 18:39 ` Applied "ASoC: wm_adsp: Fixup wm_adsp2_boot_work error paths" to the asoc tree Mark Brown
2017-01-24 18:39 ` Applied "ASoC: wm_adsp: Correct some missing locking" " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1485258241-10575-1-git-send-email-ckeepax@opensource.wolfsonmicro.com \
--to=ckeepax@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=patches@opensource.wolfsonmicro.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.