[PATCH] ARM amba: optional PrimeCell core voltage switch

Linus Walleij linus.walleij at stericsson.com
Wed Nov 3 10:14:47 EDT 2010


Sundar wrote:
> On Wed, Nov 3, 2010 at 3:39 PM, Linus Walleij
> <linus.walleij at stericsson.com> wrote:
>> +static int amba_get_enable_vcore(struct amba_device *pcdev)
>> +{
>> +       struct regulator *vcore = regulator_get(&pcdev->dev, "vcore");
>> +       int ret;
>> +
>> +       pcdev->vcore = vcore;
>> +
>> +       if (IS_ERR(vcore)) {
>> +               /* It is OK not to supply a vcore regulator */
>> +               if (PTR_ERR(vcore) == -ENODEV)
>> +                       return 0;
>> +               return PTR_ERR(vcore);
>> +       }
> 
> If i am right, you corrupt the pcdev->vcore even in an error case.

Yeah that's the intention. It's modeled on the clock code that
does the same thing, then in the disable_put function and
helper macros in bus.h we account for the error case.

I would have set it to NULL instead, but I wanted it to be as
close to the clock code as possible.

Thanks!
Linus Walleij



More information about the linux-arm-kernel mailing list