Commit d7da152c authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: max8952: Convert to devm_gpio_request_one()

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 7171511e
...@@ -229,7 +229,6 @@ static int max8952_pmic_probe(struct i2c_client *client, ...@@ -229,7 +229,6 @@ static int max8952_pmic_probe(struct i2c_client *client,
config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH; config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;
rdev = devm_regulator_register(&client->dev, &regulator, &config); rdev = devm_regulator_register(&client->dev, &regulator, &config);
if (IS_ERR(rdev)) { if (IS_ERR(rdev)) {
ret = PTR_ERR(rdev); ret = PTR_ERR(rdev);
dev_err(&client->dev, "regulator init failed (%d)\n", ret); dev_err(&client->dev, "regulator init failed (%d)\n", ret);
...@@ -241,21 +240,19 @@ static int max8952_pmic_probe(struct i2c_client *client, ...@@ -241,21 +240,19 @@ static int max8952_pmic_probe(struct i2c_client *client,
if (gpio_is_valid(pdata->gpio_vid0) && if (gpio_is_valid(pdata->gpio_vid0) &&
gpio_is_valid(pdata->gpio_vid1)) { gpio_is_valid(pdata->gpio_vid1)) {
if (!gpio_request(pdata->gpio_vid0, "MAX8952 VID0")) unsigned long gpio_flags;
gpio_direction_output(pdata->gpio_vid0,
(pdata->default_mode) & 0x1); gpio_flags = max8952->vid0 ?
else GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
if (devm_gpio_request_one(&client->dev, pdata->gpio_vid0,
gpio_flags, "MAX8952 VID0"))
err = 1; err = 1;
if (!gpio_request(pdata->gpio_vid1, "MAX8952 VID1")) gpio_flags = max8952->vid1 ?
gpio_direction_output(pdata->gpio_vid1, GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
(pdata->default_mode >> 1) & 0x1); if (devm_gpio_request_one(&client->dev, pdata->gpio_vid1,
else { gpio_flags, "MAX8952 VID1"))
if (!err)
gpio_free(pdata->gpio_vid0);
err = 2; err = 2;
}
} else } else
err = 3; err = 3;
...@@ -314,16 +311,6 @@ static int max8952_pmic_probe(struct i2c_client *client, ...@@ -314,16 +311,6 @@ static int max8952_pmic_probe(struct i2c_client *client,
return 0; 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[] = { static const struct i2c_device_id max8952_ids[] = {
{ "max8952", 0 }, { "max8952", 0 },
{ }, { },
...@@ -332,7 +319,6 @@ MODULE_DEVICE_TABLE(i2c, max8952_ids); ...@@ -332,7 +319,6 @@ MODULE_DEVICE_TABLE(i2c, max8952_ids);
static struct i2c_driver max8952_pmic_driver = { static struct i2c_driver max8952_pmic_driver = {
.probe = max8952_pmic_probe, .probe = max8952_pmic_probe,
.remove = max8952_pmic_remove,
.driver = { .driver = {
.name = "max8952", .name = "max8952",
.of_match_table = of_match_ptr(max8952_dt_match), .of_match_table = of_match_ptr(max8952_dt_match),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment