diff options
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/max8952.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c index c2792f0271ab..f7f9efcfedb7 100644 --- a/drivers/regulator/max8952.c +++ b/drivers/regulator/max8952.c | |||
@@ -229,7 +229,6 @@ static int max8952_pmic_probe(struct i2c_client *client, | |||
229 | config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH; | 229 | config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH; |
230 | 230 | ||
231 | rdev = devm_regulator_register(&client->dev, ®ulator, &config); | 231 | rdev = devm_regulator_register(&client->dev, ®ulator, &config); |
232 | |||
233 | if (IS_ERR(rdev)) { | 232 | if (IS_ERR(rdev)) { |
234 | ret = PTR_ERR(rdev); | 233 | ret = PTR_ERR(rdev); |
235 | dev_err(&client->dev, "regulator init failed (%d)\n", ret); | 234 | dev_err(&client->dev, "regulator init failed (%d)\n", ret); |
@@ -241,21 +240,19 @@ static int max8952_pmic_probe(struct i2c_client *client, | |||
241 | 240 | ||
242 | if (gpio_is_valid(pdata->gpio_vid0) && | 241 | if (gpio_is_valid(pdata->gpio_vid0) && |
243 | gpio_is_valid(pdata->gpio_vid1)) { | 242 | gpio_is_valid(pdata->gpio_vid1)) { |
244 | if (!gpio_request(pdata->gpio_vid0, "MAX8952 VID0")) | 243 | unsigned long gpio_flags; |
245 | gpio_direction_output(pdata->gpio_vid0, | 244 | |
246 | (pdata->default_mode) & 0x1); | 245 | gpio_flags = max8952->vid0 ? |
247 | else | 246 | GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; |
247 | if (devm_gpio_request_one(&client->dev, pdata->gpio_vid0, | ||
248 | gpio_flags, "MAX8952 VID0")) | ||
248 | err = 1; | 249 | err = 1; |
249 | 250 | ||
250 | if (!gpio_request(pdata->gpio_vid1, "MAX8952 VID1")) | 251 | gpio_flags = max8952->vid1 ? |
251 | gpio_direction_output(pdata->gpio_vid1, | 252 | GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; |
252 | (pdata->default_mode >> 1) & 0x1); | 253 | if (devm_gpio_request_one(&client->dev, pdata->gpio_vid1, |
253 | else { | 254 | gpio_flags, "MAX8952 VID1")) |
254 | if (!err) | ||
255 | gpio_free(pdata->gpio_vid0); | ||
256 | err = 2; | 255 | err = 2; |
257 | } | ||
258 | |||
259 | } else | 256 | } else |
260 | err = 3; | 257 | err = 3; |
261 | 258 | ||
@@ -314,16 +311,6 @@ static int max8952_pmic_probe(struct i2c_client *client, | |||
314 | return 0; | 311 | return 0; |
315 | } | 312 | } |
316 | 313 | ||
317 | static int max8952_pmic_remove(struct i2c_client *client) | ||
318 | { | ||
319 | struct max8952_data *max8952 = i2c_get_clientdata(client); | ||
320 | struct max8952_platform_data *pdata = max8952->pdata; | ||
321 | |||
322 | gpio_free(pdata->gpio_vid0); | ||
323 | gpio_free(pdata->gpio_vid1); | ||
324 | return 0; | ||
325 | } | ||
326 | |||
327 | static const struct i2c_device_id max8952_ids[] = { | 314 | static const struct i2c_device_id max8952_ids[] = { |
328 | { "max8952", 0 }, | 315 | { "max8952", 0 }, |
329 | { }, | 316 | { }, |
@@ -332,7 +319,6 @@ MODULE_DEVICE_TABLE(i2c, max8952_ids); | |||
332 | 319 | ||
333 | static struct i2c_driver max8952_pmic_driver = { | 320 | static struct i2c_driver max8952_pmic_driver = { |
334 | .probe = max8952_pmic_probe, | 321 | .probe = max8952_pmic_probe, |
335 | .remove = max8952_pmic_remove, | ||
336 | .driver = { | 322 | .driver = { |
337 | .name = "max8952", | 323 | .name = "max8952", |
338 | .of_match_table = of_match_ptr(max8952_dt_match), | 324 | .of_match_table = of_match_ptr(max8952_dt_match), |