public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Roger Quadros <quadros.roger@gmail.com>
Cc: philipp.zabel@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] regulator: Add GPIO enable control to fixed voltage regulator driver
Date: Fri, 31 Jul 2009 18:20:02 +0100	[thread overview]
Message-ID: <20090731172002.GA32578@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <1249057189-11992-1-git-send-email-quadros.roger@gmail.com>

On Fri, Jul 31, 2009 at 07:19:49PM +0300, Roger Quadros wrote:

> Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com>
> Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Err...  no, it isn't.  I reviewed a previous version of the patch but
there were some issues that needed fixing.  I've not reviewed this
version.

>  static int fixed_voltage_is_enabled(struct regulator_dev *dev)
>  {
> -	return 1;
> +	struct fixed_voltage_data *data = rdev_get_drvdata(dev);
> +
> +	if (data->gpio)
> +		return data->is_enabled;

Please use gpio_is_valid() as Phillip previously suggested.  For this
particular use you could simplify the code marginally by just setting
is_enabled at probe() time if there's no GPIO, not that it really
matters.

> +       if (data->gpio) {
> +               gpio_set_value(data->gpio,
> +                               data->enable_high ? 1 : 0);

_cansleep(), please, as previously requested.
 
> +		ret = gpio_get_value(config->gpio);

Can this fail?  It returns an int...

> +		ret = gpio_direction_output(config->gpio, ret);
> +		if (ret) {
> +			dev_err(&pdev->dev, "Could not configure "
> +				"enable GPIO %d direction: %d\n",
> +						config->gpio, ret);
> +			goto err_gpio;

As previously requested please don't split for log messages text over
lines unless you have to.  It makes it easier to find the message from a
kernel log - grep for 'configure enable GPIO' won't match this source
file the way you've written it above.

> +		}
> +	} else
> +		dev_warn(&pdev->dev, "Not using GPIO 0 for enable control\n");

Probably better to soldier on and use the GPIO here but either way is
fine; the warning is for the benefit of existing out of tree users to
help them transition gracefully.

  parent reply	other threads:[~2009-07-31 17:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-31 16:19 [PATCH v2] regulator: Add GPIO enable control to fixed voltage regulator driver Roger Quadros
2009-07-31 17:01 ` Felipe Balbi
2009-07-31 17:03 ` pHilipp Zabel
2009-07-31 17:20 ` Mark Brown [this message]
2009-07-31 17:38   ` pHilipp Zabel
2009-07-31 20:32     ` Roger Quadros
2009-07-31 21:44       ` Mark Brown
2009-08-01  5:57         ` Roger Quadros
2009-08-01  9:48           ` Mark Brown

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=20090731172002.GA32578@rakim.wolfsonmicro.main \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philipp.zabel@gmail.com \
    --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