pretimeout_panic.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Copyright (C) 2015-2016 Mentor Graphics
  4. */
  5. #include <linux/kernel.h>
  6. #include <linux/module.h>
  7. #include <linux/watchdog.h>
  8. #include "watchdog_pretimeout.h"
  9. /**
  10. * pretimeout_panic - Panic on watchdog pretimeout event
  11. * @wdd - watchdog_device
  12. *
  13. * Panic, watchdog has not been fed till pretimeout event.
  14. */
  15. static void pretimeout_panic(struct watchdog_device *wdd)
  16. {
  17. panic("watchdog pretimeout event\n");
  18. }
  19. static struct watchdog_governor watchdog_gov_panic = {
  20. .name = "panic",
  21. .pretimeout = pretimeout_panic,
  22. };
  23. static int __init watchdog_gov_panic_register(void)
  24. {
  25. return watchdog_register_governor(&watchdog_gov_panic);
  26. }
  27. static void __exit watchdog_gov_panic_unregister(void)
  28. {
  29. watchdog_unregister_governor(&watchdog_gov_panic);
  30. }
  31. module_init(watchdog_gov_panic_register);
  32. module_exit(watchdog_gov_panic_unregister);
  33. MODULE_AUTHOR("Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>");
  34. MODULE_DESCRIPTION("Panic watchdog pretimeout governor");
  35. MODULE_LICENSE("GPL");