010-1-qcom-wdt-use-core-restart-handler.patch 3.1 KB

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