mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regulator: check the return value of gpiod_set_value_cansleep()
@ 2025-12-03  8:47 Bartosz Golaszewski
  2025-12-03 16:08 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Bartosz Golaszewski @ 2025-12-03  8:47 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: linux-kernel, Bartosz Golaszewski

gpiod_set_value_cansleep() now returns an integer and can indicate
failures in the GPIO layer. Propagate any potential errors to regulator
core.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
 drivers/regulator/core.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index f4987f54e01b..4b6182cde859 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2823,14 +2823,18 @@ static void regulator_ena_gpio_free(struct regulator_dev *rdev)
 static int regulator_ena_gpio_ctrl(struct regulator_dev *rdev, bool enable)
 {
 	struct regulator_enable_gpio *pin = rdev->ena_pin;
+	int ret;
 
 	if (!pin)
 		return -EINVAL;
 
 	if (enable) {
 		/* Enable GPIO at initial use */
-		if (pin->enable_count == 0)
-			gpiod_set_value_cansleep(pin->gpiod, 1);
+		if (pin->enable_count == 0) {
+			ret = gpiod_set_value_cansleep(pin->gpiod, 1);
+			if (ret)
+				return ret;
+		}
 
 		pin->enable_count++;
 	} else {
@@ -2841,7 +2845,10 @@ static int regulator_ena_gpio_ctrl(struct regulator_dev *rdev, bool enable)
 
 		/* Disable GPIO if not used */
 		if (pin->enable_count <= 1) {
-			gpiod_set_value_cansleep(pin->gpiod, 0);
+			ret = gpiod_set_value_cansleep(pin->gpiod, 0);
+			if (ret)
+				return ret;
+
 			pin->enable_count = 0;
 		}
 	}
-- 
2.51.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] regulator: check the return value of gpiod_set_value_cansleep()
  2025-12-03  8:47 [PATCH] regulator: check the return value of gpiod_set_value_cansleep() Bartosz Golaszewski
@ 2025-12-03 16:08 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2025-12-03 16:08 UTC (permalink / raw)
  To: Liam Girdwood, Bartosz Golaszewski; +Cc: linux-kernel

On Wed, 03 Dec 2025 09:47:37 +0100, Bartosz Golaszewski wrote:
> gpiod_set_value_cansleep() now returns an integer and can indicate
> failures in the GPIO layer. Propagate any potential errors to regulator
> core.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: check the return value of gpiod_set_value_cansleep()
      commit: 84c8097e677478b64e10b6e44e3857eb0f02ba68

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-03 16:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-03  8:47 [PATCH] regulator: check the return value of gpiod_set_value_cansleep() Bartosz Golaszewski
2025-12-03 16:08 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®