[PATCH] support PMIC mc13892

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Tue Dec 7 03:02:39 EST 2010


Hello Yong,

On Tue, Dec 07, 2010 at 03:57:12PM +0800, Yong Shen wrote:
> 2010/12/6 Uwe Kleine-König <u.kleine-koenig at pengutronix.de>:
> >> +     if ((val & 0x0000FFFF) == 0x45d0) {
> >> +             mc13xxx_lock(mc13892);
> >> +             ret = mc13xxx_reg_rmw(mc13892, MC13892_SWITCHERS4,
> >> +                     MC13892_SWITCHERS4_SW1MODE_M |
> >> +                     MC13892_SWITCHERS4_SW2MODE_M,
> >> +                     MC13892_SWITCHERS4_SW1MODE_AUTO |
> >> +                     MC13892_SWITCHERS4_SW2MODE_AUTO);
> >> +             mc13xxx_unlock(mc13892);
> > It should be possible to hold the lock for longer that a single mc13xxx
> > API call.  Your error handler just needs to unlock for that.
> I found this can not work, since regulator_register in probe function
> will in turn call regulator ops->enable or alike, which require
> mc13xxx_lock again. So we do not use long lock here.
You probably cannot only take the lock once per function, but here for
these two mc13xxx_reg_rmw it should be possible.

> >> [...]
> >> +
> >> +static struct platform_driver mc13892_regulator_driver = {
> >> +     .driver = {
> >> +             .name   = "mc13892-regulator",
> >> +             .owner  = THIS_MODULE,
> >> +     },
> >> +     .remove         = __devexit_p(mc13892_regulator_remove),
> >> +     .probe          = mc13892_regulator_probe,
> > If you ask me just use a single space before =, but there is no common
> > style visible in the kernel, so do as you prefer.
> > (The advantage of using a single space is that if later
> > .averylongmembername needs to be initialized you either have to fix
> > lines that are technically unrelated or the indention isn't uniform.)
BTW, using tabs you get a mixture, too.  Then some =s are aligned, some
don't.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |



More information about the linux-arm-kernel mailing list