[...]
+int snd_soc_dapm_enable_pin_locked(struct snd_soc_dapm_context *dapm,
+                                  const char *pin)
+{
+       return snd_soc_dapm_set_pin(dapm, pin, 1);
+}
+EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin_locked);
+
+/**
   * snd_soc_dapm_enable_pin - enable pin.
   * @dapm: DAPM context
   * @pin: pin name
   *
   * Enables input/output pin and its parents or children widgets iff there is
   * a valid audio route and active audio stream.
+ *
   * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to
   * do any widget power switching.
   */
  int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, const char 
*pin)
  {
-       return snd_soc_dapm_set_pin(dapm, pin, 1);
+       int ret;
+
+       mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
+
+       ret = snd_soc_dapm_set_pin(dapm, pin, 1);
+
+       mutex_unlock(&dapm->card->dapm_mutex);
+
+       return ret;
  }

Hm, this is a bit confusing. For other functions in ASoC when we have a pair of functions with the _locked suffix and without the one with _locked takes the lock, the other one doesn't. E.g. snd_soc_update_bits_locked. Here we do it the other way around.

- Lars

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to