All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Vladimir Panteleev <git@vladimir.panteleev.md>,
	Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog: sp5100_tco: Add "action" module parameter
Date: Sun, 18 Sep 2022 21:17:36 -0700	[thread overview]
Message-ID: <aabb7c21-9a80-696e-6a38-29de57e025ba@roeck-us.net> (raw)
In-Reply-To: <20220918140829.443722-1-git@vladimir.panteleev.md>

On 9/18/22 07:08, Vladimir Panteleev wrote:
> Allow configuring the "action" bit, as documented in [1].
> 
> Previously, the only action supported by this module was to reset the
> system (0).  It can now be configured to power off (1) instead.
> 
> [1]: https://www.amd.com/system/files/TechDocs/44413.pdf
> 
> Signed-off-by: Vladimir Panteleev <git@vladimir.panteleev.md>
> ---
>   drivers/watchdog/sp5100_tco.c | 13 +++++++++++--
>   drivers/watchdog/sp5100_tco.h |  2 +-
>   2 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c
> index ae54dd33e233..802f12e8fd76 100644
> --- a/drivers/watchdog/sp5100_tco.c
> +++ b/drivers/watchdog/sp5100_tco.c
> @@ -65,6 +65,12 @@ static struct pci_dev *sp5100_tco_pci;
>   
>   /* module parameters */
>   
> +#define WATCHDOG_ACTION 0
> +static bool action = WATCHDOG_ACTION;
> +module_param(action, bool, 0444);
> +MODULE_PARM_DESC(action, "Action taken when watchdog expires, 0 to reset, 1 to poweroff (default="
> +		 __MODULE_STRING(WATCHDOG_ACTION) ")");
> +

Other module parameters are not visible. I do not see the benefit of
having this one visible.

>   #define WATCHDOG_HEARTBEAT 60	/* 60 sec default heartbeat. */
>   static int heartbeat = WATCHDOG_HEARTBEAT;  /* in seconds */
>   module_param(heartbeat, int, 0);
> @@ -297,8 +303,11 @@ static int sp5100_tco_timer_init(struct sp5100_tco *tco)
>   	if (val & SP5100_WDT_FIRED)
>   		wdd->bootstatus = WDIOF_CARDRESET;
>   
> -	/* Set watchdog action to reset the system */
> -	val &= ~SP5100_WDT_ACTION_RESET;
> +	/* Set watchdog action */
> +	if (action)
> +		val |= SP5100_WDT_ACTION;
> +	else
> +		val &= ~SP5100_WDT_ACTION;
>   	writel(val, SP5100_WDT_CONTROL(tco->tcobase));
>   
>   	/* Set a reasonable heartbeat before we stop the timer */
> diff --git a/drivers/watchdog/sp5100_tco.h b/drivers/watchdog/sp5100_tco.h
> index 6a0986d2c94b..9752ab2b0130 100644
> --- a/drivers/watchdog/sp5100_tco.h
> +++ b/drivers/watchdog/sp5100_tco.h
> @@ -18,7 +18,7 @@
>   
>   #define SP5100_WDT_START_STOP_BIT	BIT(0)
>   #define SP5100_WDT_FIRED		BIT(1)
> -#define SP5100_WDT_ACTION_RESET		BIT(2)
> +#define SP5100_WDT_ACTION		BIT(2)

I do not see the point of renaming this define.

>   #define SP5100_WDT_DISABLED		BIT(3)
>   #define SP5100_WDT_TRIGGER_BIT		BIT(7)
>   


       reply	other threads:[~2022-09-19  4:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220918140829.443722-1-git@vladimir.panteleev.md>
2022-09-19  4:17 ` Guenter Roeck [this message]
2022-09-19  5:58   ` [PATCH] watchdog: sp5100_tco: Add "action" module parameter Vladimir Panteleev
2022-09-19 12:29     ` Guenter Roeck
2022-09-19 13:18       ` Vladimir Panteleev
2022-09-19 13:27         ` Guenter Roeck

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=aabb7c21-9a80-696e-6a38-29de57e025ba@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=git@vladimir.panteleev.md \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.