Re: [PATCH v5 3/3] regulator: handle different error codes in regulator_set_enable_if_allowed

2023-04-20 Thread Patrice CHOTARD



On 4/19/23 15:45, Eugen Hristev wrote:
> The regulator core can return different codes which are not considered
> a real error for this function.
> Return success in such cases.
> 
> Signed-off-by: Eugen Hristev 
> ---
> Changes in v5:
>  - this is a new patch
> 
>  drivers/power/regulator/regulator-uclass.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/power/regulator/regulator-uclass.c 
> b/drivers/power/regulator/regulator-uclass.c
> index d608f7c23657..3a6ba69f6d5f 100644
> --- a/drivers/power/regulator/regulator-uclass.c
> +++ b/drivers/power/regulator/regulator-uclass.c
> @@ -197,6 +197,12 @@ int regulator_set_enable_if_allowed(struct udevice *dev, 
> bool enable)
>   ret = regulator_set_enable(dev, enable);
>   if (ret == -ENOSYS || ret == -EACCES)
>   return 0;
> + /* if we want to disable but it's in use by someone else */
> + if (!enable && ret == -EBUSY)
> + return 0;
> + /* if it's already enabled/disabled */
> + if (ret == -EALREADY)
> + return 0;
>  
>   return ret;
>  }

Reviewed-by: Patrice Chotard 

Thanks
Patrice


Re: [PATCH v5 3/3] regulator: handle different error codes in regulator_set_enable_if_allowed

2023-04-19 Thread Simon Glass
On Thu, 20 Apr 2023 at 01:45, Eugen Hristev  wrote:
>
> The regulator core can return different codes which are not considered
> a real error for this function.
> Return success in such cases.
>
> Signed-off-by: Eugen Hristev 
> ---
> Changes in v5:
>  - this is a new patch
>
>  drivers/power/regulator/regulator-uclass.c | 6 ++
>  1 file changed, 6 insertions(+)

Reviewed-by: Simon Glass