[PATCH 2/3] watchdog: core: use new dev_add_param_tristate helper for .running param

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

 



Previous commit added a dev_add_param_tristate_ro that can be readily
used instead of the enum parameter here. Use it.
This also fixes the issue that running_names had external linkage.

Signed-off-by: Ahmad Fatoum <ahmad@xxxxxx>
---
 drivers/watchdog/wd_core.c | 9 +--------
 include/watchdog.h         | 5 ++++-
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
index fcead1175558..b6e2a37b1f0c 100644
--- a/drivers/watchdog/wd_core.c
+++ b/drivers/watchdog/wd_core.c
@@ -152,12 +152,6 @@ static unsigned int dev_get_watchdog_priority(struct device_d *dev)
 	return priority;
 }
 
-const char *running_names[] = {
-	[WDOG_HW_RUNNING_UNSUPPORTED] = "unknown",
-	[WDOG_HW_RUNNING] = "1",
-	[WDOG_HW_NOT_RUNNING] = "0",
-};
-
 int watchdog_register(struct watchdog *wd)
 {
 	struct param_d *p;
@@ -176,8 +170,7 @@ int watchdog_register(struct watchdog *wd)
 	if (ret)
 		return ret;
 
-	p = dev_add_param_enum_ro(&wd->dev, "running", &wd->running,
-				  running_names, ARRAY_SIZE(running_names));
+	p = dev_add_param_tristate_ro(&wd->dev, "running", &wd->running);
 	if (IS_ERR(p))
 		return PTR_ERR(p);
 
diff --git a/include/watchdog.h b/include/watchdog.h
index 5790205a487b..9741570ce229 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -15,9 +15,12 @@
 
 #include <poller.h>
 #include <driver.h>
+#include <param.h>
 
 enum wdog_hw_runnning {
-	 WDOG_HW_RUNNING_UNSUPPORTED, WDOG_HW_RUNNING, WDOG_HW_NOT_RUNNING
+	 WDOG_HW_RUNNING_UNSUPPORTED = PARAM_TRISTATE_UNKNOWN,
+	 WDOG_HW_RUNNING = PARAM_TRISTATE_TRUE,
+	 WDOG_HW_NOT_RUNNING = PARAM_TRISTATE_FALSE
 };
 
 struct watchdog {
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux