Skip to content

Commit b871d9a

Browse files
Bartosz Golaszewskibroonie
authored andcommitted
regulator: make the subsystem aware of shared GPIOs
GPIOLIB is now aware of shared GPIOs and - for platforms where access to such pins is managed internally - we don't need to keep track of the enable count. Once all users in the kernel switch to using the new mechanism, we'll be able to drop the internal counting of users from the regulator code. Acked-by: Mark Brown <broonie@kernel.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Link: https://patch.msgid.link/20251112-gpio-shared-v4-10-b51f97b1abd8@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent eb374f7 commit b871d9a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/regulator/core.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,6 +2616,13 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev,
26162616

26172617
mutex_lock(&regulator_list_mutex);
26182618

2619+
if (gpiod_is_shared(gpiod))
2620+
/*
2621+
* The sharing of this GPIO pin is managed internally by
2622+
* GPIOLIB. We don't need to keep track of its enable count.
2623+
*/
2624+
goto skip_compare;
2625+
26192626
list_for_each_entry(pin, &regulator_ena_gpio_list, list) {
26202627
if (gpiod_is_equal(pin->gpiod, gpiod)) {
26212628
rdev_dbg(rdev, "GPIO is already used\n");
@@ -2628,6 +2635,7 @@ static int regulator_ena_gpio_request(struct regulator_dev *rdev,
26282635
return -ENOMEM;
26292636
}
26302637

2638+
skip_compare:
26312639
pin = new_pin;
26322640
new_pin = NULL;
26332641

0 commit comments

Comments
 (0)