@@ -212,3 +212,6 @@ driver specific data to and a pointer to the data itself.
The watchdog_get_drvdata function allows you to retrieve driver specific data.
The argument of this function is the watchdog device where you want to retrieve
data from. The function returns the pointer to the driver specific data.
+
+The watchdog_probe_dt function allows you to retrieve the timeout property
+from the device tree.
@@ -11,6 +11,7 @@
#include <linux/ioctl.h>
#include <linux/types.h>
+#include <linux/of.h>
#define WATCHDOG_IOCTL_BASE 'W'
@@ -174,6 +175,16 @@ static inline void *watchdog_get_drvdata(struct watchdog_device *wdd)
return wdd->driver_data;
}
+/* Use the following function to retrieve the timeout property from dt */
+static inline void watchdog_probe_dt(struct watchdog_device *wdd,
+ struct device_node *node)
+{
+ if (!node)
+ return;
+
+ of_property_read_u32(node, "timeout", &wdd->timeout);
+}
+
/* drivers/watchdog/core/watchdog_core.c */
extern int watchdog_register_device(struct watchdog_device *);
extern void watchdog_unregister_device(struct watchdog_device *);
Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com> --- Documentation/watchdog/watchdog-kernel-api.txt | 3 +++ include/linux/watchdog.h | 11 +++++++++++ 2 files changed, 14 insertions(+)