mbox series

[0/5] Keep fixed/gpio regulator enable count in balance

Message ID 20230719212049.709358-1-jonas@kwiboo.se
Headers show
Series Keep fixed/gpio regulator enable count in balance | expand

Message

Jonas Karlman July 19, 2023, 9:20 p.m. UTC
The commit 4fcba5d556b4 ("regulator: implement basic reference counter")
have made it more important to keep fixed/gpio regulators enable/disable
state in balance.

This series fixes an inbalance in the mmc_dw driver and changes to use
the more relaxed regulator_set_enable_if_allowed function for a few
other drivers.

The regulator_set_enable_if_allowed function is more relaxed and will
return ENOSYS if the provided regulator is NULL or when DM_REGULATOR
was disabled. Using the following call convention should be safe:

  ret = regulator_set_enable_if_allowed(<supply>, <true|false>);
  if (ret && ret != -ENOSYS)
          return ret;

Jonas Karlman (5):
  adc: Use regulator_set_enable_if_allowed
  usb: dwc2: Use regulator_set_enable_if_allowed
  usb: ehci-generic: Use regulator_set_enable_if_allowed
  mmc: Use regulator_set_enable_if_allowed
  mmc: dw_mmc: Keep vqmmc-supply enable count in balance

 drivers/adc/adc-uclass.c        | 22 ++++++++++------------
 drivers/mmc/dw_mmc.c            |  4 ++++
 drivers/mmc/mmc.c               | 10 ++++++----
 drivers/usb/host/dwc2.c         | 14 ++++++--------
 drivers/usb/host/ehci-generic.c | 23 +++++++++++------------
 5 files changed, 37 insertions(+), 36 deletions(-)

Comments

Svyatoslav Ryhel July 21, 2023, 6:25 a.m. UTC | #1
чт, 20 лип. 2023 р. о 00:20 Jonas Karlman <jonas@kwiboo.se> пише:
>
> The commit 4fcba5d556b4 ("regulator: implement basic reference counter")
> have made it more important to keep fixed/gpio regulators enable/disable
> state in balance.
>
> This series fixes an inbalance in the mmc_dw driver and changes to use
> the more relaxed regulator_set_enable_if_allowed function for a few
> other drivers.
>
> The regulator_set_enable_if_allowed function is more relaxed and will
> return ENOSYS if the provided regulator is NULL or when DM_REGULATOR
> was disabled. Using the following call convention should be safe:

Not sure if I am allowed to leave reviewed-by but as an active u-boot user, may
I ask you to expand migration from regulator_set_enable to less restricted
version to all calls of regulator_set_enable?

>   ret = regulator_set_enable_if_allowed(<supply>, <true|false>);
>   if (ret && ret != -ENOSYS)
>           return ret;
>
> Jonas Karlman (5):
>   adc: Use regulator_set_enable_if_allowed
>   usb: dwc2: Use regulator_set_enable_if_allowed
>   usb: ehci-generic: Use regulator_set_enable_if_allowed
>   mmc: Use regulator_set_enable_if_allowed
>   mmc: dw_mmc: Keep vqmmc-supply enable count in balance
>
>  drivers/adc/adc-uclass.c        | 22 ++++++++++------------
>  drivers/mmc/dw_mmc.c            |  4 ++++
>  drivers/mmc/mmc.c               | 10 ++++++----
>  drivers/usb/host/dwc2.c         | 14 ++++++--------
>  drivers/usb/host/ehci-generic.c | 23 +++++++++++------------
>  5 files changed, 37 insertions(+), 36 deletions(-)
>
> --
> 2.41.0
>
Jonas Karlman Aug. 11, 2023, 8:04 p.m. UTC | #2
On 2023-07-21 08:25, Svyatoslav Ryhel wrote:
> чт, 20 лип. 2023 р. о 00:20 Jonas Karlman <jonas@kwiboo.se> пише:
>>
>> The commit 4fcba5d556b4 ("regulator: implement basic reference counter")
>> have made it more important to keep fixed/gpio regulators enable/disable
>> state in balance.
>>
>> This series fixes an inbalance in the mmc_dw driver and changes to use
>> the more relaxed regulator_set_enable_if_allowed function for a few
>> other drivers.
>>
>> The regulator_set_enable_if_allowed function is more relaxed and will
>> return ENOSYS if the provided regulator is NULL or when DM_REGULATOR
>> was disabled. Using the following call convention should be safe:
> 
> Not sure if I am allowed to leave reviewed-by but as an active u-boot user, may
> I ask you to expand migration from regulator_set_enable to less restricted
> version to all calls of regulator_set_enable?

I try to only touch code that I can runtime test to verify that any
change is valid and works on real hw. Could possible do a separate
series for dwc3-meson if I can find my old amlogic boards.

Regards,
Jonas

> 
>>   ret = regulator_set_enable_if_allowed(<supply>, <true|false>);
>>   if (ret && ret != -ENOSYS)
>>           return ret;
>>
>> Jonas Karlman (5):
>>   adc: Use regulator_set_enable_if_allowed
>>   usb: dwc2: Use regulator_set_enable_if_allowed
>>   usb: ehci-generic: Use regulator_set_enable_if_allowed
>>   mmc: Use regulator_set_enable_if_allowed
>>   mmc: dw_mmc: Keep vqmmc-supply enable count in balance
>>
>>  drivers/adc/adc-uclass.c        | 22 ++++++++++------------
>>  drivers/mmc/dw_mmc.c            |  4 ++++
>>  drivers/mmc/mmc.c               | 10 ++++++----
>>  drivers/usb/host/dwc2.c         | 14 ++++++--------
>>  drivers/usb/host/ehci-generic.c | 23 +++++++++++------------
>>  5 files changed, 37 insertions(+), 36 deletions(-)
>>
>> --
>> 2.41.0
>>
Tom Rini Aug. 14, 2023, 1:16 p.m. UTC | #3
On Wed, 19 Jul 2023 21:20:53 +0000, Jonas Karlman wrote:

> The commit 4fcba5d556b4 ("regulator: implement basic reference counter")
> have made it more important to keep fixed/gpio regulators enable/disable
> state in balance.
> 
> This series fixes an inbalance in the mmc_dw driver and changes to use
> the more relaxed regulator_set_enable_if_allowed function for a few
> other drivers.
> 
> [...]

Applied to u-boot/next, thanks!