5d45e3dad3e35c3be16d44d661f8b0d783f9198b
[openwrt/staging/blogic.git] / backport / compat / main.c
1 #include <linux/module.h>
2 #include <linux/init.h>
3 #include <linux/pm_qos.h>
4 #include <linux/workqueue.h>
5 #include "backports.h"
6
7 MODULE_AUTHOR("Luis R. Rodriguez");
8 MODULE_DESCRIPTION("Kernel backport module");
9 MODULE_LICENSE("GPL");
10
11 #ifndef CPTCFG_KERNEL_NAME
12 #error "You need a CPTCFG_KERNEL_NAME"
13 #endif
14
15 #ifndef CPTCFG_KERNEL_VERSION
16 #error "You need a CPTCFG_KERNEL_VERSION"
17 #endif
18
19 #ifndef CPTCFG_VERSION
20 #error "You need a CPTCFG_VERSION"
21 #endif
22
23 static char *backported_kernel_name = CPTCFG_KERNEL_NAME;
24
25 module_param(backported_kernel_name, charp, 0400);
26 MODULE_PARM_DESC(backported_kernel_name,
27 "The kernel tree name that was used for this backport (" CPTCFG_KERNEL_NAME ")");
28
29 #ifdef BACKPORTS_GIT_TRACKED
30 static char *backports_tracker_id = BACKPORTS_GIT_TRACKED;
31 module_param(backports_tracker_id, charp, 0400);
32 MODULE_PARM_DESC(backports_tracker_id,
33 "The version of the tree containing this backport (" BACKPORTS_GIT_TRACKED ")");
34 #else
35 static char *backported_kernel_version = CPTCFG_KERNEL_VERSION;
36 static char *backports_version = CPTCFG_VERSION;
37
38 module_param(backported_kernel_version, charp, 0400);
39 MODULE_PARM_DESC(backported_kernel_version,
40 "The kernel version that was used for this backport (" CPTCFG_KERNEL_VERSION ")");
41
42 module_param(backports_version, charp, 0400);
43 MODULE_PARM_DESC(backports_version,
44 "The git version of the backports tree used to generate this backport (" CPTCFG_VERSION ")");
45
46 #endif
47
48 void backport_dependency_symbol(void)
49 {
50 }
51 EXPORT_SYMBOL_GPL(backport_dependency_symbol);
52
53
54 static int __init backport_init(void)
55 {
56 int ret = crypto_ccm_module_init();
57 if (ret)
58 return ret;
59
60 ret = devcoredump_init();
61 if (ret) {
62 crypto_ccm_module_exit();
63 return ret;
64 }
65
66 printk(KERN_INFO "Loading modules backported from " CPTCFG_KERNEL_NAME
67 #ifndef BACKPORTS_GIT_TRACKED
68 " version " CPTCFG_KERNEL_VERSION
69 #endif
70 "\n");
71 #ifdef BACKPORTS_GIT_TRACKED
72 printk(KERN_INFO BACKPORTS_GIT_TRACKED "\n");
73 #else
74
75 #ifdef CONFIG_BACKPORT_INTEGRATE
76 printk(KERN_INFO "Backport integrated by backports.git " CPTCFG_VERSION "\n");
77 #else
78 printk(KERN_INFO "Backport generated by backports.git " CPTCFG_VERSION "\n");
79 #endif /* CONFIG_BACKPORT_INTEGRATE */
80
81 #endif /* BACKPORTS_GIT_TRACKED */
82
83 return 0;
84 }
85 subsys_initcall(backport_init);
86
87 static void __exit backport_exit(void)
88 {
89 crypto_ccm_module_exit();
90 devcoredump_exit();
91 }
92 module_exit(backport_exit);