Re: [PATCH] watchdog: sp5100_tco: Add "action" module parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxx>
---
  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)




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux