diff mbox

[01/17,v2] Input - arizona-haptics: Fix double lock of dapm_mutex

Message ID 1392736948-26623-2-git-send-email-ckeepax@opensource.wolfsonmicro.com (mailing list archive)
State Accepted
Delegated to: Mark Brown
Headers show

Commit Message

Charles Keepax Feb. 18, 2014, 3:22 p.m. UTC
snd_soc_dapm_sync takes the dapm_mutex internally, but we currently take
it externally as well. This patch fixes this.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 drivers/input/misc/arizona-haptics.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

Comments

Mark Brown Feb. 20, 2014, 3:54 a.m. UTC | #1
On Tue, Feb 18, 2014 at 03:22:12PM +0000, Charles Keepax wrote:
> snd_soc_dapm_sync takes the dapm_mutex internally, but we currently take
> it externally as well. This patch fixes this.

Dimitry, are you OK with this being merged via ASoC?  The subsequent
improvements to the infrastructure and fix this more generally build on
top of this one so they'll need to go together.
Dmitry Torokhov Feb. 20, 2014, 4:20 a.m. UTC | #2
On February 19, 2014 7:54:31 PM PST, Mark Brown <broonie@kernel.org> wrote:
>On Tue, Feb 18, 2014 at 03:22:12PM +0000, Charles Keepax wrote:
>> snd_soc_dapm_sync takes the dapm_mutex internally, but we currently
>take
>> it externally as well. This patch fixes this.
>
>Dimitry, are you OK with this being merged via ASoC?  The subsequent
>improvements to the infrastructure and fix this more generally build on
>top of this one so they'll need to go together.


Sure, please go ahead.

Thanks.
Mark Brown Feb. 20, 2014, 9:12 a.m. UTC | #3
On Tue, Feb 18, 2014 at 03:22:12PM +0000, Charles Keepax wrote:
> snd_soc_dapm_sync takes the dapm_mutex internally, but we currently take
> it externally as well. This patch fixes this.

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/input/misc/arizona-haptics.c b/drivers/input/misc/arizona-haptics.c
index 7a04f54..e7e12a5 100644
--- a/drivers/input/misc/arizona-haptics.c
+++ b/drivers/input/misc/arizona-haptics.c
@@ -77,16 +77,14 @@  static void arizona_haptics_work(struct work_struct *work)
 			return;
 		}
 
+		mutex_unlock(dapm_mutex);
+
 		ret = snd_soc_dapm_sync(arizona->dapm);
 		if (ret != 0) {
 			dev_err(arizona->dev, "Failed to sync DAPM: %d\n",
 				ret);
-			mutex_unlock(dapm_mutex);
 			return;
 		}
-
-		mutex_unlock(dapm_mutex);
-
 	} else {
 		/* This disable sequence will be a noop if already enabled */
 		mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
@@ -99,16 +97,15 @@  static void arizona_haptics_work(struct work_struct *work)
 			return;
 		}
 
+		mutex_unlock(dapm_mutex);
+
 		ret = snd_soc_dapm_sync(arizona->dapm);
 		if (ret != 0) {
 			dev_err(arizona->dev, "Failed to sync DAPM: %d\n",
 				ret);
-			mutex_unlock(dapm_mutex);
 			return;
 		}
 
-		mutex_unlock(dapm_mutex);
-
 		ret = regmap_update_bits(arizona->regmap,
 					 ARIZONA_HAPTICS_CONTROL_1,
 					 ARIZONA_HAP_CTRL_MASK,