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