summaryrefslogtreecommitdiffstats
path: root/package/mac80211/patches/050-compat_firmware.patch
blob: 602e82d4a7d1f55ebb708f526b9e2ccb48d93e29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
--- a/compat/Makefile
+++ b/compat/Makefile
@@ -1,7 +1,10 @@
 obj-m += compat.o
 #compat-objs :=
 
-obj-$(CONFIG_COMPAT_FIRMWARE_CLASS) += compat_firmware_class.o
+ifdef CONFIG_COMPAT_FIRMWARE_CLASS
+  compat-y += compat_firmware_class.o
+endif
+
 obj-$(CONFIG_COMPAT_NET_SCH_CODEL) += sch_codel.o
 obj-$(CONFIG_COMPAT_NET_SCH_FQ_CODEL) += sch_fq_codel.o
 
--- a/compat/compat_firmware_class.c
+++ b/compat/compat_firmware_class.c
@@ -741,19 +741,16 @@ compat_request_firmware_nowait(
 	return 0;
 }
 
-static int __init firmware_class_init(void)
+int __init firmware_class_init(void)
 {
 	return class_register(&firmware_class);
 }
 
-static void __exit firmware_class_exit(void)
+void __exit firmware_class_exit(void)
 {
 	class_unregister(&firmware_class);
 }
 
-fs_initcall(firmware_class_init);
-module_exit(firmware_class_exit);
-
 EXPORT_SYMBOL_GPL(release_firmware);
 EXPORT_SYMBOL_GPL(request_firmware);
 EXPORT_SYMBOL_GPL(request_firmware_nowait);
--- a/compat/main.c
+++ b/compat/main.c
@@ -47,6 +47,17 @@ void compat_dependency_symbol(void)
 EXPORT_SYMBOL_GPL(compat_dependency_symbol);
 
 
+#if defined(CONFIG_FW_LOADER) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
+int __init firmware_class_init(void);
+void __exit firmware_class_exit(void);
+#else
+static inline int firmware_class_init(void)
+{
+	return 0;
+}
+static inline void firmware_class_exit(void) {}
+#endif
+
 static int __init compat_init(void)
 {
 	compat_pm_qos_power_init();
@@ -63,7 +74,8 @@ static int __init compat_init(void)
 	printk(KERN_INFO "compat.git: "
 	       COMPAT_BASE_TREE "\n");
 
-        return 0;
+	firmware_class_init();
+	return 0;
 }
 module_init(compat_init);
 
@@ -72,7 +84,8 @@ static void __exit compat_exit(void)
 	compat_pm_qos_power_deinit();
 	compat_system_workqueue_destroy();
 
-        return;
+	firmware_class_exit();
+	return;
 }
 module_exit(compat_exit);