pretimeout_noop.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Copyright (C) 2015-2016 Mentor Graphics
  4. */
  5. #include <linux/module.h>
  6. #include <linux/printk.h>
  7. #include <linux/watchdog.h>
  8. #include "watchdog_pretimeout.h"
  9. /**
  10. * pretimeout_noop - No operation on watchdog pretimeout event
  11. * @wdd - watchdog_device
  12. *
  13. * This function prints a message about pretimeout to kernel log.
  14. */
  15. static void pretimeout_noop(struct watchdog_device *wdd)
  16. {
  17. pr_alert("watchdog%d: pretimeout event\n", wdd->id);
  18. }
  19. static struct watchdog_governor watchdog_gov_noop = {
  20. .name = "noop",
  21. .pretimeout = pretimeout_noop,
  22. };
  23. static int __init watchdog_gov_noop_register(void)
  24. {
  25. return watchdog_register_governor(&watchdog_gov_noop);
  26. }
  27. static void __exit watchdog_gov_noop_unregister(void)
  28. {
  29. watchdog_unregister_governor(&watchdog_gov_noop);
  30. }
  31. module_init(watchdog_gov_noop_register);
  32. module_exit(watchdog_gov_noop_unregister);
  33. MODULE_AUTHOR("Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>");
  34. MODULE_DESCRIPTION("Panic watchdog pretimeout governor");
  35. MODULE_LICENSE("GPL");