From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Axel Lin <axel.lin@gmail.com>,
linux-kernel@vger.kernel.org, Yong Shen <yong.shen@linaro.org>,
Samuel Ortiz <sameo@linux.intel.com>,
Liam Girdwood <lrg@slimlogic.co.uk>
Subject: Re: [RFC][PATCH] mfd: mc13xxx-core: put mutex lock down to mc13xxx_reg_rmw function
Date: Tue, 3 May 2011 22:41:55 +0100 [thread overview]
Message-ID: <20110503214155.GB7453@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20110503191525.GE11574@pengutronix.de>
On Tue, May 03, 2011 at 09:15:25PM +0200, Uwe Kleine-König wrote:
> On Wed, May 04, 2011 at 12:27:59AM +0800, Axel Lin wrote:
> > + ret = mc13xxx_reg_rmw(priv->mc13xxx, mc13892_regulators[id].vsel_reg,
> > + mask, value << mc13892_regulators[id].vsel_shift);
> I havn't looked deeply, but I guess this can have unwanted side effects
> here. Before you had:
> lock()
> do(something)
> do(something, else, that, needs, rmw)
> unlock()
> and you introduced an unlock()/lock() between these two do()s.
Glancing at the code I wasn't 100% convinced that the original read was
really needed, though I didn't look closely.
> I'm not convinced this change is good, though I agree that
> lock()
> rmw(...)
> unlock()
> looks ugly, but imho this can better be fixed by adding a wrapper for
> that sequence if you really want.
You could also make the rmw store the value somewhere if it's important.
Having to open code the locks everywhere is certainly annoying and error
prone.
next prev parent reply other threads:[~2011-05-03 21:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-03 16:27 [RFC][PATCH] mfd: mc13xxx-core: put mutex lock down to mc13xxx_reg_rmw function Axel Lin
2011-05-03 19:15 ` Uwe Kleine-König
2011-05-03 21:41 ` Mark Brown [this message]
2011-05-05 15:26 ` Axel Lin
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=20110503214155.GB7453@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=axel.lin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
--cc=sameo@linux.intel.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=yong.shen@linaro.org \
/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