* [PATCH 1/3] regulator: max8649: Use devm_* APIs
@ 2012-04-07 15:28 Axel Lin
2012-04-07 15:29 ` [PATCH 2/3] regulator: tps62360: Convert to devm_regmap_init_i2c() Axel Lin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Axel Lin @ 2012-04-07 15:28 UTC (permalink / raw)
To: linux-kernel; +Cc: Jonghwan Choi, Haojian Zhuang, Mark Brown, Liam Girdwood
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/max8649.c | 19 ++++++-------------
1 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c
index 2e9ffbe..f22e893 100644
--- a/drivers/regulator/max8649.c
+++ b/drivers/regulator/max8649.c
@@ -229,17 +229,18 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
unsigned char data;
int ret;
- info = kzalloc(sizeof(struct max8649_regulator_info), GFP_KERNEL);
+ info = devm_kzalloc(&client->dev, sizeof(struct max8649_regulator_info),
+ GFP_KERNEL);
if (!info) {
dev_err(&client->dev, "No enough memory\n");
return -ENOMEM;
}
- info->regmap = regmap_init_i2c(client, &max8649_regmap_config);
+ info->regmap = devm_regmap_init_i2c(client, &max8649_regmap_config);
if (IS_ERR(info->regmap)) {
ret = PTR_ERR(info->regmap);
dev_err(&client->dev, "Failed to allocate register map: %d\n", ret);
- goto fail;
+ return ret;
}
info->dev = &client->dev;
@@ -267,7 +268,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
if (ret != 0) {
dev_err(info->dev, "Failed to detect ID of MAX8649:%d\n",
ret);
- goto out;
+ return ret;
}
dev_info(info->dev, "Detected MAX8649 (ID:%x)\n", val);
@@ -302,16 +303,10 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
if (IS_ERR(info->regulator)) {
dev_err(info->dev, "failed to register regulator %s\n",
dcdc_desc.name);
- ret = PTR_ERR(info->regulator);
- goto out;
+ return PTR_ERR(info->regulator);
}
return 0;
-out:
- regmap_exit(info->regmap);
-fail:
- kfree(info);
- return ret;
}
static int __devexit max8649_regulator_remove(struct i2c_client *client)
@@ -321,8 +316,6 @@ static int __devexit max8649_regulator_remove(struct i2c_client *client)
if (info) {
if (info->regulator)
regulator_unregister(info->regulator);
- regmap_exit(info->regmap);
- kfree(info);
}
return 0;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] regulator: tps62360: Convert to devm_regmap_init_i2c()
2012-04-07 15:28 [PATCH 1/3] regulator: max8649: Use devm_* APIs Axel Lin
@ 2012-04-07 15:29 ` Axel Lin
2012-04-07 15:31 ` [PATCH 3/3] regulator: tps65023: Use devm_* APIs Axel Lin
2012-04-10 10:05 ` [PATCH 1/3] regulator: max8649: " Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Axel Lin @ 2012-04-07 15:29 UTC (permalink / raw)
To: linux-kernel; +Cc: Laxman Dewangan, Liam Girdwood, Mark Brown
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/tps62360-regulator.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/tps62360-regulator.c b/drivers/regulator/tps62360-regulator.c
index aa57632..e55219b 100644
--- a/drivers/regulator/tps62360-regulator.c
+++ b/drivers/regulator/tps62360-regulator.c
@@ -319,7 +319,7 @@ static int __devinit tps62360_probe(struct i2c_client *client,
tps->desc.ops = &tps62360_dcdc_ops;
tps->desc.type = REGULATOR_VOLTAGE;
tps->desc.owner = THIS_MODULE;
- tps->regmap = regmap_init_i2c(client, &tps62360_regmap_config);
+ tps->regmap = devm_regmap_init_i2c(client, &tps62360_regmap_config);
if (IS_ERR(tps->regmap)) {
ret = PTR_ERR(tps->regmap);
dev_err(&client->dev, "%s() Err: Failed to allocate register"
@@ -404,7 +404,6 @@ err_gpio1:
if (gpio_is_valid(tps->vsel0_gpio))
gpio_free(tps->vsel0_gpio);
err_gpio0:
- regmap_exit(tps->regmap);
return ret;
}
@@ -425,7 +424,6 @@ static int __devexit tps62360_remove(struct i2c_client *client)
gpio_free(tps->vsel0_gpio);
regulator_unregister(tps->rdev);
- regmap_exit(tps->regmap);
return 0;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] regulator: tps65023: Use devm_* APIs
2012-04-07 15:28 [PATCH 1/3] regulator: max8649: Use devm_* APIs Axel Lin
2012-04-07 15:29 ` [PATCH 2/3] regulator: tps62360: Convert to devm_regmap_init_i2c() Axel Lin
@ 2012-04-07 15:31 ` Axel Lin
2012-04-10 10:05 ` [PATCH 1/3] regulator: max8649: " Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Axel Lin @ 2012-04-07 15:31 UTC (permalink / raw)
To: linux-kernel; +Cc: Anuj Aggarwal, Mark Brown, Liam Girdwood
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/tps65023-regulator.c | 14 +++-----------
1 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c
index 5c9a900..694386f 100644
--- a/drivers/regulator/tps65023-regulator.c
+++ b/drivers/regulator/tps65023-regulator.c
@@ -393,16 +393,16 @@ static int __devinit tps_65023_probe(struct i2c_client *client,
if (!init_data)
return -EIO;
- tps = kzalloc(sizeof(*tps), GFP_KERNEL);
+ tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
if (!tps)
return -ENOMEM;
- tps->regmap = regmap_init_i2c(client, &tps65023_regmap_config);
+ tps->regmap = devm_regmap_init_i2c(client, &tps65023_regmap_config);
if (IS_ERR(tps->regmap)) {
error = PTR_ERR(tps->regmap);
dev_err(&client->dev, "Failed to allocate register map: %d\n",
error);
- goto fail_alloc;
+ return error;
}
/* common for all regulators */
@@ -445,10 +445,6 @@ static int __devinit tps_65023_probe(struct i2c_client *client,
fail:
while (--i >= 0)
regulator_unregister(tps->rdev[i]);
-
- regmap_exit(tps->regmap);
- fail_alloc:
- kfree(tps);
return error;
}
@@ -459,10 +455,6 @@ static int __devexit tps_65023_remove(struct i2c_client *client)
for (i = 0; i < TPS65023_NUM_REGULATOR; i++)
regulator_unregister(tps->rdev[i]);
-
- regmap_exit(tps->regmap);
- kfree(tps);
-
return 0;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] regulator: max8649: Use devm_* APIs
2012-04-07 15:28 [PATCH 1/3] regulator: max8649: Use devm_* APIs Axel Lin
2012-04-07 15:29 ` [PATCH 2/3] regulator: tps62360: Convert to devm_regmap_init_i2c() Axel Lin
2012-04-07 15:31 ` [PATCH 3/3] regulator: tps65023: Use devm_* APIs Axel Lin
@ 2012-04-10 10:05 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-04-10 10:05 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Jonghwan Choi, Haojian Zhuang, Liam Girdwood
[-- Attachment #1: Type: text/plain, Size: 127 bytes --]
On Sat, Apr 07, 2012 at 11:28:28PM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
Applied all, thanks.
[-- 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-04-10 10:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-07 15:28 [PATCH 1/3] regulator: max8649: Use devm_* APIs Axel Lin
2012-04-07 15:29 ` [PATCH 2/3] regulator: tps62360: Convert to devm_regmap_init_i2c() Axel Lin
2012-04-07 15:31 ` [PATCH 3/3] regulator: tps65023: Use devm_* APIs Axel Lin
2012-04-10 10:05 ` [PATCH 1/3] regulator: max8649: " Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox