lkml.org 
[lkml]   [2014]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 02/15] ASoC: dapm: Add locked version of snd_soc_dapm_xxxx_pin functions
[...]
> +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



\
 
 \ /
  Last update: 2014-02-17 18:41    [W:0.164 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site