sh_eth: fix EESIPR values for SH77{34|63}
[linux/fpc-iii.git] / kernel / backtracetest.c
blob1323360d90e375758825ff90c597b663c9d3c4d7
1 /*
2 * Simple stack backtrace regression test module
4 * (C) Copyright 2008 Intel Corporation
5 * Author: Arjan van de Ven <arjan@linux.intel.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
13 #include <linux/completion.h>
14 #include <linux/delay.h>
15 #include <linux/interrupt.h>
16 #include <linux/module.h>
17 #include <linux/sched.h>
18 #include <linux/stacktrace.h>
20 static void backtrace_test_normal(void)
22 pr_info("Testing a backtrace from process context.\n");
23 pr_info("The following trace is a kernel self test and not a bug!\n");
25 dump_stack();
28 static DECLARE_COMPLETION(backtrace_work);
30 static void backtrace_test_irq_callback(unsigned long data)
32 dump_stack();
33 complete(&backtrace_work);
36 static DECLARE_TASKLET(backtrace_tasklet, &backtrace_test_irq_callback, 0);
38 static void backtrace_test_irq(void)
40 pr_info("Testing a backtrace from irq context.\n");
41 pr_info("The following trace is a kernel self test and not a bug!\n");
43 init_completion(&backtrace_work);
44 tasklet_schedule(&backtrace_tasklet);
45 wait_for_completion(&backtrace_work);
48 #ifdef CONFIG_STACKTRACE
49 static void backtrace_test_saved(void)
51 struct stack_trace trace;
52 unsigned long entries[8];
54 pr_info("Testing a saved backtrace.\n");
55 pr_info("The following trace is a kernel self test and not a bug!\n");
57 trace.nr_entries = 0;
58 trace.max_entries = ARRAY_SIZE(entries);
59 trace.entries = entries;
60 trace.skip = 0;
62 save_stack_trace(&trace);
63 print_stack_trace(&trace, 0);
65 #else
66 static void backtrace_test_saved(void)
68 pr_info("Saved backtrace test skipped.\n");
70 #endif
72 static int backtrace_regression_test(void)
74 pr_info("====[ backtrace testing ]===========\n");
76 backtrace_test_normal();
77 backtrace_test_irq();
78 backtrace_test_saved();
80 pr_info("====[ end of backtrace testing ]====\n");
81 return 0;
84 static void exitf(void)
88 module_init(backtrace_regression_test);
89 module_exit(exitf);
90 MODULE_LICENSE("GPL");
91 MODULE_AUTHOR("Arjan van de Ven <arjan@linux.intel.com>");