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