Re: [PATCH v3] regulator: Add GPIO enable control to fixed voltage regulator driver

From: Roger Quadros
Date: Mon Aug 03 2009 - 05:16:05 EST


On Sun, Aug 2, 2009 at 8:49 PM, pHilipp Zabel<philipp.zabel@xxxxxxxxx> wrote:
> On Sun, Aug 2, 2009 at 6:56 PM, Roger Quadros<quadros.roger@xxxxxxxxx> wrote:
>> From: Roger Quadros <ext-roger.quadros@xxxxxxxxx>
>>
>> +
>> +               /* set output direction without changing state
>> +                * to prevent glitch
>> +                */
>> +               drvdata->is_enabled = config->enabled_at_boot;
>> +               if (!config->enable_high)
>> +                       drvdata->is_enabled = !drvdata->is_enabled;
>
> Assume .enabled_at_boot = 1, .enable_high = 0. In this case we end up
> with .is_enabled = 0, which does not represent the real state after
> the following call:
>
>> +               ret = gpio_direction_output(config->gpio, drvdata->is_enabled);
>
> Maybe use a local variable here or (drvdata->is_enabled ?
> config->enable_high : !config->enable_high).
>
> regards
> Philipp
>

Yes you are right.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/