diff mbox

[03/15] ASoC: adav80x: Update locking around use of DAPM pin API

Message ID 1392655903-24537-4-git-send-email-ckeepax@opensource.wolfsonmicro.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Charles Keepax Feb. 17, 2014, 4:51 p.m. UTC
The pin updates in this driver look like they are intended to be done
atomically, update to do so.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 sound/soc/codecs/adav80x.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

Comments

Mark Brown Feb. 18, 2014, 12:33 a.m. UTC | #1
On Mon, Feb 17, 2014 at 04:51:31PM +0000, Charles Keepax wrote:

> +		mutex_lock(&codec->dapm.card->dapm_mutex);
> +

I think this needs a helper that just takes the CODEC as an argument and
does the lookup - a static inline in the header would be fine.  The big
long dereference is ugly for something people should be doing and will
be annoying if we want to refactor in the future.
diff mbox

Patch

diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c
index f78b27a..aacb2c03 100644
--- a/sound/soc/codecs/adav80x.c
+++ b/sound/soc/codecs/adav80x.c
@@ -600,15 +600,21 @@  static int adav80x_set_sysclk(struct snd_soc_codec *codec,
 			adav80x->sysclk_pd[clk_id] = false;
 		}
 
+		mutex_lock(&codec->dapm.card->dapm_mutex);
+
 		if (adav80x->sysclk_pd[0])
-			snd_soc_dapm_disable_pin(&codec->dapm, "PLL1");
+			snd_soc_dapm_disable_pin_locked(&codec->dapm, "PLL1");
 		else
-			snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL1");
+			snd_soc_dapm_force_enable_pin_locked(&codec->dapm,
+							     "PLL1");
 
 		if (adav80x->sysclk_pd[1] || adav80x->sysclk_pd[2])
-			snd_soc_dapm_disable_pin(&codec->dapm, "PLL2");
+			snd_soc_dapm_disable_pin_locked(&codec->dapm, "PLL2");
 		else
-			snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL2");
+			snd_soc_dapm_force_enable_pin_locked(&codec->dapm,
+							     "PLL2");
+
+		mutex_unlock(&codec->dapm.card->dapm_mutex);
 
 		snd_soc_dapm_sync(&codec->dapm);
 	}