mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: lgirdwood@gmail.com, dmitry.torokhov@gmail.com,
	myungjoo.ham@samsung.com, cw00.choi@samsung.com,
	alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: dapm: Add locking to snd_soc_dapm_xxxx_pin functions
Date: Mon, 10 Feb 2014 12:08:03 +0000	[thread overview]
Message-ID: <20140210120803.GS1757@sirena.org.uk> (raw)
In-Reply-To: <20140210110536.GB6856@opensource.wolfsonmicro.com>

[-- Attachment #1: Type: text/plain, Size: 1529 bytes --]

On Mon, Feb 10, 2014 at 11:05:36AM +0000, Charles Keepax wrote:
> snd_soc_dapm_disable_pin, snd_soc_dapm_enable_pin and
> snd_soc_dapm_force_enable_pin all require the dapm_mutex to be held when
> they are called as they edit the dirty list. There are 385 usages of
> these functions and only 7 hold the lock whilst calling.
> 
> This patch moves the locking into snd_soc_dapm_set_pin and fixes up the
> places where the lock was held on the caller side. This saves on fixing
> up all the current users and also is much more consistant with the rest
> of the DAPM API which all handles the locking internally.

Unfortunately the fix needs to be in the callers to some extent - there
are situations where you want to do atomic updates of multiple pins so
that we don't end up bouncing the power up and down too much, we need
the unlocked version for things that care.  This means we need to at
least preserve an unlocked version and translate those callers that
might care over to it (not sure if any of them are in mainline).

It should also be safe to call the functions without explicit locking
during init since we won't run DAPM until we've finished init - it is
effectively locked even if we don't actually hold the mutex.  There
shouldn't be a race with marking the widget dirty since every widget
should start out dirty but I'd have to verify that one.  This will
account for a very large proportion of the callers so perhaps it's less
of an issue to add the locking to them than you had thought.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-02-10 12:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-10 11:05 Charles Keepax
2014-02-10 12:08 ` Mark Brown [this message]
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
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=20140210120803.GS1757@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --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 \
    /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

all inboxes | Powered by JetHome®