Subject: [PATCH] regulator: max8925: fix enabled/disabled judgement mistake

From: [email-masked] (Mark Brown)
Date: Thu, 22 Dec 2011 14:38:03 +0000

On Thu, Dec 22, 2011 at 10:22:17PM +0800, Haojian Zhuang wrote:

> While we enable/disable the LDO in software, we'll force LDO into I2C mode
> and enable/disable the control bit. So there's no risk in the
> enable/disable function.

Oh, dear.  That code really is obscure - it's got a shift called
enable_bit but actually it's mostly working with bitfields not just a
single bit.  Reading the enable() and disable() functions it looks like
they're setting a single bit but that's not the case.

Please send a patch fixing this.

> There's only potential issue of checking whether LDO is enabled. If
> sequence matches
> the power sequence (not I2C mode), LDO will be enabled even the
> control bit is OFF.
> So this patch is necessary.

I'm not saying the patch isn't required, I'm saying it's very hard to
work out what the patch is supposed to do and why it's only an issue in
the is_enabled() function.

Please resend with an improved changelog.