* [PATCH] regulator: max8952: Convert to devm_gpio_request_one()
@ 2014-06-16 2:12 Axel Lin
2014-06-27 11:51 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2014-06-16 2:12 UTC (permalink / raw)
To: Mark Brown; +Cc: Krzysztof Kozlowski, MyungJoo Ham, Liam Girdwood, linux-kernel
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/max8952.c | 34 ++++++++++------------------------
1 file changed, 10 insertions(+), 24 deletions(-)
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index c2792f0..f7f9efc 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -229,7 +229,6 @@ static int max8952_pmic_probe(struct i2c_client *client,
config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;
rdev = devm_regulator_register(&client->dev, ®ulator, &config);
-
if (IS_ERR(rdev)) {
ret = PTR_ERR(rdev);
dev_err(&client->dev, "regulator init failed (%d)\n", ret);
@@ -241,21 +240,19 @@ static int max8952_pmic_probe(struct i2c_client *client,
if (gpio_is_valid(pdata->gpio_vid0) &&
gpio_is_valid(pdata->gpio_vid1)) {
- if (!gpio_request(pdata->gpio_vid0, "MAX8952 VID0"))
- gpio_direction_output(pdata->gpio_vid0,
- (pdata->default_mode) & 0x1);
- else
+ unsigned long gpio_flags;
+
+ gpio_flags = max8952->vid0 ?
+ GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
+ if (devm_gpio_request_one(&client->dev, pdata->gpio_vid0,
+ gpio_flags, "MAX8952 VID0"))
err = 1;
- if (!gpio_request(pdata->gpio_vid1, "MAX8952 VID1"))
- gpio_direction_output(pdata->gpio_vid1,
- (pdata->default_mode >> 1) & 0x1);
- else {
- if (!err)
- gpio_free(pdata->gpio_vid0);
+ gpio_flags = max8952->vid1 ?
+ GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
+ if (devm_gpio_request_one(&client->dev, pdata->gpio_vid1,
+ gpio_flags, "MAX8952 VID1"))
err = 2;
- }
-
} else
err = 3;
@@ -314,16 +311,6 @@ static int max8952_pmic_probe(struct i2c_client *client,
return 0;
}
-static int max8952_pmic_remove(struct i2c_client *client)
-{
- struct max8952_data *max8952 = i2c_get_clientdata(client);
- struct max8952_platform_data *pdata = max8952->pdata;
-
- gpio_free(pdata->gpio_vid0);
- gpio_free(pdata->gpio_vid1);
- return 0;
-}
-
static const struct i2c_device_id max8952_ids[] = {
{ "max8952", 0 },
{ },
@@ -332,7 +319,6 @@ MODULE_DEVICE_TABLE(i2c, max8952_ids);
static struct i2c_driver max8952_pmic_driver = {
.probe = max8952_pmic_probe,
- .remove = max8952_pmic_remove,
.driver = {
.name = "max8952",
.of_match_table = of_match_ptr(max8952_dt_match),
--
1.8.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] regulator: max8952: Convert to devm_gpio_request_one()
2014-06-16 2:12 [PATCH] regulator: max8952: Convert to devm_gpio_request_one() Axel Lin
@ 2014-06-27 11:51 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-06-27 11:51 UTC (permalink / raw)
To: Axel Lin; +Cc: Krzysztof Kozlowski, MyungJoo Ham, Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 124 bytes --]
On Mon, Jun 16, 2014 at 10:12:25AM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-27 11:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-16 2:12 [PATCH] regulator: max8952: Convert to devm_gpio_request_one() Axel Lin
2014-06-27 11:51 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox