9ff2898edc93fc7d351e1ec77611d84f192d65ad
[~tnikolova/compat/.git] / compat / main.c
1 #include <linux/module.h>
2
3 MODULE_AUTHOR("Luis R. Rodriguez");
4 MODULE_DESCRIPTION("Kernel backport module");
5 MODULE_LICENSE("GPL");
6
7 #ifndef COMPAT_BASE
8 #error "You need a COMPAT_BASE"
9 #endif
10
11 #ifndef COMPAT_BASE_TREE
12 #error "You need a COMPAT_BASE_TREE"
13 #endif
14
15 #ifndef COMPAT_BASE_TREE_VERSION
16 #error "You need a COMPAT_BASE_TREE_VERSION"
17 #endif
18
19 #ifndef COMPAT_VERSION
20 #error "You need a COMPAT_VERSION"
21 #endif
22
23 static char *compat_base = COMPAT_BASE;
24 static char *compat_base_tree = COMPAT_BASE_TREE;
25 static char *compat_base_tree_version = COMPAT_BASE_TREE_VERSION;
26 static char *compat_version = COMPAT_VERSION;
27
28 module_param(compat_base, charp, 0400);
29 MODULE_PARM_DESC(compat_base_tree,
30                  "The upstream verion of compat.git used");
31
32 module_param(compat_base_tree, charp, 0400);
33 MODULE_PARM_DESC(compat_base_tree,
34                  "The upstream tree used as base for this backport");
35
36 module_param(compat_base_tree_version, charp, 0400);
37 MODULE_PARM_DESC(compat_base_tree_version,
38                  "The git-describe of the upstream base tree");
39
40 module_param(compat_version, charp, 0400);
41 MODULE_PARM_DESC(compat_version,
42                  "Version of the kernel compat backport work");
43
44 void backport_dependency_symbol(void)
45 {
46 }
47 EXPORT_SYMBOL_GPL(backport_dependency_symbol);
48
49
50 static int __init backport_init(void)
51 {
52         int err;
53
54         backport_pm_qos_power_init();
55         err = backport_system_workqueue_create();
56         if (err) {
57                 pr_warn("backport_system_workqueue_create() failed\n");
58                 return err;
59         }
60
61         printk(KERN_INFO
62                COMPAT_PROJECT " backport release: "
63                COMPAT_VERSION
64                "\n");
65         printk(KERN_INFO "Backport based on "
66                COMPAT_BASE_TREE " " COMPAT_BASE_TREE_VERSION
67                "\n");
68         printk(KERN_INFO "compat.git: "
69                COMPAT_BASE_TREE "\n");
70
71         return 0;
72 }
73 module_init(backport_init);
74
75 static void __exit backport_exit(void)
76 {
77         backport_pm_qos_power_deinit();
78         backport_system_workqueue_destroy();
79
80         return;
81 }
82 module_exit(backport_exit);
83