From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: broonie@kernel.org, alsa-devel@alsa-project.org,
patches@opensource.wolfsonmicro.com, dmitry.torokhov@gmail.com,
lgirdwood@gmail.com, linux-kernel@vger.kernel.org,
cw00.choi@samsung.com, myungjoo.ham@samsung.com
Subject: Re: [alsa-devel] [PATCH] ASoC: dapm: Add locking to snd_soc_dapm_xxxx_pin functions
Date: Wed, 12 Feb 2014 11:26:40 +0000 [thread overview]
Message-ID: <20140212112640.GE16684@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <s5h7g936ru1.wl%tiwai@suse.de>
On Mon, Feb 10, 2014 at 02:05:26PM +0100, Takashi Iwai wrote:
> At Mon, 10 Feb 2014 11:05:36 +0000,
> Charles Keepax wrote:
> >
<snip>
> >
> Actually, this fixes also the double-lock in snd_soc_dapm_sync() call
> in the line below the above. snd_soc_dapm_sync() itself takes
> mutex_lock_nested().
Yeah spotted that as I was going through will do this in a
seperate patch if this one doesn't go in.
<snip>
> > static int arizona_haptics_probe(struct platform_device *pdev)
> > diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> > index dc8ff13..a44b560 100644
> > --- a/sound/soc/soc-dapm.c
> > +++ b/sound/soc/soc-dapm.c
> > @@ -2325,6 +2325,8 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
> > {
> > struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true);
> >
> > + mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
> > +
> > if (!w) {
> > dev_err(dapm->dev, "ASoC: DAPM unknown pin %s\n", pin);
> > return -EINVAL;
>
> Missing unlock here.
Good spot thanks, I will update for this.
>
>
> > @@ -2337,6 +2339,8 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
> > if (status == 0)
> > w->force = 0;
> >
> > + mutex_unlock(&dapm->card->dapm_mutex);
> > +
> > return 0;
> > }
> >
> > @@ -3210,15 +3214,11 @@ int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
> > struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
> > const char *pin = (const char *)kcontrol->private_value;
> >
> > - mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
> > -
> > if (ucontrol->value.integer.value[0])
> > snd_soc_dapm_enable_pin(&card->dapm, pin);
> > else
> > snd_soc_dapm_disable_pin(&card->dapm, pin);
> >
> > - mutex_unlock(&card->dapm_mutex);
> > -
> > snd_soc_dapm_sync(&card->dapm);
> > return 0;
> > }
>
> I guess you forgot patching snd_soc_dapm_force_enable_pin()?
> It's now left unprotected after this patch.
Also a good point, thanks I will update.
>
>
> Takashi
Thanks,
Charles
next prev parent reply other threads:[~2014-02-12 11:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-10 11:05 [PATCH] ASoC: dapm: Add locking to snd_soc_dapm_xxxx_pin functions Charles Keepax
2014-02-10 12:08 ` Mark Brown
2014-02-12 11:24 ` Charles Keepax
2014-02-12 15:44 ` Mark Brown
2014-02-10 13:05 ` [alsa-devel] " Takashi Iwai
2014-02-12 11:26 ` Charles Keepax [this message]
2014-02-12 11:31 ` Takashi Iwai
2014-02-10 13:47 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140212112640.GE16684@opensource.wolfsonmicro.com \
--to=ckeepax@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=cw00.choi@samsung.com \
--cc=dmitry.torokhov@gmail.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=patches@opensource.wolfsonmicro.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).