* [PATCH] Input: adp5588-keys - Use devm_regulator_get_enable()
@ 2023-06-17 7:12 Christophe JAILLET
2023-06-19 6:05 ` Hennerich, Michael
2023-07-08 0:04 ` Dmitry Torokhov
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2023-06-17 7:12 UTC (permalink / raw)
To: Michael Hennerich, Dmitry Torokhov
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-input
Use devm_regulator_get_enable() instead of hand writing it. It saves some
line of code.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/input/keyboard/adp5588-keys.c | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index 896a5a989ddc..61e8e43e9c2b 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -713,17 +713,11 @@ static int adp5588_fw_parse(struct adp5588_kpad *kpad)
return 0;
}
-static void adp5588_disable_regulator(void *reg)
-{
- regulator_disable(reg);
-}
-
static int adp5588_probe(struct i2c_client *client)
{
struct adp5588_kpad *kpad;
struct input_dev *input;
struct gpio_desc *gpio;
- struct regulator *vcc;
unsigned int revid;
int ret;
int error;
@@ -749,16 +743,7 @@ static int adp5588_probe(struct i2c_client *client)
if (error)
return error;
- vcc = devm_regulator_get(&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);
+ error = devm_regulator_get_enable(&client->dev, "vcc");
if (error)
return error;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] Input: adp5588-keys - Use devm_regulator_get_enable()
2023-06-17 7:12 [PATCH] Input: adp5588-keys - Use devm_regulator_get_enable() Christophe JAILLET
@ 2023-06-19 6:05 ` Hennerich, Michael
2023-07-08 0:04 ` Dmitry Torokhov
1 sibling, 0 replies; 3+ messages in thread
From: Hennerich, Michael @ 2023-06-19 6:05 UTC (permalink / raw)
To: Christophe JAILLET, Dmitry Torokhov
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-input@vger.kernel.org
> -----Original Message-----
> From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Sent: Samstag, 17. Juni 2023 09:12
> To: Hennerich, Michael <Michael.Hennerich@analog.com>; Dmitry Torokhov
> <dmitry.torokhov@gmail.com>
> Cc: linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org; Christophe
> JAILLET <christophe.jaillet@wanadoo.fr>; linux-input@vger.kernel.org
> Subject: [PATCH] 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: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
> ---
> drivers/input/keyboard/adp5588-keys.c | 17 +----------------
> 1 file changed, 1 insertion(+), 16 deletions(-)
>
> diff --git a/drivers/input/keyboard/adp5588-keys.c
> b/drivers/input/keyboard/adp5588-keys.c
> index 896a5a989ddc..61e8e43e9c2b 100644
> --- a/drivers/input/keyboard/adp5588-keys.c
> +++ b/drivers/input/keyboard/adp5588-keys.c
> @@ -713,17 +713,11 @@ static int adp5588_fw_parse(struct adp5588_kpad
> *kpad)
> return 0;
> }
>
> -static void adp5588_disable_regulator(void *reg) -{
> - regulator_disable(reg);
> -}
> -
> static int adp5588_probe(struct i2c_client *client) {
> struct adp5588_kpad *kpad;
> struct input_dev *input;
> struct gpio_desc *gpio;
> - struct regulator *vcc;
> unsigned int revid;
> int ret;
> int error;
> @@ -749,16 +743,7 @@ static int adp5588_probe(struct i2c_client *client)
> if (error)
> return error;
>
> - vcc = devm_regulator_get(&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);
> + error = devm_regulator_get_enable(&client->dev, "vcc");
> if (error)
> return error;
>
> --
> 2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Input: adp5588-keys - Use devm_regulator_get_enable()
2023-06-17 7:12 [PATCH] Input: adp5588-keys - Use devm_regulator_get_enable() Christophe JAILLET
2023-06-19 6:05 ` Hennerich, Michael
@ 2023-07-08 0:04 ` Dmitry Torokhov
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2023-07-08 0:04 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Michael Hennerich, linux-kernel, kernel-janitors, linux-input
On Sat, Jun 17, 2023 at 09:12:03AM +0200, Christophe JAILLET wrote:
> Use devm_regulator_get_enable() instead of hand writing it. It saves some
> line of code.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-08 0:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-17 7:12 [PATCH] Input: adp5588-keys - Use devm_regulator_get_enable() Christophe JAILLET
2023-06-19 6:05 ` Hennerich, Michael
2023-07-08 0:04 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox