lkml.org 
[lkml]   [2012]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] regulator: replace devm_gpio_request_one() for loaded module
Date
At this moment, devm_gpio_request_one() has not been exported yet.
But lp872x driver can be used as a module, so related functions should be changed.

devm_gpio_request_one() -> gpio_request_one() and gpio_free()

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
---
drivers/regulator/lp872x.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
index e8f54ef..daaa0ed 100644
--- a/drivers/regulator/lp872x.c
+++ b/drivers/regulator/lp872x.c
@@ -768,7 +768,7 @@ static int lp872x_init_dvs(struct lp872x *lp)
}

pinstate = dvs->init_state;
- ret = devm_gpio_request_one(lp->dev, gpio, pinstate, "LP872X DVS");
+ ret = gpio_request_one(gpio, pinstate, "LP872X DVS");
if (ret) {
dev_err(lp->dev, "gpio request err: %d\n", ret);
return ret;
@@ -780,6 +780,12 @@ static int lp872x_init_dvs(struct lp872x *lp)
return 0;
}

+static void lp872x_deinit_dvs(struct lp872x *lp)
+{
+ if (lp->dvs_gpio)
+ gpio_free(lp->dvs_gpio);
+}
+
static int lp872x_config(struct lp872x *lp)
{
struct lp872x_platform_data *pdata = lp->pdata;
@@ -917,10 +923,16 @@ static int lp872x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
if (ret)
goto err_dev;

- return lp872x_regulator_register(lp);
+ ret = lp872x_regulator_register(lp);
+ if (ret)
+ goto err_reg;
+
+ return 0;

err_mem:
return -ENOMEM;
+err_reg:
+ lp872x_deinit_dvs(lp);
err_dev:
return ret;
}
@@ -930,6 +942,7 @@ static int __devexit lp872x_remove(struct i2c_client *cl)
struct lp872x *lp = i2c_get_clientdata(cl);

lp872x_regulator_unregister(lp);
+ lp872x_deinit_dvs(lp);
return 0;
}

--
1.7.2.5

Best Regards,
Milo (Woogyom) Kim




\
 
 \ /
  Last update: 2012-06-21 10:41    [W:0.043 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site