diff options
Diffstat (limited to 'drivers/watchdog/qcom-wdt.c')
| -rw-r--r-- | drivers/watchdog/qcom-wdt.c | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c index 773dcfaee7b2..424f9a952fee 100644 --- a/drivers/watchdog/qcom-wdt.c +++ b/drivers/watchdog/qcom-wdt.c | |||
| @@ -17,7 +17,6 @@ | |||
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/of.h> | 18 | #include <linux/of.h> |
| 19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
| 20 | #include <linux/reboot.h> | ||
| 21 | #include <linux/watchdog.h> | 20 | #include <linux/watchdog.h> |
| 22 | 21 | ||
| 23 | #define WDT_RST 0x38 | 22 | #define WDT_RST 0x38 |
| @@ -28,7 +27,6 @@ struct qcom_wdt { | |||
| 28 | struct watchdog_device wdd; | 27 | struct watchdog_device wdd; |
| 29 | struct clk *clk; | 28 | struct clk *clk; |
| 30 | unsigned long rate; | 29 | unsigned long rate; |
| 31 | struct notifier_block restart_nb; | ||
| 32 | void __iomem *base; | 30 | void __iomem *base; |
| 33 | }; | 31 | }; |
| 34 | 32 | ||
| @@ -72,25 +70,9 @@ static int qcom_wdt_set_timeout(struct watchdog_device *wdd, | |||
| 72 | return qcom_wdt_start(wdd); | 70 | return qcom_wdt_start(wdd); |
| 73 | } | 71 | } |
| 74 | 72 | ||
| 75 | static const struct watchdog_ops qcom_wdt_ops = { | 73 | static int qcom_wdt_restart(struct watchdog_device *wdd) |
| 76 | .start = qcom_wdt_start, | ||
| 77 | .stop = qcom_wdt_stop, | ||
| 78 | .ping = qcom_wdt_ping, | ||
| 79 | .set_timeout = qcom_wdt_set_timeout, | ||
| 80 | .owner = THIS_MODULE, | ||
| 81 | }; | ||
| 82 | |||
| 83 | static const struct watchdog_info qcom_wdt_info = { | ||
| 84 | .options = WDIOF_KEEPALIVEPING | ||
| 85 | | WDIOF_MAGICCLOSE | ||
| 86 | | WDIOF_SETTIMEOUT, | ||
| 87 | .identity = KBUILD_MODNAME, | ||
| 88 | }; | ||
| 89 | |||
| 90 | static int qcom_wdt_restart(struct notifier_block *nb, unsigned long action, | ||
| 91 | void *data) | ||
| 92 | { | 74 | { |
| 93 | struct qcom_wdt *wdt = container_of(nb, struct qcom_wdt, restart_nb); | 75 | struct qcom_wdt *wdt = to_qcom_wdt(wdd); |
| 94 | u32 timeout; | 76 | u32 timeout; |
| 95 | 77 | ||
| 96 | /* | 78 | /* |
| @@ -110,9 +92,25 @@ static int qcom_wdt_restart(struct notifier_block *nb, unsigned long action, | |||
| 110 | wmb(); | 92 | wmb(); |
| 111 | 93 | ||
| 112 | msleep(150); | 94 | msleep(150); |
| 113 | return NOTIFY_DONE; | 95 | return 0; |
| 114 | } | 96 | } |
| 115 | 97 | ||
| 98 | static const struct watchdog_ops qcom_wdt_ops = { | ||
| 99 | .start = qcom_wdt_start, | ||
| 100 | .stop = qcom_wdt_stop, | ||
| 101 | .ping = qcom_wdt_ping, | ||
| 102 | .set_timeout = qcom_wdt_set_timeout, | ||
| 103 | .restart = qcom_wdt_restart, | ||
| 104 | .owner = THIS_MODULE, | ||
| 105 | }; | ||
| 106 | |||
| 107 | static const struct watchdog_info qcom_wdt_info = { | ||
| 108 | .options = WDIOF_KEEPALIVEPING | ||
| 109 | | WDIOF_MAGICCLOSE | ||
| 110 | | WDIOF_SETTIMEOUT, | ||
| 111 | .identity = KBUILD_MODNAME, | ||
| 112 | }; | ||
| 113 | |||
| 116 | static int qcom_wdt_probe(struct platform_device *pdev) | 114 | static int qcom_wdt_probe(struct platform_device *pdev) |
| 117 | { | 115 | { |
| 118 | struct qcom_wdt *wdt; | 116 | struct qcom_wdt *wdt; |
| @@ -166,7 +164,6 @@ static int qcom_wdt_probe(struct platform_device *pdev) | |||
| 166 | goto err_clk_unprepare; | 164 | goto err_clk_unprepare; |
| 167 | } | 165 | } |
| 168 | 166 | ||
| 169 | wdt->wdd.dev = &pdev->dev; | ||
| 170 | wdt->wdd.info = &qcom_wdt_info; | 167 | wdt->wdd.info = &qcom_wdt_info; |
| 171 | wdt->wdd.ops = &qcom_wdt_ops; | 168 | wdt->wdd.ops = &qcom_wdt_ops; |
| 172 | wdt->wdd.min_timeout = 1; | 169 | wdt->wdd.min_timeout = 1; |
| @@ -187,14 +184,6 @@ static int qcom_wdt_probe(struct platform_device *pdev) | |||
| 187 | goto err_clk_unprepare; | 184 | goto err_clk_unprepare; |
| 188 | } | 185 | } |
| 189 | 186 | ||
| 190 | /* | ||
| 191 | * WDT restart notifier has priority 0 (use as a last resort) | ||
| 192 | */ | ||
| 193 | wdt->restart_nb.notifier_call = qcom_wdt_restart; | ||
| 194 | ret = register_restart_handler(&wdt->restart_nb); | ||
| 195 | if (ret) | ||
| 196 | dev_err(&pdev->dev, "failed to setup restart handler\n"); | ||
| 197 | |||
| 198 | platform_set_drvdata(pdev, wdt); | 187 | platform_set_drvdata(pdev, wdt); |
| 199 | return 0; | 188 | return 0; |
| 200 | 189 | ||
| @@ -207,7 +196,6 @@ static int qcom_wdt_remove(struct platform_device *pdev) | |||
| 207 | { | 196 | { |
| 208 | struct qcom_wdt *wdt = platform_get_drvdata(pdev); | 197 | struct qcom_wdt *wdt = platform_get_drvdata(pdev); |
| 209 | 198 | ||
| 210 | unregister_restart_handler(&wdt->restart_nb); | ||
| 211 | watchdog_unregister_device(&wdt->wdd); | 199 | watchdog_unregister_device(&wdt->wdd); |
| 212 | clk_disable_unprepare(wdt->clk); | 200 | clk_disable_unprepare(wdt->clk); |
| 213 | return 0; | 201 | return 0; |
