Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>
Link: https://lore.kernel.org/r/af343b5b0d740cc9f8863264c30e3da4215721d7.1686985911.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Christophe JAILLET and committed by
Dmitry Torokhov
26ab8261 3ce6e062

+1 -16
+1 -16
drivers/input/keyboard/adp5588-keys.c
··· 713 713 return 0; 714 714 } 715 715 716 - static void adp5588_disable_regulator(void *reg) 717 - { 718 - regulator_disable(reg); 719 - } 720 - 721 716 static int adp5588_probe(struct i2c_client *client) 722 717 { 723 718 struct adp5588_kpad *kpad; 724 719 struct input_dev *input; 725 720 struct gpio_desc *gpio; 726 - struct regulator *vcc; 727 721 unsigned int revid; 728 722 int ret; 729 723 int error; ··· 743 749 if (error) 744 750 return error; 745 751 746 - vcc = devm_regulator_get(&client->dev, "vcc"); 747 - if (IS_ERR(vcc)) 748 - return PTR_ERR(vcc); 749 - 750 - error = regulator_enable(vcc); 751 - if (error) 752 - return error; 753 - 754 - error = devm_add_action_or_reset(&client->dev, 755 - adp5588_disable_regulator, vcc); 752 + error = devm_regulator_get_enable(&client->dev, "vcc"); 756 753 if (error) 757 754 return error; 758 755