Linux-Watchdog Archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Jacky Bai <ping.bai@nxp.com>
Cc: wim@linux-watchdog.org, shawnguo@kernel.org,
	kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com,
	linux-watchdog@vger.kernel.org
Subject: Re: [PATCH] watchdog: imx_sc_wdt: continue if the wdog already enabled
Date: Tue, 10 Oct 2023 06:46:56 -0700	[thread overview]
Message-ID: <cab39dae-cd1a-4ec0-9ed5-19a71344b488@roeck-us.net> (raw)
In-Reply-To: <20231010074626.2787383-1-ping.bai@nxp.com>

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
> 

      reply	other threads:[~2023-10-10 13:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-10  7:46 [PATCH] watchdog: imx_sc_wdt: continue if the wdog already enabled Jacky Bai
2023-10-10 13:46 ` Guenter Roeck [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=cab39dae-cd1a-4ec0-9ed5-19a71344b488@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-imx@nxp.com \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=ping.bai@nxp.com \
    --cc=shawnguo@kernel.org \
    --cc=wim@linux-watchdog.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).