1 #include <linux/module.h>
2 #include <linux/kthread.h>
3 #include <linux/irq_work.h>
5 /* Must not be static to force gcc to consider these non constant */
6 char *trace_printk_test_global_str
=
7 "This is a dynamic string that will use trace_puts\n";
9 char *trace_printk_test_global_str_irq
=
10 "(irq) This is a dynamic string that will use trace_puts\n";
12 char *trace_printk_test_global_str_fmt
=
13 "%sThis is a %s that will use trace_printk\n";
15 static struct irq_work irqwork
;
17 static void trace_printk_irq_work(struct irq_work
*work
)
19 trace_printk("(irq) This is a static string that will use trace_bputs\n");
20 trace_printk(trace_printk_test_global_str_irq
);
22 trace_printk("(irq) This is a %s that will use trace_bprintk()\n",
25 trace_printk(trace_printk_test_global_str_fmt
,
26 "(irq) ", "dynamic string");
29 static int __init
trace_printk_init(void)
31 init_irq_work(&irqwork
, trace_printk_irq_work
);
33 trace_printk("This is a static string that will use trace_bputs\n");
34 trace_printk(trace_printk_test_global_str
);
36 /* Kick off printing in irq context */
37 irq_work_queue(&irqwork
);
39 trace_printk("This is a %s that will use trace_bprintk()\n",
42 trace_printk(trace_printk_test_global_str_fmt
, "", "dynamic string");
47 static void __exit
trace_printk_exit(void)
51 module_init(trace_printk_init
);
52 module_exit(trace_printk_exit
);
54 MODULE_AUTHOR("Steven Rostedt");
55 MODULE_DESCRIPTION("trace-printk");
56 MODULE_LICENSE("GPL");