diff mbox series

[v2,01/10] watchdog: wdt-uclass.c: use wdt_start() in wdt_expire_now()

Message ID 20210527220017.1266765-2-rasmus.villemoes@prevas.dk
State Superseded
Delegated to: Stefan Roese
Headers show
Series handling all DM watchdogs in watchdog_reset() | expand

Commit Message

Rasmus Villemoes May 27, 2021, 10 p.m. UTC
wdt_start() does the "no ->start? return -ENOSYS" check, don't
open-code that in wdt_expire_now().

Also, wdt_start() maintains some global (and later some per-device)
state, which would get out of sync with this direct method call - not
that it matters much here since the board is supposed to reset very
soon.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
 drivers/watchdog/wdt-uclass.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Simon Glass June 22, 2021, 1:31 p.m. UTC | #1
On Thu, 27 May 2021 at 16:00, Rasmus Villemoes
<rasmus.villemoes@prevas.dk> wrote:
>
> wdt_start() does the "no ->start? return -ENOSYS" check, don't
> open-code that in wdt_expire_now().
>
> Also, wdt_start() maintains some global (and later some per-device)
> state, which would get out of sync with this direct method call - not
> that it matters much here since the board is supposed to reset very
> soon.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> ---
>  drivers/watchdog/wdt-uclass.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Stefan Roese June 29, 2021, 5:54 a.m. UTC | #2
On 28.05.21 00:00, Rasmus Villemoes wrote:
> wdt_start() does the "no ->start? return -ENOSYS" check, don't
> open-code that in wdt_expire_now().
> 
> Also, wdt_start() maintains some global (and later some per-device)
> state, which would get out of sync with this direct method call - not
> that it matters much here since the board is supposed to reset very
> soon.
> 
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   drivers/watchdog/wdt-uclass.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
> index 2687135296..634428fa24 100644
> --- a/drivers/watchdog/wdt-uclass.c
> +++ b/drivers/watchdog/wdt-uclass.c
> @@ -118,10 +118,8 @@ int wdt_expire_now(struct udevice *dev, ulong flags)
>   	if (ops->expire_now) {
>   		return ops->expire_now(dev, flags);
>   	} else {
> -		if (!ops->start)
> -			return -ENOSYS;
> +		ret = wdt_start(dev, 1, flags);
>   
> -		ret = ops->start(dev, 1, flags);
>   		if (ret < 0)
>   			return ret;
>   
> 


Viele Grüße,
Stefan
diff mbox series

Patch

diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index 2687135296..634428fa24 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -118,10 +118,8 @@  int wdt_expire_now(struct udevice *dev, ulong flags)
 	if (ops->expire_now) {
 		return ops->expire_now(dev, flags);
 	} else {
-		if (!ops->start)
-			return -ENOSYS;
+		ret = wdt_start(dev, 1, flags);
 
-		ret = ops->start(dev, 1, flags);
 		if (ret < 0)
 			return ret;