[PATCH] regulator: fixed: remove duplicate always-on handling

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Jul 7 23:02:35 PDT 2022


On 08.07.22 07:53, Ahmad Fatoum wrote:
> Regulator core already handles always-on property, so remove handling in
> fixed-regulator driver. For this to have no functional change, all
> regulator uses must be balanced as regulator code implements always-on
> by initializing use count to baseline of 1, while fixed-regulator
> prevents disabling altogether. As mismatched regulator enable/disable
> is a bug in need of fixing anyway, this is tolerated.

Rethinking it, I guess we should just move this into regulator core
instead. That's what Linux does as well.

> 
> Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
> ---
>  drivers/regulator/fixed.c | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
> index c5f97d78df40..ec64f39b86c7 100644
> --- a/drivers/regulator/fixed.c
> +++ b/drivers/regulator/fixed.c
> @@ -15,7 +15,6 @@
>  
>  struct regulator_fixed {
>  	int gpio;
> -	int always_on;
>  	struct regulator_dev rdev;
>  	struct regulator_desc rdesc;
>  };
> @@ -34,9 +33,6 @@ static int regulator_fixed_disable(struct regulator_dev *rdev)
>  {
>  	struct regulator_fixed *fix = container_of(rdev, struct regulator_fixed, rdev);
>  
> -	if (fix->always_on)
> -		return 0;
> -
>  	if (!gpio_is_valid(fix->gpio))
>  		return 0;
>  
> @@ -76,12 +72,6 @@ static int regulator_fixed_probe(struct device_d *dev)
>  	if (!of_property_read_u32(np, "off-on-delay-us", &delay))
>  		fix->rdesc.off_on_delay = delay;
>  
> -	if (of_find_property(np, "regulator-always-on", NULL) ||
> -	    of_find_property(np, "regulator-boot-on", NULL)) {
> -		fix->always_on = 1;
> -		regulator_fixed_enable(&fix->rdev);
> -	}
> -
>  	ret = of_regulator_register(&fix->rdev, np);
>  	if (ret)
>  		goto err;


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list