* [PATCH 01/13] watchdog: core: add restart handler support
2015-11-03 16:12 [PATCH 00/13] watchdog: factorize restart handler registration Damien Riegel
@ 2015-11-03 16:12 ` Damien Riegel
2015-11-03 16:12 ` [PATCH 02/13] watchdog: bcm47xx_wdt: use core restart handler Damien Riegel
` (12 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Damien Riegel @ 2015-11-03 16:12 UTC (permalink / raw)
To: linux-watchdog
Cc: Wim Van Sebroeck, Guenter Roeck, Vivien Didelot, kernel,
Damien Riegel
Many watchdog drivers implement the same code to register a restart
handler. This patch provides a generic way to set such a function.
The patch adds a new restart watchdog operation. If a restart priority
greater than 0 is needed, the driver can call
watchdog_set_restart_priority to set it.
Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Suggested-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
Documentation/watchdog/watchdog-kernel-api.txt | 19 ++++++++++
drivers/watchdog/watchdog_core.c | 48 ++++++++++++++++++++++++++
include/linux/watchdog.h | 6 ++++
3 files changed, 73 insertions(+)
diff --git a/Documentation/watchdog/watchdog-kernel-api.txt b/Documentation/watchdog/watchdog-kernel-api.txt
index d8b0d33..490f31b 100644
--- a/Documentation/watchdog/watchdog-kernel-api.txt
+++ b/Documentation/watchdog/watchdog-kernel-api.txt
@@ -53,6 +53,7 @@ struct watchdog_device {
unsigned int timeout;
unsigned int min_timeout;
unsigned int max_timeout;
+ struct notifier_block restart_nb;
void *driver_data;
struct mutex lock;
unsigned long status;
@@ -75,6 +76,10 @@ It contains following fields:
* timeout: the watchdog timer's timeout value (in seconds).
* min_timeout: the watchdog timer's minimum timeout value (in seconds).
* max_timeout: the watchdog timer's maximum timeout value (in seconds).
+* restart_nb: notifier block that is registered for machine restart, for
+ internal use only. If a watchdog is capable of restarting the machine, it
+ should define ops->restart. Priority can be changed through
+ watchdog_set_restart_priority.
* bootstatus: status of the device after booting (reported with watchdog
WDIOF_* status bits).
* driver_data: a pointer to the drivers private data of a watchdog device.
@@ -100,6 +105,7 @@ struct watchdog_ops {
unsigned int (*status)(struct watchdog_device *);
int (*set_timeout)(struct watchdog_device *, unsigned int);
unsigned int (*get_timeleft)(struct watchdog_device *);
+ int (*restart)(struct watchdog_device *);
void (*ref)(struct watchdog_device *);
void (*unref)(struct watchdog_device *);
long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
@@ -164,6 +170,8 @@ they are supported. These optional routines/operations are:
(Note: the WDIOF_SETTIMEOUT needs to be set in the options field of the
watchdog's info structure).
* get_timeleft: this routines returns the time that's left before a reset.
+* restart: this routine restarts the machine. It returns 0 on success or a
+ negative errno code for failure.
* ref: the operation that calls kref_get on the kref of a dynamically
allocated watchdog_device struct.
* unref: the operation that calls kref_put on the kref of a dynamically
@@ -231,3 +239,14 @@ the device tree (if the module timeout parameter is invalid). Best practice is
to set the default timeout value as timeout value in the watchdog_device and
then use this function to set the user "preferred" timeout value.
This routine returns zero on success and a negative errno code for failure.
+
+To change the priority of the restart handler the following helper should be
+used:
+
+void watchdog_set_restart_priority(struct watchdog_device *wdd, int priority);
+
+User should follow the following guidelines for setting the priority:
+* 0: should be called in last resort, has limited restart capabilites
+* 128: default restart handler, use if no other handler is expected to be
+ available, and/or if restart is sufficient to restart the entire system
+* 255: highest priority, will preempt all other restart handlers
diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
index 873f139..513006e 100644
--- a/drivers/watchdog/watchdog_core.c
+++ b/drivers/watchdog/watchdog_core.c
@@ -32,6 +32,7 @@
#include <linux/types.h> /* For standard types */
#include <linux/errno.h> /* For the -ENODEV/... values */
#include <linux/kernel.h> /* For printk/panic/... */
+#include <linux/reboot.h> /* For restart handler */
#include <linux/watchdog.h> /* For watchdog specific items */
#include <linux/init.h> /* For __init/__exit/... */
#include <linux/idr.h> /* For ida_* macros */
@@ -137,6 +138,41 @@ int watchdog_init_timeout(struct watchdog_device *wdd,
}
EXPORT_SYMBOL_GPL(watchdog_init_timeout);
+static int watchdog_restart_notifier(struct notifier_block *nb,
+ unsigned long action, void *data)
+{
+ struct watchdog_device *wdd = container_of(nb, struct watchdog_device,
+ restart_nb);
+
+ int ret;
+
+ ret = wdd->ops->restart(wdd);
+ if (ret)
+ return NOTIFY_BAD;
+
+ return NOTIFY_DONE;
+}
+
+/**
+ * watchdog_set_restart_priority - Change priority of restart handler
+ * @wdd: watchdog device
+ * @priority: priority of the restart handler. It should follow these guidelines:
+ * 0: use watchdog's restart function as last resort, has limited restart
+ * capabilies
+ * 128: default restart handler, use if no other handler is expected to be
+ * available, and/or if restart is sufficient to restart the entire system
+ * 255: preempt all other handlers
+ *
+ * If a wdd->ops->restart function is provided when watchdog_register_device is
+ * called, it will be registered as a restart handler with the priority given
+ * here.
+ */
+void watchdog_set_restart_priority(struct watchdog_device *wdd, int priority)
+{
+ wdd->restart_nb.priority = priority;
+}
+EXPORT_SYMBOL_GPL(watchdog_set_restart_priority);
+
static int __watchdog_register_device(struct watchdog_device *wdd)
{
int ret, id = -1, devno;
@@ -202,6 +238,15 @@ static int __watchdog_register_device(struct watchdog_device *wdd)
return ret;
}
+ if (wdd->ops->restart) {
+ wdd->restart_nb.notifier_call = watchdog_restart_notifier;
+
+ ret = register_restart_handler(&wdd->restart_nb);
+ if (ret)
+ dev_warn(wdd->dev, "Cannot register restart handler (%d)\n",
+ ret);
+ }
+
return 0;
}
@@ -238,6 +283,9 @@ static void __watchdog_unregister_device(struct watchdog_device *wdd)
if (wdd == NULL)
return;
+ if (wdd->ops->restart)
+ unregister_restart_handler(&wdd->restart_nb);
+
devno = wdd->cdev.dev;
ret = watchdog_dev_unregister(wdd);
if (ret)
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index e90e3ea..57e85c3 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -12,6 +12,7 @@
#include <linux/bitops.h>
#include <linux/device.h>
#include <linux/cdev.h>
+#include <linux/notifier.h>
#include <uapi/linux/watchdog.h>
struct watchdog_ops;
@@ -26,6 +27,7 @@ struct watchdog_device;
* @status: The routine that shows the status of the watchdog device.
* @set_timeout:The routine for setting the watchdog devices timeout value.
* @get_timeleft:The routine that get's the time that's left before a reset.
+ * @restart: The routine for restarting the machine.
* @ref: The ref operation for dyn. allocated watchdog_device structs
* @unref: The unref operation for dyn. allocated watchdog_device structs
* @ioctl: The routines that handles extra ioctl calls.
@@ -45,6 +47,7 @@ struct watchdog_ops {
unsigned int (*status)(struct watchdog_device *);
int (*set_timeout)(struct watchdog_device *, unsigned int);
unsigned int (*get_timeleft)(struct watchdog_device *);
+ int (*restart)(struct watchdog_device *);
void (*ref)(struct watchdog_device *);
void (*unref)(struct watchdog_device *);
long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
@@ -62,6 +65,7 @@ struct watchdog_ops {
* @timeout: The watchdog devices timeout value.
* @min_timeout:The watchdog devices minimum timeout value.
* @max_timeout:The watchdog devices maximum timeout value.
+ * @restart_nb: The notifier block to register a restart function.
* @driver-data:Pointer to the drivers private data.
* @lock: Lock for watchdog core internal use only.
* @status: Field that contains the devices internal status bits.
@@ -88,6 +92,7 @@ struct watchdog_device {
unsigned int timeout;
unsigned int min_timeout;
unsigned int max_timeout;
+ struct notifier_block restart_nb;
void *driver_data;
struct mutex lock;
unsigned long status;
@@ -142,6 +147,7 @@ static inline void *watchdog_get_drvdata(struct watchdog_device *wdd)
}
/* drivers/watchdog/watchdog_core.c */
+void watchdog_set_restart_priority(struct watchdog_device *wdd, int priority);
extern int watchdog_init_timeout(struct watchdog_device *wdd,
unsigned int timeout_parm, struct device *dev);
extern int watchdog_register_device(struct watchdog_device *);
--
2.5.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 02/13] watchdog: bcm47xx_wdt: use core restart handler
2015-11-03 16:12 [PATCH 00/13] watchdog: factorize restart handler registration Damien Riegel
2015-11-03 16:12 ` [PATCH 01/13] watchdog: core: add restart handler support Damien Riegel
@ 2015-11-03 16:12 ` Damien Riegel
2015-11-03 16:12 ` [PATCH 03/13] watchdog: da9063_wdt: " Damien Riegel
` (11 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Damien Riegel @ 2015-11-03 16:12 UTC (permalink / raw)
To: linux-watchdog
Cc: Wim Van Sebroeck, Guenter Roeck, Vivien Didelot, kernel,
Damien Riegel
Get rid of the custom restart handler by using the one provided by the
watchdog core.
Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/watchdog/bcm47xx_wdt.c | 21 +++++++--------------
include/linux/bcm47xx_wdt.h | 1 -
2 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/drivers/watchdog/bcm47xx_wdt.c b/drivers/watchdog/bcm47xx_wdt.c
index 4064a43..534ffb4 100644
--- a/drivers/watchdog/bcm47xx_wdt.c
+++ b/drivers/watchdog/bcm47xx_wdt.c
@@ -94,6 +94,7 @@ static struct watchdog_ops bcm47xx_wdt_hard_ops = {
.stop = bcm47xx_wdt_hard_stop,
.ping = bcm47xx_wdt_hard_keepalive,
.set_timeout = bcm47xx_wdt_hard_set_timeout,
+ .restart = bcm47xx_wdt_restart,
};
static void bcm47xx_wdt_soft_timer_tick(unsigned long data)
@@ -169,15 +170,13 @@ static int bcm47xx_wdt_notify_sys(struct notifier_block *this,
return NOTIFY_DONE;
}
-static int bcm47xx_wdt_restart(struct notifier_block *this, unsigned long mode,
- void *cmd)
+static int bcm47xx_wdt_restart(struct watchdog_device *wdd)
{
- struct bcm47xx_wdt *wdt;
+ struct bcm47xx_wdt *wdt = bcm47xx_wdt_get(wdd);
- wdt = container_of(this, struct bcm47xx_wdt, restart_handler);
wdt->timer_set(wdt, 1);
- return NOTIFY_DONE;
+ return 0;
}
static struct watchdog_ops bcm47xx_wdt_soft_ops = {
@@ -186,6 +185,7 @@ static struct watchdog_ops bcm47xx_wdt_soft_ops = {
.stop = bcm47xx_wdt_soft_stop,
.ping = bcm47xx_wdt_soft_keepalive,
.set_timeout = bcm47xx_wdt_soft_set_timeout,
+ .restart = bcm47xx_wdt_restart,
};
static int bcm47xx_wdt_probe(struct platform_device *pdev)
@@ -214,6 +214,7 @@ static int bcm47xx_wdt_probe(struct platform_device *pdev)
if (ret)
goto err_timer;
watchdog_set_nowayout(&wdt->wdd, nowayout);
+ watchdog_set_restart_priority(&wdt->wdd, 64);
wdt->notifier.notifier_call = &bcm47xx_wdt_notify_sys;
@@ -221,23 +222,15 @@ static int bcm47xx_wdt_probe(struct platform_device *pdev)
if (ret)
goto err_timer;
- wdt->restart_handler.notifier_call = &bcm47xx_wdt_restart;
- wdt->restart_handler.priority = 64;
- ret = register_restart_handler(&wdt->restart_handler);
- if (ret)
- goto err_notifier;
-
ret = watchdog_register_device(&wdt->wdd);
if (ret)
- goto err_handler;
+ goto err_notifier;
dev_info(&pdev->dev, "BCM47xx Watchdog Timer enabled (%d seconds%s%s)\n",
timeout, nowayout ? ", nowayout" : "",
soft ? ", Software Timer" : "");
return 0;
-err_handler:
- unregister_restart_handler(&wdt->restart_handler);
err_notifier:
unregister_reboot_notifier(&wdt->notifier);
err_timer:
diff --git a/include/linux/bcm47xx_wdt.h b/include/linux/bcm47xx_wdt.h
index 5582c21..b708786 100644
--- a/include/linux/bcm47xx_wdt.h
+++ b/include/linux/bcm47xx_wdt.h
@@ -16,7 +16,6 @@ struct bcm47xx_wdt {
struct watchdog_device wdd;
struct notifier_block notifier;
- struct notifier_block restart_handler;
struct timer_list soft_timer;
atomic_t soft_ticks;
--
2.5.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 03/13] watchdog: da9063_wdt: use core restart handler
2015-11-03 16:12 [PATCH 00/13] watchdog: factorize restart handler registration Damien Riegel
2015-11-03 16:12 ` [PATCH 01/13] watchdog: core: add restart handler support Damien Riegel
2015-11-03 16:12 ` [PATCH 02/13] watchdog: bcm47xx_wdt: use core restart handler Damien Riegel
@ 2015-11-03 16:12 ` Damien Riegel
2015-11-03 16:12 ` [PATCH 04/13] watchdog: digicolor_wdt: " Damien Riegel
` (10 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Damien Riegel @ 2015-11-03 16:12 UTC (permalink / raw)
To: linux-watchdog
Cc: Wim Van Sebroeck, Guenter Roeck, Vivien Didelot, kernel,
Damien Riegel
Get rid of the custom restart handler by using the one provided by the
watchdog core.
Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/watchdog/da9063_wdt.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c
index 6bf130b..11e8875 100644
--- a/drivers/watchdog/da9063_wdt.c
+++ b/drivers/watchdog/da9063_wdt.c
@@ -20,7 +20,6 @@
#include <linux/delay.h>
#include <linux/mfd/da9063/registers.h>
#include <linux/mfd/da9063/core.h>
-#include <linux/reboot.h>
#include <linux/regmap.h>
/*
@@ -39,7 +38,6 @@ static const unsigned int wdt_timeout[] = { 0, 2, 4, 8, 16, 32, 65, 131 };
struct da9063_watchdog {
struct da9063 *da9063;
struct watchdog_device wdtdev;
- struct notifier_block restart_handler;
};
static unsigned int da9063_wdt_timeout_to_sel(unsigned int secs)
@@ -121,12 +119,9 @@ static int da9063_wdt_set_timeout(struct watchdog_device *wdd,
return ret;
}
-static int da9063_wdt_restart_handler(struct notifier_block *this,
- unsigned long mode, void *cmd)
+static int da9063_wdt_restart(struct watchdog_device *wdd)
{
- struct da9063_watchdog *wdt = container_of(this,
- struct da9063_watchdog,
- restart_handler);
+ struct da9063_watchdog *wdt = watchdog_get_drvdata(wdd);
int ret;
ret = regmap_write(wdt->da9063->regmap, DA9063_REG_CONTROL_F,
@@ -135,7 +130,7 @@ static int da9063_wdt_restart_handler(struct notifier_block *this,
dev_alert(wdt->da9063->dev, "Failed to shutdown (err = %d)\n",
ret);
- return NOTIFY_DONE;
+ return ret;
}
static const struct watchdog_info da9063_watchdog_info = {
@@ -149,6 +144,7 @@ static const struct watchdog_ops da9063_watchdog_ops = {
.stop = da9063_wdt_stop,
.ping = da9063_wdt_ping,
.set_timeout = da9063_wdt_set_timeout,
+ .restart = da9063_wdt_restart,
};
static int da9063_wdt_probe(struct platform_device *pdev)
@@ -179,6 +175,8 @@ static int da9063_wdt_probe(struct platform_device *pdev)
wdt->wdtdev.status = WATCHDOG_NOWAYOUT_INIT_STATUS;
+ watchdog_set_restart_priority(&wdt->wdtdev, 128);
+
watchdog_set_drvdata(&wdt->wdtdev, wdt);
dev_set_drvdata(&pdev->dev, wdt);
@@ -186,13 +184,6 @@ static int da9063_wdt_probe(struct platform_device *pdev)
if (ret)
return ret;
- wdt->restart_handler.notifier_call = da9063_wdt_restart_handler;
- wdt->restart_handler.priority = 128;
- ret = register_restart_handler(&wdt->restart_handler);
- if (ret)
- dev_err(wdt->da9063->dev,
- "Failed to register restart handler (err = %d)\n", ret);
-
return 0;
}
@@ -200,8 +191,6 @@ static int da9063_wdt_remove(struct platform_device *pdev)
{
struct da9063_watchdog *wdt = dev_get_drvdata(&pdev->dev);
- unregister_restart_handler(&wdt->restart_handler);
-
watchdog_unregister_device(&wdt->wdtdev);
return 0;
--
2.5.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 04/13] watchdog: digicolor_wdt: use core restart handler
2015-11-03 16:12 [PATCH 00/13] watchdog: factorize restart handler registration Damien Riegel
` (2 preceding siblings ...)
2015-11-03 16:12 ` [PATCH 03/13] watchdog: da9063_wdt: " Damien Riegel
@ 2015-11-03 16:12 ` Damien Riegel
2015-11-03 16:12 ` [PATCH 05/13] watchdog: imgpdc_wdt: " Damien Riegel
` (9 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Damien Riegel @ 2015-11-03 16:12 UTC (permalink / raw)
To: linux-watchdog
Cc: Wim Van Sebroeck, Guenter Roeck, Vivien Didelot, kernel,
Damien Riegel
Get rid of the custom restart handler by using the one provided by the
watchdog core.
Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/watchdog/digicolor_wdt.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/watchdog/digicolor_wdt.c b/drivers/watchdog/digicolor_wdt.c
index 50abe1b..1ccb0b2 100644
--- a/drivers/watchdog/digicolor_wdt.c
+++ b/drivers/watchdog/digicolor_wdt.c
@@ -15,7 +15,6 @@
#include <linux/delay.h>
#include <linux/clk.h>
#include <linux/watchdog.h>
-#include <linux/reboot.h>
#include <linux/platform_device.h>
#include <linux/of_address.h>
@@ -28,7 +27,6 @@
struct dc_wdt {
void __iomem *base;
struct clk *clk;
- struct notifier_block restart_handler;
spinlock_t lock;
};
@@ -50,16 +48,15 @@ static void dc_wdt_set(struct dc_wdt *wdt, u32 ticks)
spin_unlock_irqrestore(&wdt->lock, flags);
}
-static int dc_restart_handler(struct notifier_block *this, unsigned long mode,
- void *cmd)
+static int dc_wdt_restart(struct watchdog_device *wdog)
{
- struct dc_wdt *wdt = container_of(this, struct dc_wdt, restart_handler);
+ struct dc_wdt *wdt = watchdog_get_drvdata(wdog);
dc_wdt_set(wdt, 1);
/* wait for reset to assert... */
mdelay(500);
- return NOTIFY_DONE;
+ return 0;
}
static int dc_wdt_start(struct watchdog_device *wdog)
@@ -104,6 +101,7 @@ static struct watchdog_ops dc_wdt_ops = {
.stop = dc_wdt_stop,
.set_timeout = dc_wdt_set_timeout,
.get_timeleft = dc_wdt_get_timeleft,
+ .restart = dc_wdt_restart,
};
static struct watchdog_info dc_wdt_info = {
@@ -148,6 +146,7 @@ static int dc_wdt_probe(struct platform_device *pdev)
spin_lock_init(&wdt->lock);
watchdog_set_drvdata(&dc_wdt_wdd, wdt);
+ watchdog_set_restart_priority(&dc_wdt_wdd, 128);
watchdog_init_timeout(&dc_wdt_wdd, timeout, dev);
ret = watchdog_register_device(&dc_wdt_wdd);
if (ret) {
@@ -155,12 +154,6 @@ static int dc_wdt_probe(struct platform_device *pdev)
goto err_iounmap;
}
- wdt->restart_handler.notifier_call = dc_restart_handler;
- wdt->restart_handler.priority = 128;
- ret = register_restart_handler(&wdt->restart_handler);
- if (ret)
- dev_warn(&pdev->dev, "cannot register restart handler\n");
-
return 0;
err_iounmap:
@@ -172,7 +165,6 @@ static int dc_wdt_remove(struct platform_device *pdev)
{
struct dc_wdt *wdt = platform_get_drvdata(pdev);
- unregister_restart_handler(&wdt->restart_handler);
watchdog_unregister_device(&dc_wdt_wdd);
iounmap(wdt->base);
--
2.5.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 05/13] watchdog: imgpdc_wdt: use core restart handler
2015-11-03 16:12 [PATCH 00/13] watchdog: factorize restart handler registration Damien Riegel
` (3 preceding siblings ...)
2015-11-03 16:12 ` [PATCH 04/13] watchdog: digicolor_wdt: " Damien Riegel
@ 2015-11-03 16:12 ` Damien Riegel
2015-11-03 16:12 ` [PATCH 06/13] watchdog: imx2_wdt: " Damien Riegel
` (8 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Damien Riegel @ 2015-11-03 16:12 UTC (permalink / raw)
To: linux-watchdog
Cc: Wim Van Sebroeck, Guenter Roeck, Vivien Didelot, kernel,
Damien Riegel
Get rid of the custom restart handler by using the one provided by the
watchdog core.
Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/watchdog/imgpdc_wdt.c | 34 ++++++++++++----------------------
1 file changed, 12 insertions(+), 22 deletions(-)
diff --git a/drivers/watchdog/imgpdc_wdt.c b/drivers/watchdog/imgpdc_wdt.c
index 15ab072..3679f2e 100644
--- a/drivers/watchdog/imgpdc_wdt.c
+++ b/drivers/watchdog/imgpdc_wdt.c
@@ -45,7 +45,6 @@
#include <linux/log2.h>
#include <linux/module.h>
#include <linux/platform_device.h>
-#include <linux/reboot.h>
#include <linux/slab.h>
#include <linux/watchdog.h>
@@ -87,7 +86,6 @@ struct pdc_wdt_dev {
struct clk *wdt_clk;
struct clk *sys_clk;
void __iomem *base;
- struct notifier_block restart_handler;
};
static int pdc_wdt_keepalive(struct watchdog_device *wdt_dev)
@@ -152,6 +150,16 @@ static int pdc_wdt_start(struct watchdog_device *wdt_dev)
return 0;
}
+static int pdc_wdt_restart(struct watchdog_device *wdt_dev)
+{
+ struct pdc_wdt_dev *wdt = watchdog_get_drvdata(wdt_dev);
+
+ /* Assert SOFT_RESET */
+ writel(0x1, wdt->base + PDC_WDT_SOFT_RESET);
+
+ return 0;
+}
+
static struct watchdog_info pdc_wdt_info = {
.identity = "IMG PDC Watchdog",
.options = WDIOF_SETTIMEOUT |
@@ -165,20 +173,9 @@ static const struct watchdog_ops pdc_wdt_ops = {
.stop = pdc_wdt_stop,
.ping = pdc_wdt_keepalive,
.set_timeout = pdc_wdt_set_timeout,
+ .restart = pdc_wdt_restart,
};
-static int pdc_wdt_restart(struct notifier_block *this, unsigned long mode,
- void *cmd)
-{
- struct pdc_wdt_dev *wdt = container_of(this, struct pdc_wdt_dev,
- restart_handler);
-
- /* Assert SOFT_RESET */
- writel(0x1, wdt->base + PDC_WDT_SOFT_RESET);
-
- return NOTIFY_OK;
-}
-
static int pdc_wdt_probe(struct platform_device *pdev)
{
u64 div;
@@ -282,6 +279,7 @@ static int pdc_wdt_probe(struct platform_device *pdev)
}
watchdog_set_nowayout(&pdc_wdt->wdt_dev, nowayout);
+ watchdog_set_restart_priority(&pdc_wdt->wdt_dev, 128);
platform_set_drvdata(pdev, pdc_wdt);
@@ -289,13 +287,6 @@ static int pdc_wdt_probe(struct platform_device *pdev)
if (ret)
goto disable_wdt_clk;
- pdc_wdt->restart_handler.notifier_call = pdc_wdt_restart;
- pdc_wdt->restart_handler.priority = 128;
- ret = register_restart_handler(&pdc_wdt->restart_handler);
- if (ret)
- dev_warn(&pdev->dev, "failed to register restart handler: %d\n",
- ret);
-
return 0;
disable_wdt_clk:
@@ -316,7 +307,6 @@ static int pdc_wdt_remove(struct platform_device *pdev)
{
struct pdc_wdt_dev *pdc_wdt = platform_get_drvdata(pdev);
- unregister_restart_handler(&pdc_wdt->restart_handler);
pdc_wdt_stop(&pdc_wdt->wdt_dev);
watchdog_unregister_device(&pdc_wdt->wdt_dev);
clk_disable_unprepare(pdc_wdt->wdt_clk);
--
2.5.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 06/13] watchdog: imx2_wdt: use core restart handler
2015-11-03 16:12 [PATCH 00/13] watchdog: factorize restart handler registration Damien Riegel
` (4 preceding siblings ...)
2015-11-03 16:12 ` [PATCH 05/13] watchdog: imgpdc_wdt: " Damien Riegel
@ 2015-11-03 16:12 ` Damien Riegel
2015-11-03 16:12 ` [PATCH 07/13] watchdog: lpc18xx_wdt: " Damien Riegel
` (7 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Damien Riegel @ 2015-11-03 16:12 UTC (permalink / raw)
To: linux-watchdog
Cc: Wim Van Sebroeck, Guenter Roeck, Vivien Didelot, kernel,
Damien Riegel
Get rid of the custom restart handler by using the one provided by the
watchdog core.
Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/watchdog/imx2_wdt.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index 29ef719..e47966a 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -29,10 +29,8 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
-#include <linux/notifier.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
-#include <linux/reboot.h>
#include <linux/regmap.h>
#include <linux/timer.h>
#include <linux/watchdog.h>
@@ -64,7 +62,6 @@ struct imx2_wdt_device {
struct regmap *regmap;
struct timer_list timer; /* Pings the watchdog when closed */
struct watchdog_device wdog;
- struct notifier_block restart_handler;
};
static bool nowayout = WATCHDOG_NOWAYOUT;
@@ -83,13 +80,11 @@ static const struct watchdog_info imx2_wdt_info = {
.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
};
-static int imx2_restart_handler(struct notifier_block *this, unsigned long mode,
- void *cmd)
+static int imx2_wdt_restart(struct watchdog_device *wdog)
{
+ struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog);
unsigned int wcr_enable = IMX2_WDT_WCR_WDE;
- struct imx2_wdt_device *wdev = container_of(this,
- struct imx2_wdt_device,
- restart_handler);
+
/* Assert SRS signal */
regmap_write(wdev->regmap, IMX2_WDT_WCR, wcr_enable);
/*
@@ -105,7 +100,7 @@ static int imx2_restart_handler(struct notifier_block *this, unsigned long mode,
/* wait for reset to assert... */
mdelay(500);
- return NOTIFY_DONE;
+ return 0;
}
static inline void imx2_wdt_setup(struct watchdog_device *wdog)
@@ -213,6 +208,7 @@ static const struct watchdog_ops imx2_wdt_ops = {
.stop = imx2_wdt_stop,
.ping = imx2_wdt_ping,
.set_timeout = imx2_wdt_set_timeout,
+ .restart = imx2_wdt_restart,
};
static const struct regmap_config imx2_wdt_regmap_config = {
@@ -275,6 +271,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, wdog);
watchdog_set_drvdata(wdog, wdev);
watchdog_set_nowayout(wdog, nowayout);
+ watchdog_set_restart_priority(wdog, 128);
watchdog_init_timeout(wdog, timeout, &pdev->dev);
setup_timer(&wdev->timer, imx2_wdt_timer_ping, (unsigned long)wdog);
@@ -294,12 +291,6 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
goto disable_clk;
}
- wdev->restart_handler.notifier_call = imx2_restart_handler;
- wdev->restart_handler.priority = 128;
- ret = register_restart_handler(&wdev->restart_handler);
- if (ret)
- dev_err(&pdev->dev, "cannot register restart handler\n");
-
dev_info(&pdev->dev, "timeout %d sec (nowayout=%d)\n",
wdog->timeout, nowayout);
@@ -315,8 +306,6 @@ static int __exit imx2_wdt_remove(struct platform_device *pdev)
struct watchdog_device *wdog = platform_get_drvdata(pdev);
struct imx2_wdt_device *wdev = watchdog_get_drvdata(wdog);
- unregister_restart_handler(&wdev->restart_handler);
-
watchdog_unregister_device(wdog);
if (imx2_wdt_is_running(wdev)) {
--
2.5.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 07/13] watchdog: lpc18xx_wdt: use core restart handler
2015-11-03 16:12 [PATCH 00/13] watchdog: factorize restart handler registration Damien Riegel
` (5 preceding siblings ...)
2015-11-03 16:12 ` [PATCH 06/13] watchdog: imx2_wdt: " Damien Riegel
@ 2015-11-03 16:12 ` Damien Riegel
2015-11-03 16:12 ` [PATCH 08/13] watchdog: meson_wdt: " Damien Riegel
` (6 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Damien Riegel @ 2015-11-03 16:12 UTC (permalink / raw)
To: linux-watchdog
Cc: Wim Van Sebroeck, Guenter Roeck, Vivien Didelot, kernel,
Damien Riegel
Get rid of the custom restart handler by using the one provided by the
watchdog core.
Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/watchdog/lpc18xx_wdt.c | 68 ++++++++++++++++++------------------------
1 file changed, 29 insertions(+), 39 deletions(-)
diff --git a/drivers/watchdog/lpc18xx_wdt.c b/drivers/watchdog/lpc18xx_wdt.c
index ab7b8b1..6914c83 100644
--- a/drivers/watchdog/lpc18xx_wdt.c
+++ b/drivers/watchdog/lpc18xx_wdt.c
@@ -18,7 +18,6 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
-#include <linux/reboot.h>
#include <linux/watchdog.h>
/* Registers */
@@ -59,7 +58,6 @@ struct lpc18xx_wdt_dev {
unsigned long clk_rate;
void __iomem *base;
struct timer_list timer;
- struct notifier_block restart_handler;
spinlock_t lock;
};
@@ -155,6 +153,33 @@ static int lpc18xx_wdt_start(struct watchdog_device *wdt_dev)
return 0;
}
+static int lpc18xx_wdt_restart(struct watchdog_device *wdt_dev)
+{
+ struct lpc18xx_wdt_dev *lpc18xx_wdt = watchdog_get_drvdata(wdt_dev);
+ unsigned long flags;
+ int val;
+
+ /*
+ * Incorrect feed sequence causes immediate watchdog reset if enabled.
+ */
+ spin_lock_irqsave(&lpc18xx_wdt->lock, flags);
+
+ val = readl(lpc18xx_wdt->base + LPC18XX_WDT_MOD);
+ val |= LPC18XX_WDT_MOD_WDEN;
+ val |= LPC18XX_WDT_MOD_WDRESET;
+ writel(val, lpc18xx_wdt->base + LPC18XX_WDT_MOD);
+
+ writel(LPC18XX_WDT_FEED_MAGIC1, lpc18xx_wdt->base + LPC18XX_WDT_FEED);
+ writel(LPC18XX_WDT_FEED_MAGIC2, lpc18xx_wdt->base + LPC18XX_WDT_FEED);
+
+ writel(LPC18XX_WDT_FEED_MAGIC1, lpc18xx_wdt->base + LPC18XX_WDT_FEED);
+ writel(LPC18XX_WDT_FEED_MAGIC1, lpc18xx_wdt->base + LPC18XX_WDT_FEED);
+
+ spin_unlock_irqrestore(&lpc18xx_wdt->lock, flags);
+
+ return 0;
+}
+
static struct watchdog_info lpc18xx_wdt_info = {
.identity = "NXP LPC18xx Watchdog",
.options = WDIOF_SETTIMEOUT |
@@ -169,37 +194,9 @@ static const struct watchdog_ops lpc18xx_wdt_ops = {
.ping = lpc18xx_wdt_feed,
.set_timeout = lpc18xx_wdt_set_timeout,
.get_timeleft = lpc18xx_wdt_get_timeleft,
+ .restart = lpc18xx_wdt_restart,
};
-static int lpc18xx_wdt_restart(struct notifier_block *this, unsigned long mode,
- void *cmd)
-{
- struct lpc18xx_wdt_dev *lpc18xx_wdt = container_of(this,
- struct lpc18xx_wdt_dev, restart_handler);
- unsigned long flags;
- int val;
-
- /*
- * Incorrect feed sequence causes immediate watchdog reset if enabled.
- */
- spin_lock_irqsave(&lpc18xx_wdt->lock, flags);
-
- val = readl(lpc18xx_wdt->base + LPC18XX_WDT_MOD);
- val |= LPC18XX_WDT_MOD_WDEN;
- val |= LPC18XX_WDT_MOD_WDRESET;
- writel(val, lpc18xx_wdt->base + LPC18XX_WDT_MOD);
-
- writel(LPC18XX_WDT_FEED_MAGIC1, lpc18xx_wdt->base + LPC18XX_WDT_FEED);
- writel(LPC18XX_WDT_FEED_MAGIC2, lpc18xx_wdt->base + LPC18XX_WDT_FEED);
-
- writel(LPC18XX_WDT_FEED_MAGIC1, lpc18xx_wdt->base + LPC18XX_WDT_FEED);
- writel(LPC18XX_WDT_FEED_MAGIC1, lpc18xx_wdt->base + LPC18XX_WDT_FEED);
-
- spin_unlock_irqrestore(&lpc18xx_wdt->lock, flags);
-
- return NOTIFY_OK;
-}
-
static int lpc18xx_wdt_probe(struct platform_device *pdev)
{
struct lpc18xx_wdt_dev *lpc18xx_wdt;
@@ -273,6 +270,7 @@ static int lpc18xx_wdt_probe(struct platform_device *pdev)
(unsigned long)&lpc18xx_wdt->wdt_dev);
watchdog_set_nowayout(&lpc18xx_wdt->wdt_dev, nowayout);
+ watchdog_set_restart_priority(&lpc18xx_wdt->wdt_dev, 128);
platform_set_drvdata(pdev, lpc18xx_wdt);
@@ -280,12 +278,6 @@ static int lpc18xx_wdt_probe(struct platform_device *pdev)
if (ret)
goto disable_wdt_clk;
- lpc18xx_wdt->restart_handler.notifier_call = lpc18xx_wdt_restart;
- lpc18xx_wdt->restart_handler.priority = 128;
- ret = register_restart_handler(&lpc18xx_wdt->restart_handler);
- if (ret)
- dev_warn(dev, "failed to register restart handler: %d\n", ret);
-
return 0;
disable_wdt_clk:
@@ -306,8 +298,6 @@ static int lpc18xx_wdt_remove(struct platform_device *pdev)
{
struct lpc18xx_wdt_dev *lpc18xx_wdt = platform_get_drvdata(pdev);
- unregister_restart_handler(&lpc18xx_wdt->restart_handler);
-
dev_warn(&pdev->dev, "I quit now, hardware will probably reboot!\n");
del_timer(&lpc18xx_wdt->timer);
--
2.5.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 08/13] watchdog: meson_wdt: use core restart handler
2015-11-03 16:12 [PATCH 00/13] watchdog: factorize restart handler registration Damien Riegel
` (6 preceding siblings ...)
2015-11-03 16:12 ` [PATCH 07/13] watchdog: lpc18xx_wdt: " Damien Riegel
@ 2015-11-03 16:12 ` Damien Riegel
2015-11-03 16:12 ` [PATCH 09/13] watchdog: moxart_wdt: " Damien Riegel
` (5 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Damien Riegel @ 2015-11-03 16:12 UTC (permalink / raw)
To: linux-watchdog
Cc: Wim Van Sebroeck, Guenter Roeck, Vivien Didelot, kernel,
Damien Riegel
Get rid of the custom restart handler by using the one provided by the
watchdog core.
Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/watchdog/meson_wdt.c | 23 +++++------------------
1 file changed, 5 insertions(+), 18 deletions(-)
diff --git a/drivers/watchdog/meson_wdt.c b/drivers/watchdog/meson_wdt.c
index 1f4155e..40db9e2 100644
--- a/drivers/watchdog/meson_wdt.c
+++ b/drivers/watchdog/meson_wdt.c
@@ -17,10 +17,8 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
-#include <linux/notifier.h>
#include <linux/of.h>
#include <linux/platform_device.h>
-#include <linux/reboot.h>
#include <linux/types.h>
#include <linux/watchdog.h>
@@ -45,23 +43,19 @@ static unsigned int timeout = MESON_WDT_TIMEOUT;
struct meson_wdt_dev {
struct watchdog_device wdt_dev;
void __iomem *wdt_base;
- struct notifier_block restart_handler;
};
-static int meson_restart_handle(struct notifier_block *this, unsigned long mode,
- void *cmd)
+static int meson_wdt_restart(struct watchdog_device *wdt_dev)
{
+ struct meson_wdt_dev *meson_wdt = watchdog_get_drvdata(wdt_dev);
u32 tc_reboot = MESON_WDT_DC_RESET | MESON_WDT_TC_EN;
- struct meson_wdt_dev *meson_wdt = container_of(this,
- struct meson_wdt_dev,
- restart_handler);
while (1) {
writel(tc_reboot, meson_wdt->wdt_base + MESON_WDT_TC);
mdelay(5);
}
- return NOTIFY_DONE;
+ return 0;
}
static int meson_wdt_ping(struct watchdog_device *wdt_dev)
@@ -136,6 +130,7 @@ static const struct watchdog_ops meson_wdt_ops = {
.stop = meson_wdt_stop,
.ping = meson_wdt_ping,
.set_timeout = meson_wdt_set_timeout,
+ .restart = meson_wdt_restart,
};
static int meson_wdt_probe(struct platform_device *pdev)
@@ -164,6 +159,7 @@ static int meson_wdt_probe(struct platform_device *pdev)
watchdog_init_timeout(&meson_wdt->wdt_dev, timeout, &pdev->dev);
watchdog_set_nowayout(&meson_wdt->wdt_dev, nowayout);
+ watchdog_set_restart_priority(&meson_wdt->wdt_dev, 128);
meson_wdt_stop(&meson_wdt->wdt_dev);
@@ -173,13 +169,6 @@ static int meson_wdt_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, meson_wdt);
- meson_wdt->restart_handler.notifier_call = meson_restart_handle;
- meson_wdt->restart_handler.priority = 128;
- err = register_restart_handler(&meson_wdt->restart_handler);
- if (err)
- dev_err(&pdev->dev,
- "cannot register restart handler (err=%d)\n", err);
-
dev_info(&pdev->dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)",
meson_wdt->wdt_dev.timeout, nowayout);
@@ -190,8 +179,6 @@ static int meson_wdt_remove(struct platform_device *pdev)
{
struct meson_wdt_dev *meson_wdt = platform_get_drvdata(pdev);
- unregister_restart_handler(&meson_wdt->restart_handler);
-
watchdog_unregister_device(&meson_wdt->wdt_dev);
return 0;
--
2.5.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 09/13] watchdog: moxart_wdt: use core restart handler
2015-11-03 16:12 [PATCH 00/13] watchdog: factorize restart handler registration Damien Riegel
` (7 preceding siblings ...)
2015-11-03 16:12 ` [PATCH 08/13] watchdog: meson_wdt: " Damien Riegel
@ 2015-11-03 16:12 ` Damien Riegel
2015-11-03 16:12 ` [PATCH 10/13] watchdog: mtk_wdt: " Damien Riegel
` (4 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Damien Riegel @ 2015-11-03 16:12 UTC (permalink / raw)
To: linux-watchdog
Cc: Wim Van Sebroeck, Guenter Roeck, Vivien Didelot, kernel,
Damien Riegel
Get rid of the custom restart handler by using the one provided by the
watchdog core.
Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/watchdog/moxart_wdt.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/watchdog/moxart_wdt.c b/drivers/watchdog/moxart_wdt.c
index 60b0605..885c81b 100644
--- a/drivers/watchdog/moxart_wdt.c
+++ b/drivers/watchdog/moxart_wdt.c
@@ -15,9 +15,7 @@
#include <linux/module.h>
#include <linux/err.h>
#include <linux/kernel.h>
-#include <linux/notifier.h>
#include <linux/platform_device.h>
-#include <linux/reboot.h>
#include <linux/watchdog.h>
#include <linux/moduleparam.h>
@@ -29,22 +27,19 @@ struct moxart_wdt_dev {
struct watchdog_device dev;
void __iomem *base;
unsigned int clock_frequency;
- struct notifier_block restart_handler;
};
static int heartbeat;
-static int moxart_restart_handle(struct notifier_block *this,
- unsigned long mode, void *cmd)
+static int moxart_wdt_restart(struct watchdog_device *wdt_dev)
{
- struct moxart_wdt_dev *moxart_wdt = container_of(this,
- struct moxart_wdt_dev,
- restart_handler);
+ struct moxart_wdt_dev *moxart_wdt = watchdog_get_drvdata(wdt_dev);
+
writel(1, moxart_wdt->base + REG_COUNT);
writel(0x5ab9, moxart_wdt->base + REG_MODE);
writel(0x03, moxart_wdt->base + REG_ENABLE);
- return NOTIFY_DONE;
+ return 0;
}
static int moxart_wdt_stop(struct watchdog_device *wdt_dev)
@@ -87,6 +82,7 @@ static const struct watchdog_ops moxart_wdt_ops = {
.start = moxart_wdt_start,
.stop = moxart_wdt_stop,
.set_timeout = moxart_wdt_set_timeout,
+ .restart = moxart_wdt_restart,
};
static int moxart_wdt_probe(struct platform_device *pdev)
@@ -134,6 +130,7 @@ static int moxart_wdt_probe(struct platform_device *pdev)
watchdog_init_timeout(&moxart_wdt->dev, heartbeat, dev);
watchdog_set_nowayout(&moxart_wdt->dev, nowayout);
+ watchdog_set_restart_priority(&moxart_wdt->dev, 128);
watchdog_set_drvdata(&moxart_wdt->dev, moxart_wdt);
@@ -141,13 +138,6 @@ static int moxart_wdt_probe(struct platform_device *pdev)
if (err)
return err;
- moxart_wdt->restart_handler.notifier_call = moxart_restart_handle;
- moxart_wdt->restart_handler.priority = 128;
- err = register_restart_handler(&moxart_wdt->restart_handler);
- if (err)
- dev_err(dev, "cannot register restart notifier (err=%d)\n",
- err);
-
dev_dbg(dev, "Watchdog enabled (heartbeat=%d sec, nowayout=%d)\n",
moxart_wdt->dev.timeout, nowayout);
@@ -158,7 +148,6 @@ static int moxart_wdt_remove(struct platform_device *pdev)
{
struct moxart_wdt_dev *moxart_wdt = platform_get_drvdata(pdev);
- unregister_restart_handler(&moxart_wdt->restart_handler);
moxart_wdt_stop(&moxart_wdt->dev);
return 0;
--
2.5.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 10/13] watchdog: mtk_wdt: use core restart handler
2015-11-03 16:12 [PATCH 00/13] watchdog: factorize restart handler registration Damien Riegel
` (8 preceding siblings ...)
2015-11-03 16:12 ` [PATCH 09/13] watchdog: moxart_wdt: " Damien Riegel
@ 2015-11-03 16:12 ` Damien Riegel
2015-11-03 16:12 ` [PATCH 11/13] watchdog: qcom-wdt: " Damien Riegel
` (3 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Damien Riegel @ 2015-11-03 16:12 UTC (permalink / raw)
To: linux-watchdog
Cc: Wim Van Sebroeck, Guenter Roeck, Vivien Didelot, kernel,
Damien Riegel
Get rid of the custom restart handler by using the one provided by the
watchdog core.
Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/watchdog/mtk_wdt.c | 22 +++++-----------------
1 file changed, 5 insertions(+), 17 deletions(-)
diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index 6ad9df9..338bd3c 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -28,8 +28,6 @@
#include <linux/platform_device.h>
#include <linux/types.h>
#include <linux/watchdog.h>
-#include <linux/notifier.h>
-#include <linux/reboot.h>
#include <linux/delay.h>
#define WDT_MAX_TIMEOUT 31
@@ -64,16 +62,13 @@ static unsigned int timeout = WDT_MAX_TIMEOUT;
struct mtk_wdt_dev {
struct watchdog_device wdt_dev;
void __iomem *wdt_base;
- struct notifier_block restart_handler;
};
-static int mtk_reset_handler(struct notifier_block *this, unsigned long mode,
- void *cmd)
+static int mtk_wdt_restart(struct watchdog_device *wdt_dev)
{
- struct mtk_wdt_dev *mtk_wdt;
+ struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev);
void __iomem *wdt_base;
- mtk_wdt = container_of(this, struct mtk_wdt_dev, restart_handler);
wdt_base = mtk_wdt->wdt_base;
while (1) {
@@ -81,7 +76,7 @@ static int mtk_reset_handler(struct notifier_block *this, unsigned long mode,
mdelay(5);
}
- return NOTIFY_DONE;
+ return 0;
}
static int mtk_wdt_ping(struct watchdog_device *wdt_dev)
@@ -160,6 +155,7 @@ static const struct watchdog_ops mtk_wdt_ops = {
.stop = mtk_wdt_stop,
.ping = mtk_wdt_ping,
.set_timeout = mtk_wdt_set_timeout,
+ .restart = mtk_wdt_restart,
};
static int mtk_wdt_probe(struct platform_device *pdev)
@@ -188,6 +184,7 @@ static int mtk_wdt_probe(struct platform_device *pdev)
watchdog_init_timeout(&mtk_wdt->wdt_dev, timeout, &pdev->dev);
watchdog_set_nowayout(&mtk_wdt->wdt_dev, nowayout);
+ watchdog_set_restart_priority(&mtk_wdt->wdt_dev, 128);
watchdog_set_drvdata(&mtk_wdt->wdt_dev, mtk_wdt);
@@ -197,13 +194,6 @@ static int mtk_wdt_probe(struct platform_device *pdev)
if (unlikely(err))
return err;
- mtk_wdt->restart_handler.notifier_call = mtk_reset_handler;
- mtk_wdt->restart_handler.priority = 128;
- err = register_restart_handler(&mtk_wdt->restart_handler);
- if (err)
- dev_warn(&pdev->dev,
- "cannot register restart handler (err=%d)\n", err);
-
dev_info(&pdev->dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)\n",
mtk_wdt->wdt_dev.timeout, nowayout);
@@ -222,8 +212,6 @@ static int mtk_wdt_remove(struct platform_device *pdev)
{
struct mtk_wdt_dev *mtk_wdt = platform_get_drvdata(pdev);
- unregister_restart_handler(&mtk_wdt->restart_handler);
-
watchdog_unregister_device(&mtk_wdt->wdt_dev);
return 0;
--
2.5.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 11/13] watchdog: qcom-wdt: use core restart handler
2015-11-03 16:12 [PATCH 00/13] watchdog: factorize restart handler registration Damien Riegel
` (9 preceding siblings ...)
2015-11-03 16:12 ` [PATCH 10/13] watchdog: mtk_wdt: " Damien Riegel
@ 2015-11-03 16:12 ` Damien Riegel
2015-11-03 16:12 ` [PATCH 12/13] watchdog: s3c2410_wdt: " Damien Riegel
` (2 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Damien Riegel @ 2015-11-03 16:12 UTC (permalink / raw)
To: linux-watchdog
Cc: Wim Van Sebroeck, Guenter Roeck, Vivien Didelot, kernel,
Damien Riegel
Get rid of the custom restart handler by using the one provided by the
watchdog core.
Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/watchdog/qcom-wdt.c | 63 +++++++++++++++++++--------------------------
1 file changed, 26 insertions(+), 37 deletions(-)
diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c
index 773dcfa..aa7105d 100644
--- a/drivers/watchdog/qcom-wdt.c
+++ b/drivers/watchdog/qcom-wdt.c
@@ -17,7 +17,6 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
-#include <linux/reboot.h>
#include <linux/watchdog.h>
#define WDT_RST 0x38
@@ -28,7 +27,6 @@ struct qcom_wdt {
struct watchdog_device wdd;
struct clk *clk;
unsigned long rate;
- struct notifier_block restart_nb;
void __iomem *base;
};
@@ -72,11 +70,37 @@ static int qcom_wdt_set_timeout(struct watchdog_device *wdd,
return qcom_wdt_start(wdd);
}
+static int qcom_wdt_restart(struct watchdog_device *wdd)
+{
+ struct qcom_wdt *wdt = to_qcom_wdt(wdd);
+ u32 timeout;
+
+ /*
+ * Trigger watchdog bite:
+ * Setup BITE_TIME to be 128ms, and enable WDT.
+ */
+ timeout = 128 * wdt->rate / 1000;
+
+ writel(0, wdt->base + WDT_EN);
+ writel(1, wdt->base + WDT_RST);
+ writel(timeout, wdt->base + WDT_BITE_TIME);
+ writel(1, wdt->base + WDT_EN);
+
+ /*
+ * Actually make sure the above sequence hits hardware before sleeping.
+ */
+ wmb();
+
+ msleep(150);
+ return 0;
+}
+
static const struct watchdog_ops qcom_wdt_ops = {
.start = qcom_wdt_start,
.stop = qcom_wdt_stop,
.ping = qcom_wdt_ping,
.set_timeout = qcom_wdt_set_timeout,
+ .restart = qcom_wdt_restart,
.owner = THIS_MODULE,
};
@@ -87,32 +111,6 @@ static const struct watchdog_info qcom_wdt_info = {
.identity = KBUILD_MODNAME,
};
-static int qcom_wdt_restart(struct notifier_block *nb, unsigned long action,
- void *data)
-{
- struct qcom_wdt *wdt = container_of(nb, struct qcom_wdt, restart_nb);
- u32 timeout;
-
- /*
- * Trigger watchdog bite:
- * Setup BITE_TIME to be 128ms, and enable WDT.
- */
- timeout = 128 * wdt->rate / 1000;
-
- writel(0, wdt->base + WDT_EN);
- writel(1, wdt->base + WDT_RST);
- writel(timeout, wdt->base + WDT_BITE_TIME);
- writel(1, wdt->base + WDT_EN);
-
- /*
- * Actually make sure the above sequence hits hardware before sleeping.
- */
- wmb();
-
- msleep(150);
- return NOTIFY_DONE;
-}
-
static int qcom_wdt_probe(struct platform_device *pdev)
{
struct qcom_wdt *wdt;
@@ -187,14 +185,6 @@ static int qcom_wdt_probe(struct platform_device *pdev)
goto err_clk_unprepare;
}
- /*
- * WDT restart notifier has priority 0 (use as a last resort)
- */
- wdt->restart_nb.notifier_call = qcom_wdt_restart;
- ret = register_restart_handler(&wdt->restart_nb);
- if (ret)
- dev_err(&pdev->dev, "failed to setup restart handler\n");
-
platform_set_drvdata(pdev, wdt);
return 0;
@@ -207,7 +197,6 @@ static int qcom_wdt_remove(struct platform_device *pdev)
{
struct qcom_wdt *wdt = platform_get_drvdata(pdev);
- unregister_restart_handler(&wdt->restart_nb);
watchdog_unregister_device(&wdt->wdd);
clk_disable_unprepare(wdt->clk);
return 0;
--
2.5.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 12/13] watchdog: s3c2410_wdt: use core restart handler
2015-11-03 16:12 [PATCH 00/13] watchdog: factorize restart handler registration Damien Riegel
` (10 preceding siblings ...)
2015-11-03 16:12 ` [PATCH 11/13] watchdog: qcom-wdt: " Damien Riegel
@ 2015-11-03 16:12 ` Damien Riegel
2015-11-03 16:12 ` [PATCH 13/13] watchdog: sunxi_wdt: " Damien Riegel
2015-11-03 18:08 ` [PATCH 00/13] watchdog: factorize restart handler registration Guenter Roeck
13 siblings, 0 replies; 18+ messages in thread
From: Damien Riegel @ 2015-11-03 16:12 UTC (permalink / raw)
To: linux-watchdog
Cc: Wim Van Sebroeck, Guenter Roeck, Vivien Didelot, kernel,
Damien Riegel
Get rid of the custom restart handler by using the one provided by the
watchdog core.
Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/watchdog/s3c2410_wdt.c | 60 ++++++++++++++++++------------------------
1 file changed, 25 insertions(+), 35 deletions(-)
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index d781000..0093450 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -41,7 +41,6 @@
#include <linux/of.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
-#include <linux/reboot.h>
#include <linux/delay.h>
#define S3C2410_WTCON 0x00
@@ -130,7 +129,6 @@ struct s3c2410_wdt {
unsigned long wtdat_save;
struct watchdog_device wdt_device;
struct notifier_block freq_transition;
- struct notifier_block restart_handler;
struct s3c2410_wdt_variant *drv_data;
struct regmap *pmureg;
};
@@ -351,6 +349,29 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd, unsigned timeou
return 0;
}
+static int s3c2410wdt_restart(struct watchdog_device *wdd)
+{
+ struct s3c2410_wdt *wdt = watchdog_get_drvdata(wdd);
+ void __iomem *wdt_base = wdt->reg_base;
+
+ /* disable watchdog, to be safe */
+ writel(0, wdt_base + S3C2410_WTCON);
+
+ /* put initial values into count and data */
+ writel(0x80, wdt_base + S3C2410_WTCNT);
+ writel(0x80, wdt_base + S3C2410_WTDAT);
+
+ /* set the watchdog to go and reset... */
+ writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV16 |
+ S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x20),
+ wdt_base + S3C2410_WTCON);
+
+ /* wait for reset to assert... */
+ mdelay(500);
+
+ return 0;
+}
+
#define OPTIONS (WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE)
static const struct watchdog_info s3c2410_wdt_ident = {
@@ -365,6 +386,7 @@ static struct watchdog_ops s3c2410wdt_ops = {
.stop = s3c2410wdt_stop,
.ping = s3c2410wdt_keepalive,
.set_timeout = s3c2410wdt_set_heartbeat,
+ .restart = s3c2410wdt_restart,
};
static struct watchdog_device s3c2410_wdd = {
@@ -452,31 +474,6 @@ static inline void s3c2410wdt_cpufreq_deregister(struct s3c2410_wdt *wdt)
}
#endif
-static int s3c2410wdt_restart(struct notifier_block *this,
- unsigned long mode, void *cmd)
-{
- struct s3c2410_wdt *wdt = container_of(this, struct s3c2410_wdt,
- restart_handler);
- void __iomem *wdt_base = wdt->reg_base;
-
- /* disable watchdog, to be safe */
- writel(0, wdt_base + S3C2410_WTCON);
-
- /* put initial values into count and data */
- writel(0x80, wdt_base + S3C2410_WTCNT);
- writel(0x80, wdt_base + S3C2410_WTDAT);
-
- /* set the watchdog to go and reset... */
- writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV16 |
- S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x20),
- wdt_base + S3C2410_WTCON);
-
- /* wait for reset to assert... */
- mdelay(500);
-
- return NOTIFY_DONE;
-}
-
static inline unsigned int s3c2410wdt_get_bootstatus(struct s3c2410_wdt *wdt)
{
unsigned int rst_stat;
@@ -605,6 +602,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
}
watchdog_set_nowayout(&wdt->wdt_device, nowayout);
+ watchdog_set_restart_priority(&wdt->wdt_device, 128);
wdt->wdt_device.bootstatus = s3c2410wdt_get_bootstatus(wdt);
wdt->wdt_device.parent = &pdev->dev;
@@ -632,12 +630,6 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, wdt);
- wdt->restart_handler.notifier_call = s3c2410wdt_restart;
- wdt->restart_handler.priority = 128;
- ret = register_restart_handler(&wdt->restart_handler);
- if (ret)
- pr_err("cannot register restart handler, %d\n", ret);
-
/* print out a statement of readiness */
wtcon = readl(wdt->reg_base + S3C2410_WTCON);
@@ -667,8 +659,6 @@ static int s3c2410wdt_remove(struct platform_device *dev)
int ret;
struct s3c2410_wdt *wdt = platform_get_drvdata(dev);
- unregister_restart_handler(&wdt->restart_handler);
-
ret = s3c2410wdt_mask_and_disable_reset(wdt, true);
if (ret < 0)
return ret;
--
2.5.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 13/13] watchdog: sunxi_wdt: use core restart handler
2015-11-03 16:12 [PATCH 00/13] watchdog: factorize restart handler registration Damien Riegel
` (11 preceding siblings ...)
2015-11-03 16:12 ` [PATCH 12/13] watchdog: s3c2410_wdt: " Damien Riegel
@ 2015-11-03 16:12 ` Damien Riegel
2015-11-03 18:08 ` [PATCH 00/13] watchdog: factorize restart handler registration Guenter Roeck
13 siblings, 0 replies; 18+ messages in thread
From: Damien Riegel @ 2015-11-03 16:12 UTC (permalink / raw)
To: linux-watchdog
Cc: Wim Van Sebroeck, Guenter Roeck, Vivien Didelot, kernel,
Damien Riegel
Get rid of the custom restart handler by using the one provided by the
watchdog core.
Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
drivers/watchdog/sunxi_wdt.c | 23 +++++------------------
1 file changed, 5 insertions(+), 18 deletions(-)
diff --git a/drivers/watchdog/sunxi_wdt.c b/drivers/watchdog/sunxi_wdt.c
index 47bd8a1..e027deb 100644
--- a/drivers/watchdog/sunxi_wdt.c
+++ b/drivers/watchdog/sunxi_wdt.c
@@ -21,11 +21,9 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
-#include <linux/notifier.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
-#include <linux/reboot.h>
#include <linux/types.h>
#include <linux/watchdog.h>
@@ -60,7 +58,6 @@ struct sunxi_wdt_dev {
struct watchdog_device wdt_dev;
void __iomem *wdt_base;
const struct sunxi_wdt_reg *wdt_regs;
- struct notifier_block restart_handler;
};
/*
@@ -86,12 +83,9 @@ static const int wdt_timeout_map[] = {
};
-static int sunxi_restart_handle(struct notifier_block *this, unsigned long mode,
- void *cmd)
+static int sunxi_wdt_restart(struct watchdog_device *wdt_dev)
{
- struct sunxi_wdt_dev *sunxi_wdt = container_of(this,
- struct sunxi_wdt_dev,
- restart_handler);
+ struct sunxi_wdt_dev *sunxi_wdt = watchdog_get_drvdata(wdt_dev);
void __iomem *wdt_base = sunxi_wdt->wdt_base;
const struct sunxi_wdt_reg *regs = sunxi_wdt->wdt_regs;
u32 val;
@@ -120,7 +114,7 @@ static int sunxi_restart_handle(struct notifier_block *this, unsigned long mode,
val |= WDT_MODE_EN;
writel(val, wdt_base + regs->wdt_mode);
}
- return NOTIFY_DONE;
+ return 0;
}
static int sunxi_wdt_ping(struct watchdog_device *wdt_dev)
@@ -208,6 +202,7 @@ static const struct watchdog_ops sunxi_wdt_ops = {
.stop = sunxi_wdt_stop,
.ping = sunxi_wdt_ping,
.set_timeout = sunxi_wdt_set_timeout,
+ .restart = sunxi_wdt_restart,
};
static const struct sunxi_wdt_reg sun4i_wdt_reg = {
@@ -268,6 +263,7 @@ static int sunxi_wdt_probe(struct platform_device *pdev)
watchdog_init_timeout(&sunxi_wdt->wdt_dev, timeout, &pdev->dev);
watchdog_set_nowayout(&sunxi_wdt->wdt_dev, nowayout);
+ watchdog_set_restart_priority(&sunxi_wdt->wdt_dev, 128);
watchdog_set_drvdata(&sunxi_wdt->wdt_dev, sunxi_wdt);
@@ -277,13 +273,6 @@ static int sunxi_wdt_probe(struct platform_device *pdev)
if (unlikely(err))
return err;
- sunxi_wdt->restart_handler.notifier_call = sunxi_restart_handle;
- sunxi_wdt->restart_handler.priority = 128;
- err = register_restart_handler(&sunxi_wdt->restart_handler);
- if (err)
- dev_err(&pdev->dev,
- "cannot register restart handler (err=%d)\n", err);
-
dev_info(&pdev->dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)",
sunxi_wdt->wdt_dev.timeout, nowayout);
@@ -294,8 +283,6 @@ static int sunxi_wdt_remove(struct platform_device *pdev)
{
struct sunxi_wdt_dev *sunxi_wdt = platform_get_drvdata(pdev);
- unregister_restart_handler(&sunxi_wdt->restart_handler);
-
watchdog_unregister_device(&sunxi_wdt->wdt_dev);
watchdog_set_drvdata(&sunxi_wdt->wdt_dev, NULL);
--
2.5.0
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH 00/13] watchdog: factorize restart handler registration
2015-11-03 16:12 [PATCH 00/13] watchdog: factorize restart handler registration Damien Riegel
` (12 preceding siblings ...)
2015-11-03 16:12 ` [PATCH 13/13] watchdog: sunxi_wdt: " Damien Riegel
@ 2015-11-03 18:08 ` Guenter Roeck
2015-11-03 18:19 ` Vivien Didelot
2015-11-03 20:10 ` Damien Riegel
13 siblings, 2 replies; 18+ messages in thread
From: Guenter Roeck @ 2015-11-03 18:08 UTC (permalink / raw)
To: Damien Riegel, linux-watchdog; +Cc: Wim Van Sebroeck, Vivien Didelot, kernel
On 11/03/2015 08:12 AM, Damien Riegel wrote:
> Many drivers implements the exact same piece of code to register a
> restart handler. It can be nice to factorize this in the watchdog core.
>
> The first patch adds an optional restart watchdog operation. If a driver
> defines this operation, a restart handler is registered. By default, the
> restart handler priority is set to 0, but a helper function
> watchdog_set_restart_priority is provided to change it.
>
> The following patches bring this change to the current watchdog drivers
> that use watchdog_core.
>
> This change has been compile-tested on da9063, imx2, lpc18xx, imgpdc.
> It has been tested with (not mainlined yet) ts-4800's watchdog driver.
>
> Damien Riegel (13):
> watchdog: core: add restart handler support
> watchdog: bcm47xx_wdt: use core restart handler
> watchdog: da9063_wdt: use core restart handler
> watchdog: digicolor_wdt: use core restart handler
> watchdog: imgpdc_wdt: use core restart handler
> watchdog: imx2_wdt: use core restart handler
> watchdog: lpc18xx_wdt: use core restart handler
> watchdog: meson_wdt: use core restart handler
> watchdog: moxart_wdt: use core restart handler
> watchdog: mtk_wdt: use core restart handler
> watchdog: qcom-wdt: use core restart handler
> watchdog: s3c2410_wdt: use core restart handler
> watchdog: sunxi_wdt: use core restart handler
>
Damien,
"v2" in the subject line as well as a change log would have been appreciated.
You are making it (hopefully not intentionally) difficult for maintainers
to separate v1 from v2. You might want to keep in mind that maintainers are
in general quite busy and might thus be a bit annoyed about such additional
(and unnecessary) work.
Thanks,
Guenter
> Documentation/watchdog/watchdog-kernel-api.txt | 19 +++++++
> drivers/watchdog/bcm47xx_wdt.c | 21 +++-----
> drivers/watchdog/da9063_wdt.c | 23 +++------
> drivers/watchdog/digicolor_wdt.c | 18 ++-----
> drivers/watchdog/imgpdc_wdt.c | 34 +++++--------
> drivers/watchdog/imx2_wdt.c | 23 +++------
> drivers/watchdog/lpc18xx_wdt.c | 68 +++++++++++---------------
> drivers/watchdog/meson_wdt.c | 23 ++-------
> drivers/watchdog/moxart_wdt.c | 23 +++------
> drivers/watchdog/mtk_wdt.c | 22 ++-------
> drivers/watchdog/qcom-wdt.c | 63 ++++++++++--------------
> drivers/watchdog/s3c2410_wdt.c | 60 ++++++++++-------------
> drivers/watchdog/sunxi_wdt.c | 23 ++-------
> drivers/watchdog/watchdog_core.c | 48 ++++++++++++++++++
> include/linux/bcm47xx_wdt.h | 1 -
> include/linux/watchdog.h | 6 +++
> 16 files changed, 210 insertions(+), 265 deletions(-)
>
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 00/13] watchdog: factorize restart handler registration
2015-11-03 18:08 ` [PATCH 00/13] watchdog: factorize restart handler registration Guenter Roeck
@ 2015-11-03 18:19 ` Vivien Didelot
2015-11-03 20:10 ` Damien Riegel
1 sibling, 0 replies; 18+ messages in thread
From: Vivien Didelot @ 2015-11-03 18:19 UTC (permalink / raw)
To: Guenter Roeck; +Cc: Damien Riegel, linux-watchdog, Wim Van Sebroeck, kernel
On Nov. Tuesday 03 (45) 10:08 AM, Guenter Roeck wrote:
> On 11/03/2015 08:12 AM, Damien Riegel wrote:
> >Many drivers implements the exact same piece of code to register a
> >restart handler. It can be nice to factorize this in the watchdog core.
> >
> >The first patch adds an optional restart watchdog operation. If a driver
> >defines this operation, a restart handler is registered. By default, the
> >restart handler priority is set to 0, but a helper function
> >watchdog_set_restart_priority is provided to change it.
> >
> >The following patches bring this change to the current watchdog drivers
> >that use watchdog_core.
> >
> >This change has been compile-tested on da9063, imx2, lpc18xx, imgpdc.
> >It has been tested with (not mainlined yet) ts-4800's watchdog driver.
> >
> >Damien Riegel (13):
> > watchdog: core: add restart handler support
> > watchdog: bcm47xx_wdt: use core restart handler
> > watchdog: da9063_wdt: use core restart handler
> > watchdog: digicolor_wdt: use core restart handler
> > watchdog: imgpdc_wdt: use core restart handler
> > watchdog: imx2_wdt: use core restart handler
> > watchdog: lpc18xx_wdt: use core restart handler
> > watchdog: meson_wdt: use core restart handler
> > watchdog: moxart_wdt: use core restart handler
> > watchdog: mtk_wdt: use core restart handler
> > watchdog: qcom-wdt: use core restart handler
> > watchdog: s3c2410_wdt: use core restart handler
> > watchdog: sunxi_wdt: use core restart handler
> >
>
> Damien,
>
> "v2" in the subject line as well as a change log would have been appreciated.
> You are making it (hopefully not intentionally) difficult for maintainers
> to separate v1 from v2. You might want to keep in mind that maintainers are
> in general quite busy and might thus be a bit annoyed about such additional
> (and unnecessary) work.
Hi Guenter,
I assume the shot here. I suggested no subject prefix, since the first
patchset was RFC. Should we use "v2" even after an RFC? Or "v1" maybe?
Sorry about that,
-v
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 00/13] watchdog: factorize restart handler registration
2015-11-03 18:08 ` [PATCH 00/13] watchdog: factorize restart handler registration Guenter Roeck
2015-11-03 18:19 ` Vivien Didelot
@ 2015-11-03 20:10 ` Damien Riegel
2015-11-03 21:10 ` Guenter Roeck
1 sibling, 1 reply; 18+ messages in thread
From: Damien Riegel @ 2015-11-03 20:10 UTC (permalink / raw)
To: Guenter Roeck; +Cc: linux-watchdog, Wim Van Sebroeck, Vivien Didelot, kernel
On Tue, Nov 03, 2015 at 10:08:18AM -0800, Guenter Roeck wrote:
> On 11/03/2015 08:12 AM, Damien Riegel wrote:
> >Many drivers implements the exact same piece of code to register a
> >restart handler. It can be nice to factorize this in the watchdog core.
> >
> >The first patch adds an optional restart watchdog operation. If a driver
> >defines this operation, a restart handler is registered. By default, the
> >restart handler priority is set to 0, but a helper function
> >watchdog_set_restart_priority is provided to change it.
> >
> >The following patches bring this change to the current watchdog drivers
> >that use watchdog_core.
> >
> >This change has been compile-tested on da9063, imx2, lpc18xx, imgpdc.
> >It has been tested with (not mainlined yet) ts-4800's watchdog driver.
> >
> >Damien Riegel (13):
> > watchdog: core: add restart handler support
> > watchdog: bcm47xx_wdt: use core restart handler
> > watchdog: da9063_wdt: use core restart handler
> > watchdog: digicolor_wdt: use core restart handler
> > watchdog: imgpdc_wdt: use core restart handler
> > watchdog: imx2_wdt: use core restart handler
> > watchdog: lpc18xx_wdt: use core restart handler
> > watchdog: meson_wdt: use core restart handler
> > watchdog: moxart_wdt: use core restart handler
> > watchdog: mtk_wdt: use core restart handler
> > watchdog: qcom-wdt: use core restart handler
> > watchdog: s3c2410_wdt: use core restart handler
> > watchdog: sunxi_wdt: use core restart handler
> >
>
> Damien,
>
> "v2" in the subject line as well as a change log would have been appreciated.
> You are making it (hopefully not intentionally) difficult for maintainers
> to separate v1 from v2. You might want to keep in mind that maintainers are
> in general quite busy and might thus be a bit annoyed about such additional
> (and unnecessary) work.
Sorry for the inconvenience, I assumed it was correct to send the
patchset as a v1 since the previous one was a RFC. Do you want me to
resend this serie as a v2 with a changelog ?
Damien
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 00/13] watchdog: factorize restart handler registration
2015-11-03 20:10 ` Damien Riegel
@ 2015-11-03 21:10 ` Guenter Roeck
0 siblings, 0 replies; 18+ messages in thread
From: Guenter Roeck @ 2015-11-03 21:10 UTC (permalink / raw)
To: Damien Riegel; +Cc: linux-watchdog, Wim Van Sebroeck, Vivien Didelot, kernel
On Tue, Nov 03, 2015 at 03:10:09PM -0500, Damien Riegel wrote:
> On Tue, Nov 03, 2015 at 10:08:18AM -0800, Guenter Roeck wrote:
> > On 11/03/2015 08:12 AM, Damien Riegel wrote:
> > >Many drivers implements the exact same piece of code to register a
> > >restart handler. It can be nice to factorize this in the watchdog core.
> > >
> > >The first patch adds an optional restart watchdog operation. If a driver
> > >defines this operation, a restart handler is registered. By default, the
> > >restart handler priority is set to 0, but a helper function
> > >watchdog_set_restart_priority is provided to change it.
> > >
> > >The following patches bring this change to the current watchdog drivers
> > >that use watchdog_core.
> > >
> > >This change has been compile-tested on da9063, imx2, lpc18xx, imgpdc.
> > >It has been tested with (not mainlined yet) ts-4800's watchdog driver.
> > >
> > >Damien Riegel (13):
> > > watchdog: core: add restart handler support
> > > watchdog: bcm47xx_wdt: use core restart handler
> > > watchdog: da9063_wdt: use core restart handler
> > > watchdog: digicolor_wdt: use core restart handler
> > > watchdog: imgpdc_wdt: use core restart handler
> > > watchdog: imx2_wdt: use core restart handler
> > > watchdog: lpc18xx_wdt: use core restart handler
> > > watchdog: meson_wdt: use core restart handler
> > > watchdog: moxart_wdt: use core restart handler
> > > watchdog: mtk_wdt: use core restart handler
> > > watchdog: qcom-wdt: use core restart handler
> > > watchdog: s3c2410_wdt: use core restart handler
> > > watchdog: sunxi_wdt: use core restart handler
> > >
> >
> > Damien,
> >
> > "v2" in the subject line as well as a change log would have been appreciated.
> > You are making it (hopefully not intentionally) difficult for maintainers
> > to separate v1 from v2. You might want to keep in mind that maintainers are
> > in general quite busy and might thus be a bit annoyed about such additional
> > (and unnecessary) work.
>
> Sorry for the inconvenience, I assumed it was correct to send the
> patchset as a v1 since the previous one was a RFC. Do you want me to
> resend this serie as a v2 with a changelog ?
>
No, that would cause even more confusion.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 18+ messages in thread