Commit 26ab8261 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Dmitry Torokhov

Input: adp5588-keys - use devm_regulator_get_enable()

Use devm_regulator_get_enable() instead of hand writing it. It saves some
line of code.
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Link: https://lore.kernel.org/r/af343b5b0d740cc9f8863264c30e3da4215721d7.1686985911.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 3ce6e062
...@@ -713,17 +713,11 @@ static int adp5588_fw_parse(struct adp5588_kpad *kpad) ...@@ -713,17 +713,11 @@ static int adp5588_fw_parse(struct adp5588_kpad *kpad)
return 0; return 0;
} }
static void adp5588_disable_regulator(void *reg)
{
regulator_disable(reg);
}
static int adp5588_probe(struct i2c_client *client) static int adp5588_probe(struct i2c_client *client)
{ {
struct adp5588_kpad *kpad; struct adp5588_kpad *kpad;
struct input_dev *input; struct input_dev *input;
struct gpio_desc *gpio; struct gpio_desc *gpio;
struct regulator *vcc;
unsigned int revid; unsigned int revid;
int ret; int ret;
int error; int error;
...@@ -749,16 +743,7 @@ static int adp5588_probe(struct i2c_client *client) ...@@ -749,16 +743,7 @@ static int adp5588_probe(struct i2c_client *client)
if (error) if (error)
return error; return error;
vcc = devm_regulator_get(&client->dev, "vcc"); error = devm_regulator_get_enable(&client->dev, "vcc");
if (IS_ERR(vcc))
return PTR_ERR(vcc);
error = regulator_enable(vcc);
if (error)
return error;
error = devm_add_action_or_reset(&client->dev,
adp5588_disable_regulator, vcc);
if (error) if (error)
return error; return error;
......
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