lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 21 Jun 2012 08:03:48 +0000
From:	"Kim, Milo" <Milo.Kim@...com>
To:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
CC:	"Girdwood, Liam" <lrg@...com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"axel.lin@...il.com" <axel.lin@...il.com>,
	"swarren@...dotorg.org" <swarren@...dotorg.org>,
	"sfr@...b.auug.org.au" <sfr@...b.auug.org.au>
Subject: [PATCH 2/3] regulator: replace devm_gpio_request_one() for loaded
 module

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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