madwifi: add patch for building all modules (except for the HAL) into a single module...
[openwrt/svn-archive/archive.git] / package / madwifi / patches / 446-single_module.patch
1 --- a/ath/Makefile
2 +++ b/ath/Makefile
3 @@ -41,7 +41,6 @@
4 #
5
6 obj := $(firstword $(obj) $(SUBDIRS) .)
7 -TOP = $(obj)/..
8
9 ifeq ($(strip $(BUS)),AHB)
10 BUSNAME=ahb
11 @@ -57,7 +56,24 @@ COPTS += -DDFS_DOMAIN_ETSI -DDFS_DOMAIN_
12 include $(TOP)/Makefile.inc
13
14 obj-m += ath_$(BUSNAME).o
15 -ath_$(BUSNAME)-objs := if_ath.o if_ath_radar.o if_ath_$(BUSNAME).o
16 +ath_objs := if_ath.o if_ath_radar.o if_ath_$(BUSNAME).o
17 +ath_$(BUSNAME)-objs := $(ath_objs)
18 +
19 +ifneq ($(SINGLE_MODULE),)
20 +include $(TOP)/net80211/Makefile
21 +include $(TOP)/ath_rate/sample/Makefile
22 +include $(TOP)/ath_rate/minstrel/Makefile
23 +RC_DECLARE=$(foreach R,$(ATH_RATE),extern void ath_rate_$(R)_init(void);extern void ath_rate_$(R)_exit(void);)
24 +RC_INIT=$(foreach R,$(ATH_RATE),ath_rate_$(R)_init();)
25 +RC_EXIT=$(foreach R,$(ATH_RATE),ath_rate_$(R)_exit();)
26 +
27 +ath_$(BUSNAME)-objs += $(patsubst %,../net80211/%,$(wlan-objs) $(foreach var,wep tkip ccmp acl xauth scan_sta scan_ap,$(wlan_$(var)-objs))) $(foreach RC,$(ATH_RATE),$(patsubst %,../ath_rate/$(RC)/%,$(ath_rate_$(RC)-objs)))
28 +ifdef LINUX24
29 + ath_$(BUSNAME)-linkobjs := $(ath_objs) $(wlan-objs) $(foreach var,wep tkip ccmp acl xauth scan_sta scan_ap,$(wlan_$(var)-objs)) $(foreach RC,$(ATH_RATE),$(ath_rate_$(RC)-objs))
30 +endif
31 +
32 +EXTRA_CFLAGS += -DSINGLE_MODULE -DRC_INIT="$(RC_INIT)" -DRC_EXIT="$(RC_EXIT)" -DRC_DECLARE="$(RC_DECLARE)"
33 +endif
34
35 INCS += -I$(TOP) -I$(ATH_HAL) -I$(HAL) -I$(WLAN)
36
37 @@ -72,13 +88,8 @@ install:
38 test -d $(DESTDIR)/$(KMODPATH) || mkdir -p $(DESTDIR)/$(KMODPATH)
39 install -m 0644 ath_$(BUSNAME).$(KMODSUF) $(DESTDIR)/$(KMODPATH)
40
41 -clean:
42 - rm -f *~ *.o *.ko *.mod.c .*.cmd
43 - rm -f .depend .version .*.o.flags .*.o.d
44 - rm -rf .tmp_versions
45 -
46 ath_$(BUSNAME).o: $(ath_$(BUSNAME)-objs)
47 - $(LD) $(LDOPTS) -o ath_$(BUSNAME).$(KMODSUF) -r $(ath_$(BUSNAME)-objs)
48 + $(LD) $(LDOPTS) -o ath_$(BUSNAME).$(KMODSUF) -r $(if $(ath_$(BUSNAME)-linkobjs),$(ath_$(BUSNAME)-linkobjs),$(ath_$(BUSNAME)-objs))
49
50 if_ath_hal.h: $(HAL)/ah.h
51 $(TOP)/scripts/if_ath_hal_generator.pl $< $@
52 --- a/net80211/ieee80211_acl.c
53 +++ b/net80211/ieee80211_acl.c
54 @@ -281,16 +281,6 @@ acl_getpolicy(struct ieee80211vap *vap)
55 return as->as_policy;
56 }
57
58 -/*
59 - * Module glue.
60 - */
61 -
62 -MODULE_AUTHOR("Errno Consulting, Sam Leffler");
63 -MODULE_DESCRIPTION("802.11 wireless support: MAC-based ACL policy");
64 -#ifdef MODULE_LICENSE
65 -MODULE_LICENSE("Dual BSD/GPL");
66 -#endif
67 -
68 static const struct ieee80211_aclator mac = {
69 .iac_name = "mac",
70 .iac_attach = acl_attach,
71 @@ -303,6 +293,18 @@ static const struct ieee80211_aclator ma
72 .iac_getpolicy = acl_getpolicy,
73 };
74
75 +#include "module.h"
76 +/*
77 + * Module glue.
78 + */
79 +
80 +MODULE_AUTHOR("Errno Consulting, Sam Leffler");
81 +MODULE_DESCRIPTION("802.11 wireless support: MAC-based ACL policy");
82 +#ifdef MODULE_LICENSE
83 +MODULE_LICENSE("Dual BSD/GPL");
84 +#endif
85 +
86 +
87 static int __init
88 init_ieee80211_acl(void)
89 {
90 --- a/net80211/ieee80211_crypto_ccmp.c
91 +++ b/net80211/ieee80211_crypto_ccmp.c
92 @@ -686,6 +686,8 @@ ccmp_decrypt(struct ieee80211_key *key,
93 }
94 #undef CCMP_DECRYPT
95
96 +#include "module.h"
97 +
98 /*
99 * Module glue.
100 */
101 --- a/net80211/ieee80211_crypto_tkip.c
102 +++ b/net80211/ieee80211_crypto_tkip.c
103 @@ -1046,6 +1046,8 @@ tkip_decrypt(struct tkip_ctx *ctx, struc
104 return 1;
105 }
106
107 +#include "module.h"
108 +
109 /*
110 * Module glue.
111 */
112 --- a/net80211/ieee80211_crypto_wep.c
113 +++ b/net80211/ieee80211_crypto_wep.c
114 @@ -497,6 +497,8 @@ wep_decrypt(struct ieee80211_key *key, s
115 * Module glue.
116 */
117
118 +#include "module.h"
119 +
120 MODULE_AUTHOR("Errno Consulting, Sam Leffler");
121 MODULE_DESCRIPTION("802.11 wireless support: WEP cipher");
122 #ifdef MODULE_LICENSE
123 --- a/net80211/ieee80211_linux.c
124 +++ b/net80211/ieee80211_linux.c
125 @@ -1015,6 +1015,10 @@ static struct notifier_block ieee80211_e
126 static char *version = RELEASE_VERSION;
127 static char *dev_info = "wlan";
128
129 +extern void ieee80211_auth_setup(void);
130 +
131 +#include "module.h"
132 +
133 MODULE_AUTHOR("Errno Consulting, Sam Leffler");
134 MODULE_DESCRIPTION("802.11 wireless LAN protocol support");
135 #ifdef MODULE_VERSION
136 @@ -1024,8 +1028,6 @@ MODULE_VERSION(RELEASE_VERSION);
137 MODULE_LICENSE("Dual BSD/GPL");
138 #endif
139
140 -extern void ieee80211_auth_setup(void);
141 -
142 static int __init
143 init_wlan(void)
144 {
145 --- a/net80211/ieee80211_scan_ap.c
146 +++ b/net80211/ieee80211_scan_ap.c
147 @@ -763,15 +763,6 @@ action_tasklet(IEEE80211_TQUEUE_ARG data
148 (*ss->ss_ops->scan_default)(vap, &as->as_selbss);
149 }
150
151 -/*
152 - * Module glue.
153 - */
154 -MODULE_AUTHOR("Errno Consulting, Sam Leffler");
155 -MODULE_DESCRIPTION("802.11 wireless support: default ap scanner");
156 -#ifdef MODULE_LICENSE
157 -MODULE_LICENSE("Dual BSD/GPL");
158 -#endif
159 -
160 static const struct ieee80211_scanner ap_default = {
161 .scan_name = "default",
162 .scan_attach = ap_attach,
163 @@ -789,6 +780,16 @@ static const struct ieee80211_scanner ap
164 .scan_default = ap_default_action,
165 };
166
167 +#include "module.h"
168 +
169 +/*
170 + * Module glue.
171 + */
172 +MODULE_AUTHOR("Errno Consulting, Sam Leffler");
173 +MODULE_DESCRIPTION("802.11 wireless support: default ap scanner");
174 +#ifdef MODULE_LICENSE
175 +MODULE_LICENSE("Dual BSD/GPL");
176 +#endif
177
178 static int __init
179 init_scanner_ap(void)
180 --- a/net80211/ieee80211_scan_sta.c
181 +++ b/net80211/ieee80211_scan_sta.c
182 @@ -1208,6 +1208,8 @@ action_tasklet(IEEE80211_TQUEUE_ARG data
183 ieee80211_start_scan(vap, ss->ss_flags, ss->ss_duration, ss->ss_nssid, ss->ss_ssid);
184 }
185
186 +#include "module.h"
187 +
188 /*
189 * Module glue.
190 */
191 @@ -1217,6 +1219,7 @@ MODULE_DESCRIPTION("802.11 wireless supp
192 MODULE_LICENSE("Dual BSD/GPL");
193 #endif
194
195 +
196 static int __init
197 init_scanner_sta(void)
198 {
199 --- a/net80211/ieee80211_xauth.c
200 +++ b/net80211/ieee80211_xauth.c
201 @@ -65,15 +65,6 @@
202 #include <net80211/ieee80211_var.h>
203
204 /*
205 - * Module glue.
206 - */
207 -MODULE_AUTHOR("Errno Consulting, Sam Leffler");
208 -MODULE_DESCRIPTION("802.11 wireless support: external (user mode) authenticator");
209 -#ifdef MODULE_LICENSE
210 -MODULE_LICENSE("Dual BSD/GPL");
211 -#endif
212 -
213 -/*
214 * One module handles everything for now. May want
215 * to split things up for embedded applications.
216 */
217 @@ -85,6 +76,18 @@ static const struct ieee80211_authentica
218 .ia_node_leave = NULL,
219 };
220
221 +#include "module.h"
222 +
223 +/*
224 + * Module glue.
225 + */
226 +MODULE_AUTHOR("Errno Consulting, Sam Leffler");
227 +MODULE_DESCRIPTION("802.11 wireless support: external (user mode) authenticator");
228 +#ifdef MODULE_LICENSE
229 +MODULE_LICENSE("Dual BSD/GPL");
230 +#endif
231 +
232 +
233 static int __init
234 init_ieee80211_xauth(void)
235 {
236 --- a/net80211/Makefile
237 +++ b/net80211/Makefile
238 @@ -40,7 +40,11 @@
239 # Makefile for the 802.11 WLAN modules.
240 #
241 obj := $(firstword $(obj) $(SUBDIRS) .)
242 -TOP = $(obj)/..
243 +
244 +include $(TOP)/Makefile.inc
245 +
246 +ifeq ($(SINGLE_MODULE),)
247 +
248 #
249 # There is one authenticator mechanism: an in-kernel implementation
250 # (wlan_xauth).
251 @@ -59,29 +63,8 @@ MOD_INSTALL := wlan.o wlan_wep.o wlan_tk
252
253 obj-m += $(MOD_INSTALL)
254
255 -wlan-objs := if_media.o \
256 - ieee80211_skb.o \
257 - ieee80211.o ieee80211_beacon.o ieee80211_crypto.o \
258 - ieee80211_crypto_none.o ieee80211_input.o ieee80211_node.o \
259 - ieee80211_output.o ieee80211_power.o ieee80211_proto.o \
260 - ieee80211_scan.o ieee80211_wireless.o ieee80211_linux.o \
261 - ieee80211_monitor.o ieee80211_rate.o
262 -wlan_wep-objs := ieee80211_crypto_wep.o
263 -wlan_tkip-objs := ieee80211_crypto_tkip.o
264 -wlan_ccmp-objs := ieee80211_crypto_ccmp.o
265 -wlan_acl-objs := ieee80211_acl.o
266 -wlan_xauth-objs := ieee80211_xauth.o
267 -wlan_scan_sta-objs :=ieee80211_scan_sta.o
268 -wlan_scan_ap-objs := ieee80211_scan_ap.o
269 -
270 -include $(TOP)/Makefile.inc
271 -
272 INCS += -I$(TOP) -I$(ATH_HAL) -I$(HAL)
273
274 -EXTRA_CFLAGS+=$(INCS) $(COPTS) -DOPT_AH_H=\"public/$(TARGET).opt_ah.h\"
275 -
276 --include $(TOPDIR)/Rules.make
277 -
278 all:
279 $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules
280
281 @@ -108,8 +91,28 @@ install:
282 f=`basename $$i .o`; \
283 install -m 0644 $$f.$(KMODSUF) $(DESTDIR)/$(KMODPATH); \
284 done
285 +else
286 +all:
287 +endif
288 +
289 +wlan-objs := if_media.o \
290 + ieee80211_skb.o \
291 + ieee80211.o ieee80211_beacon.o ieee80211_crypto.o \
292 + ieee80211_crypto_none.o ieee80211_input.o ieee80211_node.o \
293 + ieee80211_output.o ieee80211_power.o ieee80211_proto.o \
294 + ieee80211_scan.o ieee80211_wireless.o ieee80211_linux.o \
295 + ieee80211_monitor.o ieee80211_rate.o
296 +wlan_wep-objs := ieee80211_crypto_wep.o
297 +wlan_tkip-objs := ieee80211_crypto_tkip.o
298 +wlan_ccmp-objs := ieee80211_crypto_ccmp.o
299 +wlan_acl-objs := ieee80211_acl.o
300 +wlan_xauth-objs := ieee80211_xauth.o
301 +wlan_scan_sta-objs :=ieee80211_scan_sta.o
302 +wlan_scan_ap-objs := ieee80211_scan_ap.o
303 +
304 +
305 +EXTRA_CFLAGS+=$(INCS) $(COPTS) -DOPT_AH_H=\"public/$(TARGET).opt_ah.h\"
306 +
307 +-include $(TOPDIR)/Rules.make
308 +
309
310 -clean:
311 - -rm -f *~ *.o *.ko *.mod.c
312 - -rm -f .depend .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd
313 - -rm -rf .tmp_versions
314 --- /dev/null
315 +++ b/net80211/module.h
316 @@ -0,0 +1,19 @@
317 +#ifdef SINGLE_MODULE
318 +
319 +#undef static
320 +#define static
321 +#undef module_init
322 +#undef module_exit
323 +#define module_init(...)
324 +#define module_exit(...)
325 +
326 +#undef MODULE_AUTHOR
327 +#undef MODULE_LICENSE
328 +#undef MODULE_VERSION
329 +#undef MODULE_DESCRIPTION
330 +#define MODULE_AUTHOR(...)
331 +#define MODULE_LICENSE(...)
332 +#define MODULE_VERSION(...)
333 +#define MODULE_DESCRIPTION(...)
334 +
335 +#endif
336 --- a/ath/if_ath.c
337 +++ b/ath/if_ath.c
338 @@ -13777,3 +13777,5 @@ cleanup_ath_buf(struct ath_softc *sc, st
339 return bf;
340 }
341
342 +
343 +
344 --- a/net80211/ieee80211.c
345 +++ b/net80211/ieee80211.c
346 @@ -42,6 +42,7 @@
347 #include <linux/config.h>
348 #endif
349 #include <linux/version.h>
350 +#include <linux/init.h>
351 #include <linux/module.h>
352 #include <linux/skbuff.h>
353 #include <linux/netdevice.h>
354 @@ -2014,3 +2015,65 @@ ieee80211_build_sc_ie(struct ieee80211co
355 int ath_debug_global = 0;
356 EXPORT_SYMBOL(ath_debug_global);
357
358 +#ifdef SINGLE_MODULE
359 +typedef void (*initfunc)(void);
360 +
361 +extern void init_ieee80211_acl(void);
362 +extern void init_crypto_ccmp(void);
363 +extern void init_crypto_tkip(void);
364 +extern void init_crypto_wep(void);
365 +extern void init_wlan(void);
366 +extern void init_scanner_ap(void);
367 +extern void init_scanner_sta(void);
368 +extern void init_ieee80211_xauth(void);
369 +
370 +extern void exit_ieee80211_acl(void);
371 +extern void exit_crypto_ccmp(void);
372 +extern void exit_crypto_tkip(void);
373 +extern void exit_crypto_wep(void);
374 +extern void exit_wlan(void);
375 +extern void exit_scanner_ap(void);
376 +extern void exit_scanner_sta(void);
377 +extern void exit_ieee80211_xauth(void);
378 +
379 +static __initdata initfunc net80211_init[] = {
380 + init_wlan,
381 + init_ieee80211_acl,
382 + init_crypto_ccmp,
383 + init_crypto_tkip,
384 + init_crypto_wep,
385 + init_ieee80211_xauth,
386 + init_scanner_ap,
387 + init_scanner_sta,
388 +};
389 +
390 +static __exitdata initfunc net80211_exit[] = {
391 + exit_crypto_ccmp,
392 + exit_crypto_tkip,
393 + exit_crypto_wep,
394 + exit_scanner_ap,
395 + exit_scanner_sta,
396 + exit_ieee80211_xauth,
397 + exit_ieee80211_acl,
398 + exit_wlan,
399 +};
400 +
401 +void net80211_init_module(void)
402 +{
403 + int i;
404 + for (i = 0; i < sizeof(net80211_init)/sizeof(net80211_init[0]); i++) {
405 + if (net80211_init[i])
406 + net80211_init[i]();
407 + }
408 +}
409 +
410 +void net80211_exit_module(void)
411 +{
412 + int i;
413 + for (i = 0; i < sizeof(net80211_exit)/sizeof(net80211_exit[0]); i++) {
414 + if (net80211_exit[i])
415 + net80211_exit[i]();
416 + }
417 +}
418 +
419 +#endif
420 --- a/ath/if_ath_ahb.c
421 +++ b/ath/if_ath_ahb.c
422 @@ -447,10 +447,18 @@ MODULE_SUPPORTED_DEVICE("Atheros WLAN ca
423 MODULE_LICENSE("Dual BSD/GPL");
424 #endif
425
426 +#ifdef SINGLE_MODULE
427 +RC_DECLARE
428 +#endif
429 +
430 static int __init
431 init_ath_ahb(void)
432 {
433 printk(KERN_INFO "%s: %s\n", dev_info, version);
434 +#ifdef SINGLE_MODULE
435 + net80211_init_module();
436 + RC_INIT
437 +#endif
438 platform_driver_register(&ahb_wmac_driver);
439 ath_sysctl_register();
440
441 @@ -463,6 +471,10 @@ exit_ath_ahb(void)
442 {
443 ath_sysctl_unregister();
444 platform_driver_unregister(&ahb_wmac_driver);
445 +#ifdef SINGLE_MODULE
446 + RC_EXIT
447 + net80211_exit_module();
448 +#endif
449 printk(KERN_INFO "%s: driver unloaded\n", dev_info);
450 }
451 module_exit(exit_ath_ahb);
452 --- a/ath/if_ath_pci.c
453 +++ b/ath/if_ath_pci.c
454 @@ -415,11 +415,19 @@ MODULE_SUPPORTED_DEVICE("Atheros WLAN ca
455 MODULE_LICENSE("Dual BSD/GPL");
456 #endif
457
458 +#ifdef SINGLE_MODULE
459 +RC_DECLARE
460 +#endif
461 +
462 static int __init
463 init_ath_pci(void)
464 {
465 printk(KERN_INFO "%s: %s\n", dev_info, version);
466
467 +#ifdef SINGLE_MODULE
468 + net80211_init_module();
469 + RC_INIT
470 +#endif
471 if (pci_register_driver(&ath_pci_driver) < 0) {
472 printk(KERN_ERR "%s: No devices found, driver not installed.\n", dev_info);
473 return (-ENODEV);
474 @@ -434,6 +442,10 @@ exit_ath_pci(void)
475 {
476 ath_sysctl_unregister();
477 pci_unregister_driver(&ath_pci_driver);
478 +#ifdef SINGLE_MODULE
479 + RC_EXIT
480 + net80211_exit_module();
481 +#endif
482
483 printk(KERN_INFO "%s: driver unloaded\n", dev_info);
484 }
485 --- a/ath_rate/minstrel/Makefile
486 +++ b/ath_rate/minstrel/Makefile
487 @@ -39,9 +39,7 @@
488 # Makefile for the Atheros Rate Control Support.
489 #
490 obj := $(firstword $(obj) $(SUBDIRS) .)
491 -TOP = $(obj)/../..
492
493 -obj-m += ath_rate_minstrel.o
494 ath_rate_minstrel-objs := minstrel.o
495
496 include $(TOP)/Makefile.inc
497 @@ -50,6 +48,10 @@ INCS += -I$(TOP) -I$(ATH) -I$(ATH_HAL) -
498
499 EXTRA_CFLAGS+= $(INCS) $(COPTS) -DOPT_AH_H=\"public/$(TARGET).opt_ah.h\"
500
501 +ifeq ($(SINGLE_MODULE),)
502 +
503 +obj-m += ath_rate_minstrel.o
504 +
505 -include $(TOPDIR)/Rules.make
506
507 all:
508 @@ -59,10 +61,9 @@ install:
509 test -d $(DESTDIR)/$(KMODPATH) || mkdir -p $(DESTDIR)/$(KMODPATH)
510 install -m 0644 ath_rate_minstrel.$(KMODSUF) $(DESTDIR)/$(KMODPATH)
511
512 -clean:
513 - -rm -f *~ *.o *.ko *.mod.c
514 - -rm -f .depend .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd
515 - -rm -rf .tmp_versions
516 -
517 ath_rate_minstrel.o: $(ath_rate_minstrel-objs)
518 $(LD) $(LDOPTS) -o ath_rate_minstrel.$(KMODSUF) -r $(ath_rate_minstrel-objs)
519 +else
520 +all:
521 +install:
522 +endif
523 --- a/ath_rate/minstrel/minstrel.c
524 +++ b/ath_rate/minstrel/minstrel.c
525 @@ -945,6 +945,8 @@ static struct ieee80211_rate_ops ath_rat
526 .dynamic_proc_register = ath_rate_dynamic_proc_register,
527 };
528
529 +#include <net80211/module.h>
530 +
531 MODULE_AUTHOR("John Bicket/Derek Smithies");
532 MODULE_DESCRIPTION("Minstrel Rate bit-rate selection algorithm for Atheros devices");
533 #ifdef MODULE_VERSION
534 --- a/net80211/ieee80211_var.h
535 +++ b/net80211/ieee80211_var.h
536 @@ -47,6 +47,7 @@
537 #include <net80211/ieee80211_power.h>
538 #include <net80211/ieee80211_proto.h>
539 #include <net80211/ieee80211_scan.h>
540 +#include "symbol.h"
541
542 /* NB:
543 * - Atheros chips use 6 bits when power is specified in whole dBm units, with
544 @@ -741,6 +742,8 @@ void ieee80211_dfs_action(struct ieee802
545 void ieee80211_expire_channel_excl_restrictions(struct ieee80211com *);
546 void ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs);
547 int ieee80211_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
548 +void net80211_init_module(void);
549 +void net80211_exit_module(void);
550
551 /*
552 * Iterate through ic_channels to enumerate all distinct ic_ieee channel numbers.
553 --- a/net80211/ieee80211_linux.h
554 +++ b/net80211/ieee80211_linux.h
555 @@ -521,7 +521,10 @@ extern struct sk_buff * ieee80211_getmgt
556 #define IF_DRAIN(_q) skb_queue_drain(_q)
557 extern void skb_queue_drain(struct sk_buff_head *q);
558
559 -#ifndef __MOD_INC_USE_COUNT
560 +#ifdef SINGLE_MODULE
561 +#define _MOD_DEC_USE(_m) do {} while(0)
562 +#define _MOD_INC_USE(_m, _err) do {} while(0)
563 +#elif !defined(__MOD_INC_USE_COUNT)
564 #define _MOD_INC_USE(_m, _err) \
565 if (!try_module_get(_m)) { \
566 printk(KERN_WARNING "%s: try_module_get failed\n", \
567 --- a/ath_rate/sample/Makefile
568 +++ b/ath_rate/sample/Makefile
569 @@ -39,9 +39,7 @@
570 # Makefile for the Atheros Rate Control Support.
571 #
572 obj := $(firstword $(obj) $(SUBDIRS) .)
573 -TOP = $(obj)/../..
574
575 -obj-m += ath_rate_sample.o
576 ath_rate_sample-objs := sample.o
577
578 include $(TOP)/Makefile.inc
579 @@ -50,6 +48,9 @@ INCS += -I$(TOP) -I$(ATH) -I$(ATH_HAL) -
580
581 EXTRA_CFLAGS+= $(INCS) $(COPTS) -DOPT_AH_H=\"public/$(TARGET).opt_ah.h\"
582
583 +ifeq ($(SINGLE_MODULE),)
584 +obj-m += ath_rate_sample.o
585 +
586 -include $(TOPDIR)/Rules.make
587
588 all:
589 @@ -59,10 +60,9 @@ install:
590 test -d $(DESTDIR)/$(KMODPATH) || mkdir -p $(DESTDIR)/$(KMODPATH)
591 install -m 0644 ath_rate_sample.$(KMODSUF) $(DESTDIR)/$(KMODPATH)
592
593 -clean:
594 - -rm -f *~ *.o *.ko *.mod.c
595 - -rm -f .depend .version .*.o.flags .*.o.d .*.o.cmd .*.ko.cmd
596 - -rm -rf .tmp_versions
597 -
598 ath_rate_sample.o: $(ath_rate_sample-objs)
599 $(LD) $(LDOPTS) -o ath_rate_sample.$(KMODSUF) -r $(ath_rate_sample-objs)
600 +else
601 +all:
602 +install:
603 +endif
604 --- a/Makefile
605 +++ b/Makefile
606 @@ -41,7 +41,7 @@
607 #
608
609 obj := $(firstword $(obj) $(SUBDIRS) .)
610 -TOP = $(obj)
611 +export TOP:=$(if $(wildcard $(firstword $(SUBDIRS))/Makefile.inc),$(firstword $(SUBDIRS)),$(CURDIR))
612
613 ifneq (svnversion.h,$(MAKECMDGOALS))
614 include $(TOP)/Makefile.inc
615 @@ -54,7 +54,7 @@ all: modules tools
616 modules: configcheck svnversion.h
617 ifdef LINUX24
618 for i in $(obj-y); do \
619 - $(MAKE) -C $$i || exit 1; \
620 + $(MAKE) -C $$i TOP="$(TOP)" || exit 1; \
621 done
622 else
623 $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules
624 @@ -89,7 +89,7 @@ install-modules: modules
625 sh scripts/find-madwifi-modules.sh -r $(KERNELRELEASE) $(DESTDIR)
626
627 for i in $(obj-y); do \
628 - $(MAKE) -C $$i install || exit 1; \
629 + $(MAKE) -C $$i install TOP="$(TOP)" || exit 1; \
630 done
631 ifeq ($(DESTDIR),)
632 (export KMODPATH=$(KMODPATH); /sbin/depmod -ae $(KERNELRELEASE))
633 @@ -114,12 +114,21 @@ reinstall-tools: uninstall-tools install
634 reinstall-modules: uninstall-modules install-modules
635
636 clean:
637 - for i in $(obj-y); do \
638 - $(MAKE) -C $$i clean; \
639 - done
640 - -$(MAKE) -C $(TOOLS) clean
641 - rm -rf .tmp_versions
642 + -find $(obj-y) -name '*~' \
643 + -or -name '*.o' \
644 + -or -name '*.o.d' \
645 + -or -name '*.o.cmd' \
646 + -or -name '*.o.flags' \
647 + -or -name '*.ko' \
648 + -or -name '*.ko.cmd' \
649 + -or -name '*.mod.c' \
650 + -or -name '.depend' \
651 + -or -name '.version' \
652 + -or -name '.symvers' | \
653 + xargs -r rm -f
654 rm -f *.symvers svnversion.h
655 + rm -rf .tmp_versions
656 + make -C tools clean
657
658 info:
659 @echo "The following settings will be used for compilation:"
660 @@ -135,18 +144,6 @@ info:
661 @echo "KMODPATH : $(KMODPATH)"
662 @echo "KMODSUF : $(KMODSUF)"
663
664 -sanitycheck:
665 - @echo -n "Checking requirements... "
666 -
667 - @# check if specified rate control is available
668 - @if [ ! -d $(ATH_RATE) ]; then \
669 - echo "FAILED"; \
670 - echo "Selected rate control $(ATH_RATE) not available."; \
671 - exit 1; \
672 - fi
673 -
674 - @echo "ok."
675 -
676 .PHONY: release
677 release:
678 sh scripts/make-release.bash
679 @@ -155,7 +152,7 @@ release:
680 unload:
681 bash scripts/madwifi-unload
682
683 -configcheck: sanitycheck
684 +configcheck:
685 @echo -n "Checking kernel configuration... "
686
687 @# check version of kernel
688 --- a/Makefile.inc
689 +++ b/Makefile.inc
690 @@ -68,6 +68,9 @@ endif
691 export KERNELPATH
692 endif
693
694 +# build net80211 and ath_ahb/ath_pci into a single module
695 +export SINGLE_MODULE=1
696 +
697 # KERNELRELEASE is the target kernel's version. It's always taken from
698 # the kernel build tree. Kernel Makefile doesn't always know the exact
699 # kernel version (especially for vendor stock kernels), so we get it
700 @@ -100,6 +103,7 @@ export ARCH
701 include $(TOP)/ath_hal/ah_target.inc
702 export TARGET
703 COPTS += -DTARGET='"$(TARGET)"'
704 +COPTS += -DCONFIG_ATHEROS_RATE_DEFAULT='"$(firstword $(ATH_RATE))"'
705
706 # KMODPATH nominates the directory where the modules will be
707 # installed to
708 @@ -141,7 +145,7 @@ ATH= $(TOP)/ath
709 #
710 # Path to the rate control algorithms.
711 #
712 -ATH_RATE= $(TOP)/ath_rate
713 +ATH_RATE= minstrel
714 #
715 # Path to the userspace utilities.
716 #
717 --- a/ath_rate/sample/sample.c
718 +++ b/ath_rate/sample/sample.c
719 @@ -991,6 +991,8 @@ static struct ieee80211_rate_ops ath_rat
720 .dynamic_proc_register = ath_rate_dynamic_proc_register,
721 };
722
723 +#include <net80211/module.h>
724 +
725 MODULE_AUTHOR("John Bicket");
726 MODULE_DESCRIPTION("SampleRate bit-rate selection algorithm for Atheros devices");
727 #ifdef MODULE_VERSION
728 @@ -1000,18 +1002,17 @@ MODULE_VERSION(RELEASE_VERSION);
729 MODULE_LICENSE("Dual BSD/GPL");
730 #endif
731
732 -static int __init
733 -init_ath_rate_sample(void)
734 +static int __init ath_rate_sample_init(void)
735 {
736 printk(KERN_INFO "%s: %s\n", dev_info, version);
737 return ieee80211_rate_register(&ath_rate_ops);
738 }
739 -module_init(init_ath_rate_sample);
740 +module_init(ath_rate_sample_init);
741
742 static void __exit
743 -exit_ath_rate_sample(void)
744 +ath_rate_sample_exit(void)
745 {
746 ieee80211_rate_unregister(&ath_rate_ops);
747 printk(KERN_INFO "%s: unloaded\n", dev_info);
748 }
749 -module_exit(exit_ath_rate_sample);
750 +module_exit(ath_rate_sample_exit);
751 --- a/net80211/if_media.h
752 +++ b/net80211/if_media.h
753 @@ -42,6 +42,7 @@
754 #define _NET_IF_MEDIA_H_
755
756 #include <net80211/ieee80211_linux.h>
757 +#include "symbol.h"
758
759 /*
760 * Prototypes and definitions for BSD/OS-compatible network interface
761 --- /dev/null
762 +++ b/net80211/symbol.h
763 @@ -0,0 +1,4 @@
764 +#ifdef SINGLE_MODULE
765 +#undef EXPORT_SYMBOL
766 +#define EXPORT_SYMBOL(...)
767 +#endif
768 --- a/ath_rate/Makefile
769 +++ b/ath_rate/Makefile
770 @@ -1,7 +1,7 @@
771 obj := $(firstword $(obj) $(SUBDIRS) .)
772 TOP = $(obj)/..
773
774 -obj-y := amrr/ onoe/ sample/ minstrel/
775 +obj-y := sample/ minstrel/
776
777 include $(TOP)/Makefile.inc
778