ipq806x: set v4.9 as default
[openwrt/openwrt.git] / target / linux / ipq806x / patches-4.4 / 010-1-qcom-wdt-use-core-restart-handler.patch
1 From 80969a68ffed12f82e2a29908306ff43a6861a61 Mon Sep 17 00:00:00 2001
2 From: Damien Riegel <damien.riegel@savoirfairelinux.com>
3 Date: Mon, 16 Nov 2015 12:28:09 -0500
4 Subject: watchdog: qcom-wdt: use core restart handler
5
6 Get rid of the custom restart handler by using the one provided by the
7 watchdog core.
8
9 Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
10 Reviewed-by: Guenter Roeck <linux@roeck-us.net>
11 Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
12 Signed-off-by: Guenter Roeck <linux@roeck-us.net>
13 Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
14 ---
15 drivers/watchdog/qcom-wdt.c | 49 ++++++++++++++++++---------------------------
16 1 file changed, 19 insertions(+), 30 deletions(-)
17
18 --- a/drivers/watchdog/qcom-wdt.c
19 +++ b/drivers/watchdog/qcom-wdt.c
20 @@ -17,7 +17,6 @@
21 #include <linux/module.h>
22 #include <linux/of.h>
23 #include <linux/platform_device.h>
24 -#include <linux/reboot.h>
25 #include <linux/watchdog.h>
26
27 #define WDT_RST 0x38
28 @@ -28,7 +27,6 @@ struct qcom_wdt {
29 struct watchdog_device wdd;
30 struct clk *clk;
31 unsigned long rate;
32 - struct notifier_block restart_nb;
33 void __iomem *base;
34 };
35
36 @@ -72,25 +70,9 @@ static int qcom_wdt_set_timeout(struct w
37 return qcom_wdt_start(wdd);
38 }
39
40 -static const struct watchdog_ops qcom_wdt_ops = {
41 - .start = qcom_wdt_start,
42 - .stop = qcom_wdt_stop,
43 - .ping = qcom_wdt_ping,
44 - .set_timeout = qcom_wdt_set_timeout,
45 - .owner = THIS_MODULE,
46 -};
47 -
48 -static const struct watchdog_info qcom_wdt_info = {
49 - .options = WDIOF_KEEPALIVEPING
50 - | WDIOF_MAGICCLOSE
51 - | WDIOF_SETTIMEOUT,
52 - .identity = KBUILD_MODNAME,
53 -};
54 -
55 -static int qcom_wdt_restart(struct notifier_block *nb, unsigned long action,
56 - void *data)
57 +static int qcom_wdt_restart(struct watchdog_device *wdd)
58 {
59 - struct qcom_wdt *wdt = container_of(nb, struct qcom_wdt, restart_nb);
60 + struct qcom_wdt *wdt = to_qcom_wdt(wdd);
61 u32 timeout;
62
63 /*
64 @@ -110,9 +92,25 @@ static int qcom_wdt_restart(struct notif
65 wmb();
66
67 msleep(150);
68 - return NOTIFY_DONE;
69 + return 0;
70 }
71
72 +static const struct watchdog_ops qcom_wdt_ops = {
73 + .start = qcom_wdt_start,
74 + .stop = qcom_wdt_stop,
75 + .ping = qcom_wdt_ping,
76 + .set_timeout = qcom_wdt_set_timeout,
77 + .restart = qcom_wdt_restart,
78 + .owner = THIS_MODULE,
79 +};
80 +
81 +static const struct watchdog_info qcom_wdt_info = {
82 + .options = WDIOF_KEEPALIVEPING
83 + | WDIOF_MAGICCLOSE
84 + | WDIOF_SETTIMEOUT,
85 + .identity = KBUILD_MODNAME,
86 +};
87 +
88 static int qcom_wdt_probe(struct platform_device *pdev)
89 {
90 struct qcom_wdt *wdt;
91 @@ -187,14 +185,6 @@ static int qcom_wdt_probe(struct platfor
92 goto err_clk_unprepare;
93 }
94
95 - /*
96 - * WDT restart notifier has priority 0 (use as a last resort)
97 - */
98 - wdt->restart_nb.notifier_call = qcom_wdt_restart;
99 - ret = register_restart_handler(&wdt->restart_nb);
100 - if (ret)
101 - dev_err(&pdev->dev, "failed to setup restart handler\n");
102 -
103 platform_set_drvdata(pdev, wdt);
104 return 0;
105
106 @@ -207,7 +197,6 @@ static int qcom_wdt_remove(struct platfo
107 {
108 struct qcom_wdt *wdt = platform_get_drvdata(pdev);
109
110 - unregister_restart_handler(&wdt->restart_nb);
111 watchdog_unregister_device(&wdt->wdd);
112 clk_disable_unprepare(wdt->clk);
113 return 0;