[U-Boot,v2,1/3] Revert "power: regulator: Return success on attempt to disable an always-on regulator"

Message ID 20190111094552.7379-2-lokeshvutla@ti.com
State Accepted
Delegated to: Simon Glass
Headers show
Series
  • Introduce regulator_set_enable_if_allowed()
Related show

Commit Message

Lokesh Vutla Jan. 11, 2019, 9:45 a.m.
This reverts commit e17e0ceb83538c015a50b965547f2f4d38f81c5d.

It is advised to return an error when trying to disable an always-on
regulator and let the consumer driver handle the error if needed.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 drivers/power/regulator/regulator-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass Jan. 21, 2019, 6:40 p.m. | #1
On Fri, 11 Jan 2019 at 22:46, Lokesh Vutla <lokeshvutla@ti.com> wrote:
>
> This reverts commit e17e0ceb83538c015a50b965547f2f4d38f81c5d.
>
> It is advised to return an error when trying to disable an always-on
> regulator and let the consumer driver handle the error if needed.
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> ---
>  drivers/power/regulator/regulator-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-dm, thanks!

Patch

diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c
index 39e46279d5..4511625ff2 100644
--- a/drivers/power/regulator/regulator-uclass.c
+++ b/drivers/power/regulator/regulator-uclass.c
@@ -113,7 +113,7 @@  int regulator_set_enable(struct udevice *dev, bool enable)
 
 	uc_pdata = dev_get_uclass_platdata(dev);
 	if (!enable && uc_pdata->always_on)
-		return 0;
+		return -EACCES;
 
 	return ops->set_enable(dev, enable);
 }