From: Mattias Wallin <mattias.wallin@stericsson.com>
To: Liam Girdwood <lrg@slimlogic.co.uk>
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: Thu, 4 Nov 2010 12:43:57 +0100 [thread overview]
Message-ID: <4CD29C7D.4050500@stericsson.com> (raw)
In-Reply-To: <1288869112.3277.25.camel@odin>
> 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.
>
> Thanks
>
> Liam
/Mattias Wallin
next prev parent reply other threads:[~2010-11-04 11:44 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 [this message]
2010-11-06 11:54 ` Liam Girdwood
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=4CD29C7D.4050500@stericsson.com \
--to=mattias.wallin@stericsson.com \
--cc=bengt.g.jonsson@stericsson.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linus.walleij@stericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
/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