[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20111003195708.GS3731@opensource.wolfsonmicro.com>
Date: Mon, 3 Oct 2011 20:57:09 +0100
From: Mark Brown <broonie@...nsource.wolfsonmicro.com>
To: Heiko Stübner <heiko@...ech.de>
Cc: Liam Girdwood <lrg@...com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] regulator: Add driver for gpio-controlled regulators
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().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists