diff mbox

[4/5] regulator: Use gpio_is_valid

Message ID 1412626635-7404-5-git-send-email-mpa@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Markus Pargmann Oct. 6, 2014, 8:17 p.m. UTC
Use gpio_is_valid instead of custom check.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
 drivers/regulator/fixed.c            | 2 +-
 drivers/regulator/gpio-regulator.c   | 2 +-
 drivers/regulator/wm8994-regulator.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Mark Brown Oct. 7, 2014, 12:01 p.m. UTC | #1
On Mon, Oct 06, 2014 at 10:17:14PM +0200, Markus Pargmann wrote:
> Use gpio_is_valid instead of custom check.

Patches per driver please, this isn't just a mechanical transformation.
Markus Pargmann Oct. 7, 2014, 1:07 p.m. UTC | #2
On Tue, Oct 07, 2014 at 01:01:06PM +0100, Mark Brown wrote:
> On Mon, Oct 06, 2014 at 10:17:14PM +0200, Markus Pargmann wrote:
> > Use gpio_is_valid instead of custom check.
> 
> Patches per driver please, this isn't just a mechanical transformation.

Okay, but you mean just patches 4 and 5 and not patch 2 right?

Thanks,

Markus
Mark Brown Oct. 7, 2014, 4:20 p.m. UTC | #3
On Tue, Oct 07, 2014 at 03:07:37PM +0200, Markus Pargmann wrote:
> On Tue, Oct 07, 2014 at 01:01:06PM +0100, Mark Brown wrote:
> > On Mon, Oct 06, 2014 at 10:17:14PM +0200, Markus Pargmann wrote:
> > > Use gpio_is_valid instead of custom check.

> > Patches per driver please, this isn't just a mechanical transformation.

> Okay, but you mean just patches 4 and 5 and not patch 2 right?

Mostly, that was OK as it was just mechanical.
diff mbox

Patch

diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 731f4315292c..35b00a288667 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -157,7 +157,7 @@  static int reg_fixed_voltage_probe(struct platform_device *pdev)
 
 	drvdata->desc.fixed_uV = config->microvolts;
 
-	if (config->gpio >= 0) {
+	if (gpio_is_valid(config->gpio)) {
 		cfg.ena_gpio = config->gpio;
 		cfg.ena_gpio_valid = true;
 	}
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 681c604d4917..52d50aa9ab4b 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -322,7 +322,7 @@  static int gpio_regulator_probe(struct platform_device *pdev)
 	cfg.driver_data = drvdata;
 	cfg.of_node = np;
 
-	if (config->enable_gpio >= 0) {
+	if (gpio_is_valid(config->enable_gpio)) {
 		cfg.ena_gpio = config->enable_gpio;
 		cfg.ena_gpio_valid = true;
 	}
diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c
index dc7e80ab984e..8f2df50225a9 100644
--- a/drivers/regulator/wm8994-regulator.c
+++ b/drivers/regulator/wm8994-regulator.c
@@ -158,7 +158,7 @@  static int wm8994_ldo_probe(struct platform_device *pdev)
 
 		ldo->init_data = wm8994_ldo_default[id];
 		ldo->init_data.consumer_supplies = &ldo->supply;
-		if (!config.ena_gpio)
+		if (!gpio_is_valid(config.ena_gpio))
 			ldo->init_data.constraints.valid_ops_mask = 0;
 	} else {
 		ldo->init_data = *pdata->ldo[id].init_data;