linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: tps62360: Convert to devm_gpio_request_one
@ 2012-07-07  0:28 Axel Lin
  2012-07-08  9:13 ` Laxman Dewangan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Axel Lin @ 2012-07-07  0:28 UTC (permalink / raw)
  To: Mark Brown; +Cc: Laxman Dewangan, Liam Girdwood, linux-kernel

Use devm_gpio_request_one to save a few error handling code.
Also remove trivial comment for tps62360_remove.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/tps62360-regulator.c |   38 +++++++-------------------------
 1 file changed, 8 insertions(+), 30 deletions(-)

diff --git a/drivers/regulator/tps62360-regulator.c b/drivers/regulator/tps62360-regulator.c
index 103bb62..062a9cf 100644
--- a/drivers/regulator/tps62360-regulator.c
+++ b/drivers/regulator/tps62360-regulator.c
@@ -428,24 +428,24 @@ static int __devinit tps62360_probe(struct i2c_client *client,
 		int gpio_flags;
 		gpio_flags = (pdata->vsel0_def_state) ?
 				GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
-		ret = gpio_request_one(tps->vsel0_gpio,
-				gpio_flags, "tps62360-vsel0");
+		ret = devm_gpio_request_one(&client->dev, tps->vsel0_gpio,
+					    gpio_flags, "tps62360-vsel0");
 		if (ret) {
 			dev_err(&client->dev,
 				"%s(): Could not obtain vsel0 GPIO %d: %d\n",
 				__func__, tps->vsel0_gpio, ret);
-			goto err_gpio0;
+			return ret;
 		}
 
 		gpio_flags = (pdata->vsel1_def_state) ?
 				GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
-		ret = gpio_request_one(tps->vsel1_gpio,
-				gpio_flags, "tps62360-vsel1");
+		ret = devm_gpio_request_one(&client->dev, tps->vsel1_gpio,
+					    gpio_flags, "tps62360-vsel1");
 		if (ret) {
 			dev_err(&client->dev,
 				"%s(): Could not obtain vsel1 GPIO %d: %d\n",
 				__func__, tps->vsel1_gpio, ret);
-			goto err_gpio1;
+			return ret;
 		}
 		tps->valid_gpios = true;
 
@@ -463,7 +463,7 @@ static int __devinit tps62360_probe(struct i2c_client *client,
 	if (ret < 0) {
 		dev_err(tps->dev, "%s(): Init failed with err = %d\n",
 				__func__, ret);
-		goto err_init;
+		return ret;
 	}
 
 	config.dev = &client->dev;
@@ -477,39 +477,17 @@ static int __devinit tps62360_probe(struct i2c_client *client,
 		dev_err(tps->dev,
 			"%s(): regulator register failed with err %s\n",
 			__func__, id->name);
-		ret = PTR_ERR(rdev);
-		goto err_init;
+		return PTR_ERR(rdev);
 	}
 
 	tps->rdev = rdev;
 	return 0;
-
-err_init:
-	if (gpio_is_valid(tps->vsel1_gpio))
-		gpio_free(tps->vsel1_gpio);
-err_gpio1:
-	if (gpio_is_valid(tps->vsel0_gpio))
-		gpio_free(tps->vsel0_gpio);
-err_gpio0:
-	return ret;
 }
 
-/**
- * tps62360_remove - tps62360 driver i2c remove handler
- * @client: i2c driver client device structure
- *
- * Unregister TPS driver as an i2c client device driver
- */
 static int __devexit tps62360_remove(struct i2c_client *client)
 {
 	struct tps62360_chip *tps = i2c_get_clientdata(client);
 
-	if (gpio_is_valid(tps->vsel1_gpio))
-		gpio_free(tps->vsel1_gpio);
-
-	if (gpio_is_valid(tps->vsel0_gpio))
-		gpio_free(tps->vsel0_gpio);
-
 	regulator_unregister(tps->rdev);
 	return 0;
 }
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] regulator: tps62360: Convert to devm_gpio_request_one
  2012-07-07  0:28 [PATCH] regulator: tps62360: Convert to devm_gpio_request_one Axel Lin
@ 2012-07-08  9:13 ` Laxman Dewangan
  2012-07-09 18:37 ` Mark Brown
  2012-07-15 20:52 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Laxman Dewangan @ 2012-07-08  9:13 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, Liam Girdwood, linux-kernel

On Saturday 07 July 2012 05:58 AM, Axel Lin wrote:
> Use devm_gpio_request_one to save a few error handling code.
> Also remove trivial comment for tps62360_remove.
>
> Signed-off-by: Axel Lin<axel.lin@gmail.com>
> ---

Acked-by: Laxman Dewangan <ldewangan@nvidia.com>

This same as earlier patch.
[PATCH] regulator: tps62360: use devm_* for gpio request

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] regulator: tps62360: Convert to devm_gpio_request_one
  2012-07-07  0:28 [PATCH] regulator: tps62360: Convert to devm_gpio_request_one Axel Lin
  2012-07-08  9:13 ` Laxman Dewangan
@ 2012-07-09 18:37 ` Mark Brown
  2012-07-15 20:52 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-07-09 18:37 UTC (permalink / raw)
  To: Axel Lin; +Cc: Laxman Dewangan, Liam Girdwood, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

On Sat, Jul 07, 2012 at 08:28:33AM +0800, Axel Lin wrote:
> Use devm_gpio_request_one to save a few error handling code.
> Also remove trivial comment for tps62360_remove.

I can't apply any of these patches until devm_gpio_request_one() is
exported in mainline.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] regulator: tps62360: Convert to devm_gpio_request_one
  2012-07-07  0:28 [PATCH] regulator: tps62360: Convert to devm_gpio_request_one Axel Lin
  2012-07-08  9:13 ` Laxman Dewangan
  2012-07-09 18:37 ` Mark Brown
@ 2012-07-15 20:52 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-07-15 20:52 UTC (permalink / raw)
  To: Axel Lin; +Cc: Laxman Dewangan, Liam Girdwood, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

On Sat, Jul 07, 2012 at 08:28:33AM +0800, Axel Lin wrote:
> Use devm_gpio_request_one to save a few error handling code.
> Also remove trivial comment for tps62360_remove.

I applied Laxman's earlier version of this.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-15 20:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-07  0:28 [PATCH] regulator: tps62360: Convert to devm_gpio_request_one Axel Lin
2012-07-08  9:13 ` Laxman Dewangan
2012-07-09 18:37 ` Mark Brown
2012-07-15 20:52 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).