From: pHilipp Zabel <philipp.zabel@gmail.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Roger Quadros <quadros.roger@gmail.com>,
lrg@slimlogic.co.uk, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regulator: Add GPIO enable control to fixed voltage regulator driver
Date: Fri, 31 Jul 2009 15:25:36 +0200 [thread overview]
Message-ID: <74d0deb30907310625u128ea22cu6fecca53c4a23d40@mail.gmail.com> (raw)
In-Reply-To: <20090731131005.GE17091@sirena.org.uk>
On Fri, Jul 31, 2009 at 3:10 PM, Mark
Brown<broonie@opensource.wolfsonmicro.com> wrote:
> On Fri, Jul 31, 2009 at 03:55:18PM +0300, Roger Quadros wrote:
>
> Looks good, some relatively nitpicky issues:
>
>> + int use_gpio_control;
>
> This isn't needed, just use an invalid GPIO value (zero or less).
Negative only, actually. Zero itself is a valid GPIO number (which is
a bit unfortunate because if you forget to initialize .gpio, it will
default to GPIO #0).
If you drop .use_gpio_control, use gpio_is_valid(data->gpio) for this check:
>> + if (data->use_gpio_control) {
>> + gpio_set_value(data->gpio,
>> + data->enable_high ? 1 : 0);
>
> Nicer to use the _cansleep() variants in case the GPIO is one on an
> I2C/SPI device of some kind. The regulator API doesn't mind if drivers
> sleep so long as they don't do so excessively and it's not normally
> sufficiently performance critical to make the inlining worth it.
>
>> + if (ret) {
>> + dev_err(&pdev->dev, "Could not obtain regulator " \
>> + "enable GPIO %d\n", config->gpio);
>
> Please do something like:
>
> dev_err(&pdev->dev,
> "Could not obtain enable GPIO %d: %d\n",
> config->gpio, ret);
>
> so that the error message is all in one in the source (so it's easier to
> find when grepping the kernel log. You also don't need the \.
>
>> + goto err_name;
>> + } else {
>
> No need for the else clause; you've got the goto above.
>
>> + ret = gpio_direction_output(config->gpio,
>> + config->enable_high ? 0 : 1);
>> + if (ret) {
>> + dev_err(&pdev->dev, "Could not configure " \
>> + "enable GPIO %d direction\n",
>> + config->gpio);
>> + gpio_free(config->gpio);
>> + goto err_name;
>> + }
>
> Same comment as above with regard to the error message. It would be
> nice to have the default state passed in as platform data if you can't
> read it back to help avoid bouncing supplies at startup. IIRC
> gpio_get_value() will generally take a good stab at giving the current
> state no matter if the GPIO is input our output but I'd need to check.
I think this is not clearly defined in the GPIO API document, so it
could be architecture dependent.
>> + int use_gpio_control; /* Use GPIO enable control */
>> + int gpio; /* GPIO to use for enable control */
>> +
>> + int enable_high; /* Polarity of enable GPIO
>> + * 1 = Active High, 0 = Active Low
>
> If you mark the comments with /** they'll get picked up by kerneldoc.
Maybe following the style in Documentation/kernel-doc-nano-HOWTO.txt
would be worthwhile, then.
regards
Philipp
next prev parent reply other threads:[~2009-07-31 13:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-31 12:55 Roger Quadros
2009-07-31 13:10 ` Mark Brown
2009-07-31 13:25 ` pHilipp Zabel [this message]
2009-07-31 13:34 ` Mark Brown
2009-07-31 13:43 ` Roger Quadros
2009-07-31 13:50 ` Mark Brown
[not found] ` <b90c0690907310713w5c8b7fe3l4253f03f78f06491@mail.gmail.com>
[not found] ` <20090731141547.GA6505@rakim.wolfsonmicro.main>
2009-07-31 14:22 ` Roger Quadros
2009-07-31 14:34 ` Roger Quadros
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=74d0deb30907310625u128ea22cu6fecca53c4a23d40@mail.gmail.com \
--to=philipp.zabel@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
--cc=quadros.roger@gmail.com \
/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
all inboxes | Powered by JetHome®