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

Configure Feed

Select the types of activity you want to include in your feed.

regulator: slg51000: switch to using fwnode_gpiod_get_index

devm_gpiod_get_from_of_node() is being retired in favor of
[devm_]fwnode_gpiod_get_index(), that behaves similar to
devm_gpiod_get_index(), but can work with arbitrary firmware node. It
will also be able to support secondary software nodes.

Let's switch this driver over.

Note that now that we have a good non-devm API for getting GPIO from
arbitrary firmware node, there is no reason to use devm API here as
regulator core takes care of managing lifetime of "enable" GPIO and we
were immediately detaching requested GPIO from devm anyway.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Link: https://lore.kernel.org/r/20191004231017.130290-3-dmitry.torokhov@gmail.com
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Dmitry Torokhov and committed by
Mark Brown
de2cd1a5 5be0e549

+5 -8
+5 -8
drivers/regulator/slg51000-regulator.c
··· 198 198 const struct regulator_desc *desc, 199 199 struct regulator_config *config) 200 200 { 201 - struct slg51000 *chip = config->driver_data; 202 201 struct gpio_desc *ena_gpiod; 203 - enum gpiod_flags gflags = GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE; 204 202 205 - ena_gpiod = devm_gpiod_get_from_of_node(chip->dev, np, 206 - "enable-gpios", 0, 207 - gflags, "gpio-en-ldo"); 208 - if (!IS_ERR(ena_gpiod)) { 203 + ena_gpiod = fwnode_gpiod_get_index(of_fwnode_handle(np), "enable", 0, 204 + GPIOD_OUT_LOW | 205 + GPIOD_FLAGS_BIT_NONEXCLUSIVE, 206 + "gpio-en-ldo"); 207 + if (!IS_ERR(ena_gpiod)) 209 208 config->ena_gpiod = ena_gpiod; 210 - devm_gpiod_unhinge(chip->dev, config->ena_gpiod); 211 - } 212 209 213 210 return 0; 214 211 }