public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: "Heiko Stübner" <heiko@sntech.de>
Cc: Liam Girdwood <lrg@ti.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regulator: Add driver for gpio-controlled regulators
Date: Mon, 3 Oct 2011 20:57:09 +0100	[thread overview]
Message-ID: <20111003195708.GS3731@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <201110032111.57958.heiko@sntech.de>

On Mon, Oct 03, 2011 at 09:11:57PM +0200, Heiko Stübner wrote:
> This patch adds support for regulators that can be controlled via gpios.

> Examples for such regulators are the TI-tps65024x voltage regulators
> with 4 fixed and 1 runtime-switchable voltage regulators
> or the TI-bq240XX charger regulators.

What's the difference between this and the patch you posted on Friday?

> +	drvdata->gpios = kmalloc(config->nr_gpios * sizeof(int), GFP_KERNEL);

calloc.

> +		/* set output direction without changing state
> +		 * to prevent glitch
> +		 */
> +		drvdata->is_enabled = config->enabled_at_boot;
> +		ret = drvdata->is_enabled ?
> +				config->enable_high : !config->enable_high;

I'm fairly sure this could be written more cleanly.

> +	drvdata->nr_gpios = config->nr_gpios;
> +	for (ptr = 0; ptr < drvdata->nr_gpios; ptr++) {
> +		ret = gpio_request(config->gpios[ptr], config->supply_name);
> +		if (ret) {
> +			dev_err(&pdev->dev,
> +			   "Could not obtain regulator setting GPIO %d: %d\n",
> +						config->gpios[ptr], ret);
> +			goto err_stategpio;
> +		}

This might be easier written using gpio_request_array().

      reply	other threads:[~2011-10-03 19:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-03 19:11 [PATCH] regulator: Add driver for gpio-controlled regulators Heiko Stübner
2011-10-03 19:57 ` Mark Brown [this message]

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=20111003195708.GS3731@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=heiko@sntech.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.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