devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: fixed: use devm_* for gpio request
@ 2012-07-02 10:07 Laxman Dewangan
  2012-07-02 10:07 ` [PATCH 2/2] regulator: fixed: dt: support for input supply Laxman Dewangan
  2012-07-02 17:29 ` [PATCH 1/2] regulator: fixed: use devm_* for gpio request Mark Brown
  0 siblings, 2 replies; 9+ messages in thread
From: Laxman Dewangan @ 2012-07-02 10:07 UTC (permalink / raw)
  To: lrg, broonie, grant.likely, rob.herring, rob, devicetree-discuss
  Cc: linux-kernel, Laxman Dewangan

Use devm_* version of gpio APIs gpio_request_one() for
requesting gpios.
This avoid extra code for freeing gpios.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
 drivers/regulator/fixed.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 8bda365..0a0baf3 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -235,7 +235,7 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
 		if (config->gpio_is_open_drain)
 			gpio_flag |= GPIOF_OPEN_DRAIN;
 
-		ret = gpio_request_one(config->gpio, gpio_flag,
+		ret = devm_gpio_request_one(&pdev->dev, config->gpio, gpio_flag,
 						config->supply_name);
 		if (ret) {
 			dev_err(&pdev->dev,
@@ -259,7 +259,7 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
 	if (IS_ERR(drvdata->dev)) {
 		ret = PTR_ERR(drvdata->dev);
 		dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret);
-		goto err_gpio;
+		goto err_name;
 	}
 
 	platform_set_drvdata(pdev, drvdata);
@@ -269,9 +269,6 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
 
 	return 0;
 
-err_gpio:
-	if (gpio_is_valid(config->gpio))
-		gpio_free(config->gpio);
 err_name:
 	kfree(drvdata->desc.name);
 err:
@@ -283,8 +280,6 @@ static int __devexit reg_fixed_voltage_remove(struct platform_device *pdev)
 	struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
 
 	regulator_unregister(drvdata->dev);
-	if (gpio_is_valid(drvdata->gpio))
-		gpio_free(drvdata->gpio);
 	kfree(drvdata->desc.name);
 
 	return 0;
-- 
1.7.1.1

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

end of thread, other threads:[~2012-07-04 10:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-02 10:07 [PATCH 1/2] regulator: fixed: use devm_* for gpio request Laxman Dewangan
2012-07-02 10:07 ` [PATCH 2/2] regulator: fixed: dt: support for input supply Laxman Dewangan
2012-07-03 19:17   ` Mark Brown
2012-07-04  7:02     ` Laxman Dewangan
2012-07-04 10:21       ` Mark Brown
2012-07-04 10:42         ` Laxman Dewangan
     [not found]           ` <4FF41E2D.30104-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-07-04 10:58             ` Mark Brown
2012-07-02 17:29 ` [PATCH 1/2] regulator: fixed: use devm_* for gpio request Mark Brown
2012-07-03  8:48   ` Laxman Dewangan

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).