aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/misc
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2014-02-18 10:22:14 -0500
committerMark Brown <broonie@linaro.org>2014-02-20 04:40:07 -0500
commit113911006442a36c2b4669faf1699d9042ef80ab (patch)
treed93a53b643d0293bff11ffaceb35174524474b05 /drivers/input/misc
parentc4204960e9d0ba99459dbf1db918f99a45e7a62a (diff)
ASoC: dapm: Add locking to snd_soc_dapm_xxxx_pin functions
The snd_soc_dapm_xxxx_pin all require the dapm_mutex to be held when they are called as they edit the dirty list, however very few of the callers do so. This patch adds unlocked versions of all the functions replacing the existing implementations with one that holds the lock internally. We also fix up the places where the lock was actually held on the caller side. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/input/misc')
-rw-r--r--drivers/input/misc/arizona-haptics.c16
1 files changed, 0 insertions, 16 deletions
diff --git a/drivers/input/misc/arizona-haptics.c b/drivers/input/misc/arizona-haptics.c
index e7e12a5f5c2d..ef2e281b0a43 100644
--- a/drivers/input/misc/arizona-haptics.c
+++ b/drivers/input/misc/arizona-haptics.c
@@ -37,7 +37,6 @@ static void arizona_haptics_work(struct work_struct *work)
37 struct arizona_haptics, 37 struct arizona_haptics,
38 work); 38 work);
39 struct arizona *arizona = haptics->arizona; 39 struct arizona *arizona = haptics->arizona;
40 struct mutex *dapm_mutex = &arizona->dapm->card->dapm_mutex;
41 int ret; 40 int ret;
42 41
43 if (!haptics->arizona->dapm) { 42 if (!haptics->arizona->dapm) {
@@ -67,18 +66,13 @@ static void arizona_haptics_work(struct work_struct *work)
67 return; 66 return;
68 } 67 }
69 68
70 mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
71
72 ret = snd_soc_dapm_enable_pin(arizona->dapm, "HAPTICS"); 69 ret = snd_soc_dapm_enable_pin(arizona->dapm, "HAPTICS");
73 if (ret != 0) { 70 if (ret != 0) {
74 dev_err(arizona->dev, "Failed to start HAPTICS: %d\n", 71 dev_err(arizona->dev, "Failed to start HAPTICS: %d\n",
75 ret); 72 ret);
76 mutex_unlock(dapm_mutex);
77 return; 73 return;
78 } 74 }
79 75
80 mutex_unlock(dapm_mutex);
81
82 ret = snd_soc_dapm_sync(arizona->dapm); 76 ret = snd_soc_dapm_sync(arizona->dapm);
83 if (ret != 0) { 77 if (ret != 0) {
84 dev_err(arizona->dev, "Failed to sync DAPM: %d\n", 78 dev_err(arizona->dev, "Failed to sync DAPM: %d\n",
@@ -87,18 +81,13 @@ static void arizona_haptics_work(struct work_struct *work)
87 } 81 }
88 } else { 82 } else {
89 /* This disable sequence will be a noop if already enabled */ 83 /* This disable sequence will be a noop if already enabled */
90 mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
91
92 ret = snd_soc_dapm_disable_pin(arizona->dapm, "HAPTICS"); 84 ret = snd_soc_dapm_disable_pin(arizona->dapm, "HAPTICS");
93 if (ret != 0) { 85 if (ret != 0) {
94 dev_err(arizona->dev, "Failed to disable HAPTICS: %d\n", 86 dev_err(arizona->dev, "Failed to disable HAPTICS: %d\n",
95 ret); 87 ret);
96 mutex_unlock(dapm_mutex);
97 return; 88 return;
98 } 89 }
99 90
100 mutex_unlock(dapm_mutex);
101
102 ret = snd_soc_dapm_sync(arizona->dapm); 91 ret = snd_soc_dapm_sync(arizona->dapm);
103 if (ret != 0) { 92 if (ret != 0) {
104 dev_err(arizona->dev, "Failed to sync DAPM: %d\n", 93 dev_err(arizona->dev, "Failed to sync DAPM: %d\n",
@@ -152,16 +141,11 @@ static int arizona_haptics_play(struct input_dev *input, void *data,
152static void arizona_haptics_close(struct input_dev *input) 141static void arizona_haptics_close(struct input_dev *input)
153{ 142{
154 struct arizona_haptics *haptics = input_get_drvdata(input); 143 struct arizona_haptics *haptics = input_get_drvdata(input);
155 struct mutex *dapm_mutex = &haptics->arizona->dapm->card->dapm_mutex;
156 144
157 cancel_work_sync(&haptics->work); 145 cancel_work_sync(&haptics->work);
158 146
159 mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
160
161 if (haptics->arizona->dapm) 147 if (haptics->arizona->dapm)
162 snd_soc_dapm_disable_pin(haptics->arizona->dapm, "HAPTICS"); 148 snd_soc_dapm_disable_pin(haptics->arizona->dapm, "HAPTICS");
163
164 mutex_unlock(dapm_mutex);
165} 149}
166 150
167static int arizona_haptics_probe(struct platform_device *pdev) 151static int arizona_haptics_probe(struct platform_device *pdev)