public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <lrg@slimlogic.co.uk>
To: Mattias Wallin <mattias.wallin@stericsson.com>
Cc: "broonie@opensource.wolfsonmicro.com" 
	<broonie@opensource.wolfsonmicro.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linus WALLEIJ <linus.walleij@stericsson.com>,
	Bengt JONSSON <bengt.g.jonsson@stericsson.com>
Subject: Re: [PATCH] regulator: lock supply in regulator enable
Date: Sat, 06 Nov 2010 11:54:28 +0000	[thread overview]
Message-ID: <1289044468.3318.14.camel@odin> (raw)
In-Reply-To: <4CD29C7D.4050500@stericsson.com>

On Thu, 2010-11-04 at 12:43 +0100, Mattias Wallin wrote:
> > Sorry, got a busy schedule atm. Can you give us your reasoning behind
> > why you think we need a lock here ?
> Yes, when we enter regulator_enable() we take the lock only for that specific regulator rdev->mutex
> and calls the locked function _regulator_enable().
> This locked function then checks if we have a supply and recursively calls the locked _regulator_enable() again but with the supply rdev as argument.
> The supply rdev regulator is however not locked at this stage, only the "original" supplied regulator is locked.
> So if we have two regulators with the same supply regulator trying to enable at approx. the same time they will both
> enter the _regulator_enable without locks and we could get a race condition.
> This would probably result in reference counting error and unbalanced regulator warnings.
> 
> In our system we make use the regulator hierarchy quite heavily.
> > 

Applied.

Thanks

Liam
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk


  reply	other threads:[~2010-11-06 11:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-04 10:01 [PATCH] regulator: lock supply in regulator enable Mattias Wallin
2010-11-04 10:18 ` Liam Girdwood
2010-11-04 10:49   ` Mattias Wallin
2010-11-04 11:11     ` Liam Girdwood
2010-11-04 11:43       ` Mattias Wallin
2010-11-06 11:54         ` Liam Girdwood [this message]
2010-11-04 14:05 ` Mark Brown

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=1289044468.3318.14.camel@odin \
    --to=lrg@slimlogic.co.uk \
    --cc=bengt.g.jonsson@stericsson.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mattias.wallin@stericsson.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