2 * Simple softlockup watchdog regression test module
4 * Copyright (C) 2012 Motorola Mobility LLC.
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
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>
19 struct completion wdt_timeout_complete
;
20 static void wdt_timeout_work(struct work_struct
*work
)
26 complete(&wdt_timeout_complete
);
28 static DECLARE_WORK(wdt_timeout_work_struct
, wdt_timeout_work
);
30 static int fire_watchdog_reset_set(void *data
, u64 val
)
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
);
40 DEFINE_SIMPLE_ATTRIBUTE(fire_watchdog_reset_fops
,
41 NULL
, fire_watchdog_reset_set
, "%llu\n");
43 static int fire_softlockup_reset_set(void *data
, u64 val
)
45 printk(KERN_WARNING
"Fire softlockup watchdog reset.\n");
46 printk(KERN_WARNING
"Please wait ...\n");
53 DEFINE_SIMPLE_ATTRIBUTE(fire_softlockup_reset_fops
,
54 NULL
, fire_softlockup_reset_set
, "%llu\n");
56 static int watchdog_test_init(void)
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
);
65 static void watchdog_test_exit(void)
69 module_init(watchdog_test_init
);
70 module_exit(watchdog_test_exit
);
71 MODULE_LICENSE("GPL");