summaryrefslogtreecommitdiffstats
path: root/package/mac80211/patches/000-linux_3.0_support.patch
blob: 226d5118175d0b428cf038ab63e90f7df0b6ef62 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
--- a/compat/Makefile
+++ b/compat/Makefile
@@ -6,31 +6,31 @@ obj-$(CONFIG_COMPAT_FIRMWARE_CLASS) += c
 compat-y += main.o
 
 # Compat kernel compatibility code
-compat-$(CONFIG_COMPAT_KERNEL_14) += compat-2.6.14.o
-compat-$(CONFIG_COMPAT_KERNEL_18) += compat-2.6.18.o
-compat-$(CONFIG_COMPAT_KERNEL_19) += compat-2.6.19.o
-compat-$(CONFIG_COMPAT_KERNEL_21) += compat-2.6.21.o
-compat-$(CONFIG_COMPAT_KERNEL_22) += compat-2.6.22.o
-compat-$(CONFIG_COMPAT_KERNEL_23) += compat-2.6.23.o
-compat-$(CONFIG_COMPAT_KERNEL_24) += compat-2.6.24.o
-compat-$(CONFIG_COMPAT_KERNEL_25) += \
+compat-$(CONFIG_COMPAT_KERNEL_2_6_14) += compat-2.6.14.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_18) += compat-2.6.18.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_19) += compat-2.6.19.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_21) += compat-2.6.21.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_22) += compat-2.6.22.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_23) += compat-2.6.23.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_24) += compat-2.6.24.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_25) += \
 	compat-2.6.25.o \
 	pm_qos_params.o
 
-compat-$(CONFIG_COMPAT_KERNEL_26) += compat-2.6.26.o
-compat-$(CONFIG_COMPAT_KERNEL_27) += compat-2.6.27.o
-compat-$(CONFIG_COMPAT_KERNEL_28) += compat-2.6.28.o
-compat-$(CONFIG_COMPAT_KERNEL_29) += compat-2.6.29.o
-compat-$(CONFIG_COMPAT_KERNEL_32) += compat-2.6.32.o
-compat-$(CONFIG_COMPAT_KERNEL_33) += compat-2.6.33.o
-compat-$(CONFIG_COMPAT_KERNEL_35) += compat-2.6.35.o
-compat-$(CONFIG_COMPAT_KERNEL_36) += \
+compat-$(CONFIG_COMPAT_KERNEL_2_6_26) += compat-2.6.26.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_27) += compat-2.6.27.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_28) += compat-2.6.28.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_29) += compat-2.6.29.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_32) += compat-2.6.32.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_33) += compat-2.6.33.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_35) += compat-2.6.35.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_36) += \
 	compat-2.6.36.o \
 	kfifo.o
 
-compat-$(CONFIG_COMPAT_KERNEL_37) += compat-2.6.37.o
-compat-$(CONFIG_COMPAT_KERNEL_38) += compat-2.6.38.o
-compat-$(CONFIG_COMPAT_KERNEL_39) += \
+compat-$(CONFIG_COMPAT_KERNEL_2_6_37) += compat-2.6.37.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_38) += compat-2.6.38.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_39) += \
 	compat-2.6.39.o \
 	kstrtox.o
 
--- a/include/linux/compat-2.6.34.h
+++ b/include/linux/compat-2.6.34.h
@@ -251,6 +251,8 @@ static inline int usb_disable_autosuspen
 
 #define rcu_dereference_raw(p)	rcu_dereference(p)
 
+#define KEY_WPS_BUTTON		0x211	/* WiFi Protected Setup key */
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)) */
 
 #endif /* LINUX_26_34_COMPAT_H */
