All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] regulator: replace devm_gpio_request_one() for loaded module
@ 2012-06-21  8:03 Kim, Milo
  2012-06-21  9:20 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Kim, Milo @ 2012-06-21  8:03 UTC (permalink / raw)
  To: Mark Brown; +Cc: Girdwood, Liam, linux-kernel, axel.lin, swarren, sfr

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



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

* Re: [PATCH 2/3] regulator: replace devm_gpio_request_one() for loaded module
  2012-06-21  8:03 [PATCH 2/3] regulator: replace devm_gpio_request_one() for loaded module Kim, Milo
@ 2012-06-21  9:20 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-06-21  9:20 UTC (permalink / raw)
  To: Kim, Milo; +Cc: Girdwood, Liam, linux-kernel, axel.lin, swarren, sfr

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

On Thu, Jun 21, 2012 at 08:03:48AM +0000, Kim, Milo wrote:
> 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()

No, this is a step back in terms of the quality of the driver especially
given that nobody is likely to actually use the driver when built as a
module.  We should just wait until the function is exported and then
reenable modular builds.

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

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

end of thread, other threads:[~2012-06-21  9:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-21  8:03 [PATCH 2/3] regulator: replace devm_gpio_request_one() for loaded module Kim, Milo
2012-06-21  9:20 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.