Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #include <linux/kthread.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #include <linux/irq_work.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) /* Must not be static to force gcc to consider these non constant */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) char *trace_printk_test_global_str =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 	"This is a dynamic string that will use trace_puts\n";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) char *trace_printk_test_global_str_irq =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 	"(irq) This is a dynamic string that will use trace_puts\n";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) char *trace_printk_test_global_str_fmt =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	"%sThis is a %s that will use trace_printk\n";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) static struct irq_work irqwork;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) static void trace_printk_irq_work(struct irq_work *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	trace_printk("(irq) This is a static string that will use trace_bputs\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	trace_printk(trace_printk_test_global_str_irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	trace_printk("(irq) This is a %s that will use trace_bprintk()\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 		     "static string");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	trace_printk(trace_printk_test_global_str_fmt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 		     "(irq) ", "dynamic string");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static int __init trace_printk_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	init_irq_work(&irqwork, trace_printk_irq_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	trace_printk("This is a static string that will use trace_bputs\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	trace_printk(trace_printk_test_global_str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	/* Kick off printing in irq context */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	irq_work_queue(&irqwork);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	irq_work_sync(&irqwork);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	trace_printk("This is a %s that will use trace_bprintk()\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 		     "static string");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	trace_printk(trace_printk_test_global_str_fmt, "", "dynamic string");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) static void __exit trace_printk_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) module_init(trace_printk_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) module_exit(trace_printk_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) MODULE_AUTHOR("Steven Rostedt");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) MODULE_DESCRIPTION("trace-printk");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) MODULE_LICENSE("GPL");