Vladimir Zapolskiy | da0d12f | 2016-10-07 15:39:56 +0300 | [diff] [blame] | 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 | |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/module.h> |
| 13 | #include <linux/watchdog.h> |
| 14 | |
| 15 | #include "watchdog_pretimeout.h" |
| 16 | |
| 17 | /** |
| 18 | * pretimeout_panic - Panic on watchdog pretimeout event |
| 19 | * @wdd - watchdog_device |
| 20 | * |
| 21 | * Panic, watchdog has not been fed till pretimeout event. |
| 22 | */ |
| 23 | static void pretimeout_panic(struct watchdog_device *wdd) |
| 24 | { |
| 25 | panic("watchdog pretimeout event\n"); |
| 26 | } |
| 27 | |
| 28 | static struct watchdog_governor watchdog_gov_panic = { |
| 29 | .name = "panic", |
| 30 | .pretimeout = pretimeout_panic, |
| 31 | }; |
| 32 | |
| 33 | static int __init watchdog_gov_panic_register(void) |
| 34 | { |
| 35 | return watchdog_register_governor(&watchdog_gov_panic); |
| 36 | } |
| 37 | |
| 38 | static void __exit watchdog_gov_panic_unregister(void) |
| 39 | { |
| 40 | watchdog_unregister_governor(&watchdog_gov_panic); |
| 41 | } |
| 42 | module_init(watchdog_gov_panic_register); |
| 43 | module_exit(watchdog_gov_panic_unregister); |
| 44 | |
| 45 | MODULE_AUTHOR("Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>"); |
| 46 | MODULE_DESCRIPTION("Panic watchdog pretimeout governor"); |
| 47 | MODULE_LICENSE("GPL"); |