summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-08-26 12:05:07 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-08-27 21:37:07 +0200
commit62fe28cf0b06ad526e5ef2fcfd3f02c20cfb0bd8 (patch)
tree3631beaaf390b8baa1219dea4003144e857dab3f /drivers/watchdog
parent8f4cf30903cf6daaed0be1e8911363a3984abf72 (diff)
downloadbarebox-62fe28cf0b06ad526e5ef2fcfd3f02c20cfb0bd8.tar.gz
watchdog: Give watchdogs a name
This adds a dev and name member to struct watchdog which helps distinguishing between different watchdogs. Also add some debugging aids. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/davinci_wdt.c1
-rw-r--r--drivers/watchdog/im28wd.c1
-rw-r--r--drivers/watchdog/imxwd.c1
-rw-r--r--drivers/watchdog/wd_core.c15
4 files changed, 17 insertions, 1 deletions
diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index ecf6e89..dfabee2 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -147,6 +147,7 @@ static int davinci_wdt_probe(struct device_d *dev)
clk_enable(davinci_wdt->clk);
davinci_wdt->wd.set_timeout = davinci_wdt_set_timeout;
+ davinci_wdt->wd.dev = dev;
ret = watchdog_register(&davinci_wdt->wd);
if (ret < 0)
diff --git a/drivers/watchdog/im28wd.c b/drivers/watchdog/im28wd.c
index a9093a7..3510776 100644
--- a/drivers/watchdog/im28wd.c
+++ b/drivers/watchdog/im28wd.c
@@ -197,6 +197,7 @@ static int imx28_wd_probe(struct device_d *dev)
if (IS_ERR(priv->regs))
return PTR_ERR(priv->regs);
priv->wd.set_timeout = imx28_watchdog_set_timeout;
+ priv->wd.dev = dev;
if (!(readl(priv->regs + MXS_RTC_STAT) & MXS_RTC_STAT_WD_PRESENT)) {
rc = -ENODEV;
diff --git a/drivers/watchdog/imxwd.c b/drivers/watchdog/imxwd.c
index 4621d41..dd11a62 100644
--- a/drivers/watchdog/imxwd.c
+++ b/drivers/watchdog/imxwd.c
@@ -186,6 +186,7 @@ static int imx_wd_probe(struct device_d *dev)
}
priv->ops = ops;
priv->wd.set_timeout = imx_watchdog_set_timeout;
+ priv->wd.dev = dev;
priv->dev = dev;
if (IS_ENABLED(CONFIG_WATCHDOG_IMX)) {
diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
index b8473b7..3a3f519 100644
--- a/drivers/watchdog/wd_core.c
+++ b/drivers/watchdog/wd_core.c
@@ -21,6 +21,16 @@
static LIST_HEAD(watchdog_list);
+static const char *watchdog_name(struct watchdog *wd)
+{
+ if (wd->dev)
+ return dev_name(wd->dev);
+ if (wd->name)
+ return wd->name;
+
+ return "unknown";
+}
+
int watchdog_register(struct watchdog *wd)
{
if (!wd->priority)
@@ -28,7 +38,8 @@ int watchdog_register(struct watchdog *wd)
list_add_tail(&wd->list, &watchdog_list);
- pr_debug("registering watchdog with priority %d\n", wd->priority);
+ pr_debug("registering watchdog %s with priority %d\n", watchdog_name(wd),
+ wd->priority);
return 0;
}
@@ -70,6 +81,8 @@ int watchdog_set_timeout(unsigned timeout)
if (!wd)
return -ENODEV;
+ pr_debug("setting timeout on %s to %ds\n", watchdog_name(wd), timeout);
+
return wd->set_timeout(wd, timeout);
}
EXPORT_SYMBOL(watchdog_set_timeout);