--- a/include/linux/compat-2.6.40.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef LINUX_26_40_COMPAT_H
-#define LINUX_26_40_COMPAT_H
-
-#include <linux/version.h>
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,40))
-
-#include <linux/rcupdate.h>
-
-/*
- * This is not part of The 2.6.37 kernel yet but we
- * we use it to optimize the backport code we
- * need to implement. Instead of using ifdefs
- * to check what version of the check we use
- * we just replace all checks on current code
- * with this. I'll submit this upstream too, that
- * way all we'd have to do is to implement this
- * for older kernels, then we would not have to
- * edit the upstrema code for backport efforts.
- */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
-#define br_port_exists(dev)	(dev->priv_flags & IFF_BRIDGE_PORT)
-#else
-#define br_port_exists(dev)	(dev->br_port)
-#endif
-
-#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,40)) */
-
-#endif /* LINUX_26_40_COMPAT_H */
--- a/include/linux/compat-2.6.h
+++ b/include/linux/compat-2.6.h
@@ -32,6 +32,7 @@
 #include <linux/compat-2.6.37.h>
 #include <linux/compat-2.6.38.h>
 #include <linux/compat-2.6.39.h>
-#include <linux/compat-2.6.40.h>
+#include <linux/compat-3.0.h>
+#include <linux/compat-3.1.h>
 
 #endif /* LINUX_26_COMPAT_H */
--- /dev/null
+++ b/include/linux/compat-3.0.h
@@ -0,0 +1,31 @@
+#ifndef LINUX_3_0_COMPAT_H
+#define LINUX_3_0_COMPAT_H
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0))
+
+/*
+ * since commit 1c5cae815d19ffe02bdfda1260949ef2b1806171
+ * "net: call dev_alloc_name from register_netdevice" dev_alloc_name is
+ * called automatically. This is not implemented in older kernel
+ * versions so it will result in device wrong names.
+ */
+static inline int register_netdevice_name(struct net_device *dev)
+{
+	int err;
+
+	if (strchr(dev->name, '%')) {
+		err = dev_alloc_name(dev, dev->name);
+		if (err < 0)
+			return err;
+	}
+
+	return register_netdevice(dev);
+}
+
+#define register_netdevice(dev) register_netdevice_name(dev)
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) */
+
+#endif /* LINUX_3_0_COMPAT_H */
--- /dev/null
+++ b/include/linux/compat-3.1.h
@@ -0,0 +1,27 @@
+#ifndef LINUX_3_1_COMPAT_H
+#define LINUX_3_1_COMPAT_H
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
+
+/*
+ * This is not part of The 2.6.37 kernel yet but we
+ * we use it to optimize the backport code we
+ * need to implement. Instead of using ifdefs
+ * to check what version of the check we use
+ * we just replace all checks on current code
+ * with this. I'll submit this upstream too, that
+ * way all we'd have to do is to implement this
+ * for older kernels, then we would not have to
+ * edit the upstrema code for backport efforts.
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36))
+#define br_port_exists(dev)	(dev->priv_flags & IFF_BRIDGE_PORT)
+#else
+#define br_port_exists(dev)	(dev->br_port)
+#endif
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) */
+
+#endif /* LINUX_3_1_COMPAT_H */
--- a/config.mk
+++ b/config.mk
@@ -14,20 +14,28 @@ else
 include $(KLIB_BUILD)/.config
 endif
 
-# We will warn when you don't have MQ support or NET_SCHED enabled.
-#
-# We could consider just quiting if MQ and NET_SCHED is disabled
-# as I suspect all users of this package want 802.11e (WME) and
-# 802.11n (HT) support.
 ifneq ($(wildcard $(KLIB_BUILD)/Makefile),)
-COMPAT_LATEST_VERSION = 39
-KERNEL_SUBLEVEL := $(shell $(MAKE) -C $(KLIB_BUILD) kernelversion | sed -n 's/^2\.6\.\([0-9]\+\).*/\1/p')
+
+COMPAT_LATEST_VERSION = 1
+
+KERNEL_VERSION := $(shell $(MAKE) -C $(KLIB_BUILD) kernelversion | sed -n 's/^\([0-9]\)\..*/\1/p')
+
+ifneq ($(KERNEL_VERSION),2)
+KERNEL_SUBLEVEL := $(shell $(MAKE) -C $(KLIB_BUILD) kernelversion | sed -n 's/^3\.\([0-9]\+\).*/\1/p')
+else
+COMPAT_26LATEST_VERSION = 39
+KERNEL_26SUBLEVEL := $(shell $(MAKE) -C $(KLIB_BUILD) kernelversion | sed -n 's/^2\.6\.\([0-9]\+\).*/\1/p')
+COMPAT_26VERSIONS := $(shell I=$(COMPAT_26LATEST_VERSION); while [ "$$I" -gt $(KERNEL_26SUBLEVEL) ]; do echo $$I; I=$$(($$I - 1)); done)
+$(foreach ver,$(COMPAT_26VERSIONS),$(eval CONFIG_COMPAT_KERNEL_2_6_$(ver)=y))
+KERNEL_SUBLEVEL := -1
+endif
+
 COMPAT_VERSIONS := $(shell I=$(COMPAT_LATEST_VERSION); while [ "$$I" -gt $(KERNEL_SUBLEVEL) ]; do echo $$I; I=$$(($$I - 1)); done)
-$(foreach ver,$(COMPAT_VERSIONS),$(eval CONFIG_COMPAT_KERNEL_$(ver)=y))
+$(foreach ver,$(COMPAT_VERSIONS),$(eval CONFIG_COMPAT_KERNEL_3_$(ver)=y))
 
-ifdef CONFIG_COMPAT_KERNEL_24
+ifdef CONFIG_COMPAT_KERNEL_2_6_24
 $(error "ERROR: compat-wireless by default supports kernels >= 2.6.24, try enabling only one driver though")
-endif #CONFIG_COMPAT_KERNEL_24
+endif #CONFIG_COMPAT_KERNEL_2_6_24
 
 ifeq ($(CONFIG_CFG80211),y)
 $(error "ERROR: your kernel has CONFIG_CFG80211=y, you should have it CONFIG_CFG80211=m if you want to use this thing.")
@@ -37,7 +45,7 @@ endif
 # 2.6.27 has FTRACE_DYNAMIC borked, so we will complain if
 # you have it enabled, otherwise you will very likely run into
 # a kernel panic.
-ifeq ($(KERNEL_SUBLEVEL),27)
+ifeq ($(shell test $(KERNEL_VERSION) -eq 2 -a $(KERNEL_SUBLEVEL) -eq 27 && echo yes),yes)
 ifeq ($(CONFIG_DYNAMIC_FTRACE),y)
 $(error "ERROR: Your 2.6.27 kernel has CONFIG_DYNAMIC_FTRACE, please upgrade your distribution kernel as newer ones should not have this enabled (and if so report a bug) or remove this warning if you know what you are doing")
 endif
@@ -54,7 +62,7 @@ endif
 #
 # In kernel 2.6.32 both attributes were removed.
 #
-ifeq ($(shell test $(KERNEL_SUBLEVEL) -ge 27 -a $(KERNEL_SUBLEVEL) -le 31 && echo yes),yes)
+ifeq ($(shell test $(KERNEL_VERSION) -eq 2 -a $(KERNEL_SUBLEVEL) -ge 27 -a $(KERNEL_SUBLEVEL) -le 31 && echo yes),yes)
 ifeq ($(CONFIG_MAC80211),)
 $(error "ERROR: Your >=2.6.27 and <= 2.6.31 kernel has CONFIG_MAC80211 disabled, you should have it CONFIG_MAC80211=m if you want to use this thing.")
 endif
@@ -62,6 +70,11 @@ endif
 
 ifneq ($(KERNELRELEASE),) # This prevents a warning
 
+# We will warn when you don't have MQ support or NET_SCHED enabled.
+#
+# We could consider just quiting if MQ and NET_SCHED is disabled
+# as I suspect all users of this package want 802.11e (WME) and
+# 802.11n (HT) support.
 ifeq ($(CONFIG_NET_SCHED),)
  QOS_REQS_MISSING+=CONFIG_NET_SCHED
 endif
@@ -92,20 +105,20 @@ else
 endif
 
 # The Bluetooth compatibility only builds on kernels >= 2.6.27 for now
-ifndef CONFIG_COMPAT_KERNEL_27
+ifndef CONFIG_COMPAT_KERNEL_2_6_27
 ifeq ($(CONFIG_BT),y)
 # we'll ignore compiling bluetooth
 else
  CONFIG_COMPAT_BLUETOOTH=y
  CONFIG_COMPAT_BLUETOOTH_MODULES=m
 endif
-endif #CONFIG_COMPAT_KERNEL_27
+endif #CONFIG_COMPAT_KERNEL_2_6_27
 
-ifdef CONFIG_COMPAT_KERNEL_33
+ifdef CONFIG_COMPAT_KERNEL_2_6_33
 ifdef CONFIG_FW_LOADER
  CONFIG_COMPAT_FIRMWARE_CLASS=m
 endif #CONFIG_FW_LOADER
-endif #CONFIG_COMPAT_KERNEL_33
+endif #CONFIG_COMPAT_KERNEL_2_6_33
 
 # Wireless subsystem stuff
 CONFIG_MAC80211=m
@@ -165,9 +178,9 @@ CONFIG_BT_BNEP_PROTO_FILTER=y
 ifdef CONFIG_ISDN_CAPI
 CONFIG_BT_CMTP=m
 endif #CONFIG_ISDN_CAPI
-ifndef CONFIG_COMPAT_KERNEL_28
+ifndef CONFIG_COMPAT_KERNEL_2_6_28
 CONFIG_COMPAT_BT_HIDP=m
-endif #CONFIG_COMPAT_KERNEL_28
+endif #CONFIG_COMPAT_KERNEL_2_6_28
 
 CONFIG_BT_HCIUART=M
 CONFIG_BT_HCIUART_H4=y
@@ -345,11 +358,11 @@ CONFIG_MWL8K=m
 CONFIG_ATL1=m
 CONFIG_ATL2=m
 CONFIG_ATL1E=m
-ifdef CONFIG_COMPAT_KERNEL_27
+ifdef CONFIG_COMPAT_KERNEL_2_6_27
 CONFIG_ATL1C=n
-else #CONFIG_COMPAT_KERNEL_27
+else #CONFIG_COMPAT_KERNEL_2_6_27
 CONFIG_ATL1C=m
-endif #CONFIG_COMPAT_KERNEL_27
+endif #CONFIG_COMPAT_KERNEL_2_6_27
 
 ifdef CONFIG_WIRELESS_EXT
 CONFIG_HERMES=m
@@ -379,13 +392,13 @@ endif #CONFIG_PCI
 
 ifdef CONFIG_PCMCIA
 
-ifdef CONFIG_COMPAT_KERNEL_27
+ifdef CONFIG_COMPAT_KERNEL_2_6_27
 CONFIG_LIBERTAS=n
 CONFIG_LIBERTAS_CS=n
-else #CONFIG_COMPAT_KERNEL_27
+else #CONFIG_COMPAT_KERNEL_2_6_27
 CONFIG_LIBERTAS_CS=m
 NEED_LIBERTAS=y
-endif #CONFIG_COMPAT_KERNEL_27
+endif #CONFIG_COMPAT_KERNEL_2_6_27
 
 endif #CONFIG_PCMCIA
 ## end of PCMCIA
@@ -395,10 +408,10 @@ CONFIG_EEPROM_93CX6=m
 
 # USB Drivers
 ifdef CONFIG_USB
-ifndef CONFIG_COMPAT_KERNEL_29
+ifndef CONFIG_COMPAT_KERNEL_2_6_29
 CONFIG_COMPAT_ZD1211RW=m
 # CONFIG_ZD1211RW_DEBUG=y
-endif #CONFIG_COMPAT_KERNEL_29
+endif #CONFIG_COMPAT_KERNEL_2_6_29
 
 # Sorry, rndis_wlan uses cancel_work_sync which is new and can't be done in compat...
 
@@ -407,12 +420,12 @@ endif #CONFIG_COMPAT_KERNEL_29
 # is only wireless RNDIS chip known to date.
 # Note: this depends on CONFIG_USB_NET_RNDIS_HOST and CONFIG_USB_NET_CDCETHER
 # it also requires new RNDIS_HOST and CDC_ETHER modules which we add
-ifdef CONFIG_COMPAT_KERNEL_29
+ifdef CONFIG_COMPAT_KERNEL_2_6_29
 CONFIG_USB_COMPAT_USBNET=n
 CONFIG_USB_NET_COMPAT_RNDIS_HOST=n
 CONFIG_USB_NET_COMPAT_RNDIS_WLAN=n
 CONFIG_USB_NET_COMPAT_CDCETHER=n
-else #CONFIG_COMPAT_KERNEL_29
+else #CONFIG_COMPAT_KERNEL_2_6_29
 CONFIG_USB_COMPAT_USBNET=m
 ifdef CONFIG_USB_NET_CDCETHER
 CONFIG_USB_NET_COMPAT_RNDIS_HOST=m
@@ -423,7 +436,7 @@ CONFIG_USB_NET_COMPAT_RNDIS_HOST=m
 CONFIG_USB_NET_COMPAT_RNDIS_WLAN=m
 endif #CONFIG_USB_NET_CDCETHER
 CONFIG_USB_NET_COMPAT_CDCETHER=m
-endif #CONFIG_COMPAT_KERNEL_29
+endif #CONFIG_COMPAT_KERNEL_2_6_29
 
 
 CONFIG_P54_USB=m
@@ -434,14 +447,14 @@ endif #CONFIG_MAC80211_LEDS
 
 CONFIG_AT76C50X_USB=m
 
-ifndef CONFIG_COMPAT_KERNEL_29
+ifndef CONFIG_COMPAT_KERNEL_2_6_29
 CONFIG_CARL9170=m
 ifdef CONFIG_MAC80211_LEDS
 CONFIG_CARL9170_LEDS=y
 endif #CONFIG_MAC80211_LEDS
 # CONFIG_CARL9170_DEBUGFS=y
 # CONFIG_CARL9170_WPC=y
-endif #CONFIG_COMPAT_KERNEL_29
+endif #CONFIG_COMPAT_KERNEL_2_6_29
 
 # This activates a threading fix for usb urb.
 # this is mainline commit: b3e670443b7fb8a2d29831b62b44a039c283e351
@@ -467,15 +480,15 @@ ifdef CONFIG_CRC_ITU_T
 CONFIG_RT73USB=m
 endif #CONFIG_CRC_ITU_T
 
-ifdef CONFIG_COMPAT_KERNEL_27
+ifdef CONFIG_COMPAT_KERNEL_2_6_27
 CONFIG_LIBERTAS_THINFIRM_USB=n
 CONFIG_LIBERTAS_USB=n
 NEED_LIBERTAS=n
-else #CONFIG_COMPAT_KERNEL_27
+else #CONFIG_COMPAT_KERNEL_2_6_27
 CONFIG_LIBERTAS_THINFIRM_USB=m
 CONFIG_LIBERTAS_USB=m
 NEED_LIBERTAS=y
-endif #CONFIG_COMPAT_KERNEL_27
+endif #CONFIG_COMPAT_KERNEL_2_6_27
 
 CONFIG_ORINOCO_USB=m
 
@@ -490,7 +503,7 @@ CONFIG_RTL8192CU=m
 endif #CONFIG_USB end of USB driver list
 
 ifdef CONFIG_SPI_MASTER
-ifndef CONFIG_COMPAT_KERNEL_25
+ifndef CONFIG_COMPAT_KERNEL_2_6_25
 
 ifdef CONFIG_CRC7
 CONFIG_WL1251_SPI=m
@@ -498,15 +511,15 @@ CONFIG_WL12XX_SPI=m
 endif #CONFIG_CRC7
 CONFIG_P54_SPI=m
 
-ifdef CONFIG_COMPAT_KERNEL_27
+ifdef CONFIG_COMPAT_KERNEL_2_6_27
 CONFIG_LIBERTAS_SPI=n
 NEED_LIBERTAS=n
-else #CONFIG_COMPAT_KERNEL_27
+else #CONFIG_COMPAT_KERNEL_2_6_27
 CONFIG_LIBERTAS_SPI=m
 NEED_LIBERTAS=y
-endif #CONFIG_COMPAT_KERNEL_27
+endif #CONFIG_COMPAT_KERNEL_2_6_27
 
-endif #CONFIG_COMPAT_KERNEL_25
+endif #CONFIG_COMPAT_KERNEL_2_6_25
 endif #CONFIG_SPI_MASTER end of SPI driver list
 
 ifdef CONFIG_MMC
@@ -519,23 +532,23 @@ ifdef CONFIG_WL12XX_PLATFORM_DATA
 CONFIG_COMPAT_WL1251_SDIO=m
 endif #CONFIG_WL12XX_PLATFORM_DATA
 
-ifndef CONFIG_COMPAT_KERNEL_32
+ifndef CONFIG_COMPAT_KERNEL_2_6_32
 ifdef CONFIG_WL12XX_PLATFORM_DATA
 CONFIG_COMPAT_WL12XX_SDIO=m
 endif #CONFIG_WL12XX_PLATFORM_DATA
-endif #CONFIG_COMPAT_KERNEL_32
+endif #CONFIG_COMPAT_KERNEL_2_6_32
 
 endif #CONFIG_CRC7
 
 CONFIG_MWIFIEX_SDIO=m
 
-ifdef CONFIG_COMPAT_KERNEL_27
+ifdef CONFIG_COMPAT_KERNEL_2_6_27
 CONFIG_LIBERTAS_SDIO=n
 NEED_LIBERTAS=n
-else #CONFIG_COMPAT_KERNEL_27
+else #CONFIG_COMPAT_KERNEL_2_6_27
 CONFIG_LIBERTAS_SDIO=m
 NEED_LIBERTAS=y
-endif #CONFIG_COMPAT_KERNEL_27
+endif #CONFIG_COMPAT_KERNEL_2_6_27
 
 CONFIG_IWM=m
 # CONFIG_IWM_DEBUG=y
@@ -574,13 +587,13 @@ CONFIG_RT2800_LIB=m
 CONFIG_RT2X00_LIB_FIRMWARE=y
 CONFIG_RT2X00_LIB_CRYPTO=y
 # CONFIG_RT2X00_LIB_SOC=y
-ifdef CONFIG_COMPAT_KERNEL_25
+ifdef CONFIG_COMPAT_KERNEL_2_6_25
 CONFIG_RT2X00_LIB_LEDS=n
-else #CONFIG_COMPAT_KERNEL_25
+else #CONFIG_COMPAT_KERNEL_2_6_25
 ifdef CONFIG_LEDS_CLASS
 CONFIG_RT2X00_LIB_LEDS=y
 endif #CONFIG_LEDS_CLASS
-endif #CONFIG_COMPAT_KERNEL_25
+endif #CONFIG_COMPAT_KERNEL_2_6_25
 # CONFIG_RT2X00_DEBUG=y
 # CONFIG_RT2X00_LIB_DEBUGFS
 endif
@@ -608,24 +621,24 @@ endif #CONFIG_CRC7
 
 CONFIG_MWIFIEX=m
 
-ifdef CONFIG_COMPAT_KERNEL_27
+ifdef CONFIG_COMPAT_KERNEL_2_6_27
 CONFIG_LIBERTAS=n
-else #CONFIG_COMPAT_KERNEL_27
+else #CONFIG_COMPAT_KERNEL_2_6_27
 ifeq ($(NEED_LIBERTAS),y)
 CONFIG_LIBERTAS_THINFIRM=m
 CONFIG_LIBERTAS=m
 CONFIG_LIBERTAS_MESH=y
 # CONFIG_LIBERTAS_DEBUG=y
 endif
-endif #CONFIG_COMPAT_KERNEL_27
+endif #CONFIG_COMPAT_KERNEL_2_6_27
 
 # We need the backported rfkill module on kernel < 2.6.31.
 # In more recent kernel versions use the in kernel rfkill module.
-ifdef CONFIG_COMPAT_KERNEL_31
+ifdef CONFIG_COMPAT_KERNEL_2_6_31
 CONFIG_RFKILL_BACKPORT=m
 ifdef CONFIG_LEDS_TRIGGERS
 CONFIG_RFKILL_BACKPORT_LEDS=y
 endif #CONFIG_LEDS_TRIGGERS
 CONFIG_RFKILL_BACKPORT_INPUT=y
-endif #CONFIG_COMPAT_KERNEL_31
+endif #CONFIG_COMPAT_KERNEL_2_6_31
 
--- a/scripts/admin-update.sh
+++ b/scripts/admin-update.sh
@@ -18,7 +18,7 @@
 GIT_URL="git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git"
 GIT_COMPAT_URL="git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/compat.git"
 
-INCLUDE_NET_BT="hci_core.h l2cap.h bluetooth.h rfcomm.h hci.h mgmt.h"
+INCLUDE_NET_BT="hci_core.h l2cap.h bluetooth.h rfcomm.h hci.h mgmt.h smp.h"
 NET_BT_DIRS="bluetooth bluetooth/bnep bluetooth/cmtp bluetooth/rfcomm bluetooth/hidp"
 
 INCLUDE_LINUX="ieee80211.h nl80211.h"
@@ -259,7 +259,7 @@ DRIVERS_BT="drivers/bluetooth"
 # Drivers that belong the the wireless directory
 DRIVER_FILES="adm8211.c  adm8211.h"
 DRIVER_FILES="$DRIVER_FILES rndis_wlan.c"
-DRIVER_FILES="$DRIVER_FILES mac80211_hwsim.c"
+DRIVER_FILES="$DRIVER_FILES mac80211_hwsim.c mac80211_hwsim.h"
 DRIVER_FILES="$DRIVER_FILES at76c50x-usb.c at76c50x-usb.h"
 DRIVER_FILES="$DRIVER_FILES mwl8k.c"
 
--- a/scripts/gen-compat-autoconf.sh
+++ b/scripts/gen-compat-autoconf.sh
@@ -148,11 +148,11 @@ kernel_version_req $OLDEST_KERNEL_SUPPOR
 for i in $(egrep '^CONFIG_|^ifdef CONFIG_|^ifndef CONFIG_|^endif #CONFIG_|^else #CONFIG_' $COMPAT_CONFIG | sed 's/ /+/'); do
 	case $i in
 	'ifdef+CONFIG_'* )
-		echo "#$i" | sed -e 's/+/ /' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,\2))/' -e 's/\(#ifdef \)\(CONFIG_[^:space:]*\)/#if defined(\2) || defined(\2_MODULE)/'
+		echo "#$i" | sed -e 's/+/ /' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_3_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(3,\2,0))/' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_2_6_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,\2))/' -e 's/\(#ifdef \)\(CONFIG_[^:space:]*\)/#if defined(\2) || defined(\2_MODULE)/'
 		continue
 		;;
 	'ifndef+CONFIG_'* )
-		echo "#$i" | sed -e 's/+/ /' -e 's/\(ifndef CONFIG_COMPAT_KERNEL_\)\([0-9]*\)/if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,\2))/' -e 's/\(#ifndef \)\(CONFIG_[^:space:]*\)/#if !defined(\2) && !defined(\2_MODULE)/'
+		echo "#$i" | sed -e 's/+/ /' -e 's/\(ifndef CONFIG_COMPAT_KERNEL_3_\)\([0-9]*\)/if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,\2,0))/' -e 's/\(ifndef CONFIG_COMPAT_KERNEL_2_6_\)\([0-9]*\)/if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,\2))/' -e 's/\(#ifndef \)\(CONFIG_[^:space:]*\)/#if !defined(\2) && !defined(\2_MODULE)/'
 		continue
 		;;
 	'else+#CONFIG_'* | 'endif+#CONFIG_'* )
@@ -184,8 +184,9 @@ done
 # Deal with special cases. CONFIG_MAC80211_QOS is such a case.
 # We handle this specially for different kernels we support.
 if [ -f $KLIB_BUILD/Makefile ]; then
-	SUBLEVEL=$(make -C $KLIB_BUILD kernelversion | sed -n 's/^2\.6\.\([0-9]\+\).*/\1/p')
-	if [ $SUBLEVEL -le 22 ]; then
+	MAJORLEVEL=$(make -C $KLIB_BUILD kernelversion | sed -n 's/^\([0-9]\)\..*/\1/p')
+	SUBLEVEL=$(make -C $KLIB_BUILD kernelversion | sed -n 's/^\(2\.6\|[3-9]\)\.\([0-9]\+\).*/\2/p')
+	if [ $MAJORLEVEL -eq 2 -a $SUBLEVEL -le 22 ]; then
 		define_config CONFIG_MAC80211_QOS y
 	else # kernel >= 2.6.23
 		# CONFIG_MAC80211_QOS on these kernels requires