mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Ahmad Fatoum <ahmad@a3f.at>, barebox@lists.infradead.org
Subject: Re: [PATCH] regulator: fixed: remove duplicate always-on handling
Date: Fri, 8 Jul 2022 08:02:35 +0200	[thread overview]
Message-ID: <ed29b5c7-ea3c-9ba9-26a1-f51dba9ea5ff@pengutronix.de> (raw)
In-Reply-To: <20220708055359.1176212-1-ahmad@a3f.at>

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@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 |



      reply	other threads:[~2022-07-08  6:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08  5:53 Ahmad Fatoum
2022-07-08  6:02 ` Ahmad Fatoum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ed29b5c7-ea3c-9ba9-26a1-f51dba9ea5ff@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox