pretimeout_panic.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (C) 2015-2016 Mentor Graphics
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/module.h>
  12. #include <linux/watchdog.h>
  13. #include "watchdog_pretimeout.h"
  14. /**
  15. * pretimeout_panic - Panic on watchdog pretimeout event
  16. * @wdd - watchdog_device
  17. *
  18. * Panic, watchdog has not been fed till pretimeout event.
  19. */
  20. static void pretimeout_panic(struct watchdog_device *wdd)
  21. {
  22. panic("watchdog pretimeout event\n");
  23. }
  24. static struct watchdog_governor watchdog_gov_panic = {
  25. .name = "panic",
  26. .pretimeout = pretimeout_panic,
  27. };
  28. static int __init watchdog_gov_panic_register(void)
  29. {
  30. return watchdog_register_governor(&watchdog_gov_panic);
  31. }
  32. static void __exit watchdog_gov_panic_unregister(void)
  33. {
  34. watchdog_unregister_governor(&watchdog_gov_panic);
  35. }
  36. module_init(watchdog_gov_panic_register);
  37. module_exit(watchdog_gov_panic_unregister);
  38. MODULE_AUTHOR("Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>");
  39. MODULE_DESCRIPTION("Panic watchdog pretimeout governor");
  40. MODULE_LICENSE("GPL");