diff mbox series

watchdog: imx_sc_wdt: continue if the wdog already enabled

Message ID 20231010074626.2787383-1-ping.bai@nxp.com (mailing list archive)
State New
Headers show
Series watchdog: imx_sc_wdt: continue if the wdog already enabled | expand

Commit Message

Jacky Bai Oct. 10, 2023, 7:46 a.m. UTC
if the wdog is already enabled, and try to enabled it again,
we should ignore the error and continue, rather than return
error.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/watchdog/imx_sc_wdt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Guenter Roeck Oct. 10, 2023, 1:46 p.m. UTC | #1
On Tue, Oct 10, 2023 at 03:46:26PM +0800, Jacky Bai wrote:
> if the wdog is already enabled, and try to enabled it again,
> we should ignore the error and continue, rather than return
> error.
> 
> Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/imx_sc_wdt.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/imx_sc_wdt.c b/drivers/watchdog/imx_sc_wdt.c
> index 8ac021748d16..e51fe1b78518 100644
> --- a/drivers/watchdog/imx_sc_wdt.c
> +++ b/drivers/watchdog/imx_sc_wdt.c
> @@ -34,6 +34,7 @@
>  
>  #define SC_IRQ_WDOG			1
>  #define SC_IRQ_GROUP_WDOG		1
> +#define SC_TIMER_ERR_BUSY		10
>  
>  static bool nowayout = WATCHDOG_NOWAYOUT;
>  module_param(nowayout, bool, 0000);
> @@ -61,7 +62,9 @@ static int imx_sc_wdt_start(struct watchdog_device *wdog)
>  
>  	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_START_WDOG,
>  		      0, 0, 0, 0, 0, 0, &res);
> -	if (res.a0)
> +
> +	/* Ignore if already enabled(SC_TIMER_ERR_BUSY) */
> +	if (res.a0 && res.a0 != SC_TIMER_ERR_BUSY)
>  		return -EACCES;
>  
>  	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_WDOG_ACT,
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/watchdog/imx_sc_wdt.c b/drivers/watchdog/imx_sc_wdt.c
index 8ac021748d16..e51fe1b78518 100644
--- a/drivers/watchdog/imx_sc_wdt.c
+++ b/drivers/watchdog/imx_sc_wdt.c
@@ -34,6 +34,7 @@ 
 
 #define SC_IRQ_WDOG			1
 #define SC_IRQ_GROUP_WDOG		1
+#define SC_TIMER_ERR_BUSY		10
 
 static bool nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, bool, 0000);
@@ -61,7 +62,9 @@  static int imx_sc_wdt_start(struct watchdog_device *wdog)
 
 	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_START_WDOG,
 		      0, 0, 0, 0, 0, 0, &res);
-	if (res.a0)
+
+	/* Ignore if already enabled(SC_TIMER_ERR_BUSY) */
+	if (res.a0 && res.a0 != SC_TIMER_ERR_BUSY)
 		return -EACCES;
 
 	arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_WDOG_ACT,