[RAMEN9610-21564]net/flow_dissector: switch to siphash
[GitHub/MotorolaMobilityLLC/kernel-slsi.git] / kernel / watchdogtest.c
1 /*
2 * Simple softlockup watchdog regression test module
3 *
4 * Copyright (C) 2012 Motorola Mobility LLC.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; version 2
9 * of the License.
10 */
11
12 #include <linux/completion.h>
13 #include <linux/workqueue.h>
14 #include <linux/irq.h>
15 #include <linux/preempt.h>
16 #include <linux/module.h>
17 #include <linux/debugfs.h>
18
19 struct completion wdt_timeout_complete;
20 static void wdt_timeout_work(struct work_struct *work)
21 {
22 local_irq_disable();
23 while (1)
24 ;
25 local_irq_enable();
26 complete(&wdt_timeout_complete);
27 }
28 static DECLARE_WORK(wdt_timeout_work_struct, wdt_timeout_work);
29
30 static int fire_watchdog_reset_set(void *data, u64 val)
31 {
32
33 printk(KERN_WARNING "Fire hardware watchdog reset.\n");
34 printk(KERN_WARNING "Please wait ...\n");
35 init_completion(&wdt_timeout_complete);
36 schedule_work_on(0, &wdt_timeout_work_struct);
37 wait_for_completion(&wdt_timeout_complete);
38 return 0;
39 }
40 DEFINE_SIMPLE_ATTRIBUTE(fire_watchdog_reset_fops,
41 NULL, fire_watchdog_reset_set, "%llu\n");
42
43 static int fire_softlockup_reset_set(void *data, u64 val)
44 {
45 printk(KERN_WARNING "Fire softlockup watchdog reset.\n");
46 printk(KERN_WARNING "Please wait ...\n");
47 preempt_disable();
48 while (1)
49 ;
50
51 return 0;
52 }
53 DEFINE_SIMPLE_ATTRIBUTE(fire_softlockup_reset_fops,
54 NULL, fire_softlockup_reset_set, "%llu\n");
55
56 static int watchdog_test_init(void)
57 {
58 debugfs_create_file("fire_softlockup_reset", 0200,
59 NULL, NULL, &fire_softlockup_reset_fops);
60 debugfs_create_file("fire_watchdog_reset", 0200,
61 NULL, NULL, &fire_watchdog_reset_fops);
62 return 0;
63 }
64
65 static void watchdog_test_exit(void)
66 {
67 }
68
69 module_init(watchdog_test_init);
70 module_exit(watchdog_test_exit);
71 MODULE_LICENSE("GPL");