2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
4 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
5 * Copyright 2008 Luis R. Rodriguez <lrodriguz@atheros.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
13 * DOC: Wireless regulatory infrastructure
15 * The usual implementation is for a driver to read a device EEPROM to
16 * determine which regulatory domain it should be operating under, then
17 * looking up the allowable channels in a driver-local table and finally
18 * registering those channels in the wiphy structure.
20 * Another set of compliance enforcement is for drivers to use their
21 * own compliance limits which can be stored on the EEPROM. The host
22 * driver or firmware may ensure these are used.
24 * In addition to all this we provide an extra layer of regulatory
25 * conformance. For drivers which do not have any regulatory
26 * information CRDA provides the complete regulatory solution.
27 * For others it provides a community effort on further restrictions
28 * to enhance compliance.
30 * Note: When number of rules --> infinity we will not be able to
31 * index on alpha2 any more, instead we'll probably have to
32 * rely on some SHA1 checksum of the regdomain for example.
35 #include <linux/kernel.h>
36 #include <linux/list.h>
37 #include <linux/random.h>
38 #include <linux/nl80211.h>
39 #include <linux/platform_device.h>
40 #include <net/wireless.h>
41 #include <net/cfg80211.h>
45 /* wiphy is set if this request's initiator is REGDOM_SET_BY_DRIVER */
46 struct regulatory_request
{
48 enum reg_set_by initiator
;
52 static struct regulatory_request
*last_request
;
54 /* To trigger userspace events */
55 static struct platform_device
*reg_pdev
;
57 /* Keep the ordering from large to small */
58 static u32 supported_bandwidths
[] = {
63 /* Central wireless core regulatory domains, we only need two,
64 * the current one and a world regulatory domain in case we have no
65 * information to give us an alpha2 */
66 static const struct ieee80211_regdomain
*cfg80211_regdomain
;
68 /* We keep a static world regulatory domain in case of the absence of CRDA */
69 static const struct ieee80211_regdomain world_regdom
= {
73 REG_RULE(2412-10, 2462+10, 40, 6, 20,
74 NL80211_RRF_PASSIVE_SCAN
|
79 static const struct ieee80211_regdomain
*cfg80211_world_regdom
=
82 #ifdef CONFIG_WIRELESS_OLD_REGULATORY
83 static char *ieee80211_regdom
= "US";
84 module_param(ieee80211_regdom
, charp
, 0444);
85 MODULE_PARM_DESC(ieee80211_regdom
, "IEEE 802.11 regulatory domain code");
87 /* We assume 40 MHz bandwidth for the old regulatory work.
88 * We make emphasis we are using the exact same frequencies
91 static const struct ieee80211_regdomain us_regdom
= {
95 /* IEEE 802.11b/g, channels 1..11 */
96 REG_RULE(2412-10, 2462+10, 40, 6, 27, 0),
97 /* IEEE 802.11a, channel 36 */
98 REG_RULE(5180-10, 5180+10, 40, 6, 23, 0),
99 /* IEEE 802.11a, channel 40 */
100 REG_RULE(5200-10, 5200+10, 40, 6, 23, 0),
101 /* IEEE 802.11a, channel 44 */
102 REG_RULE(5220-10, 5220+10, 40, 6, 23, 0),
103 /* IEEE 802.11a, channels 48..64 */
104 REG_RULE(5240-10, 5320+10, 40, 6, 23, 0),
105 /* IEEE 802.11a, channels 149..165, outdoor */
106 REG_RULE(5745-10, 5825+10, 40, 6, 30, 0),
110 static const struct ieee80211_regdomain jp_regdom
= {
114 /* IEEE 802.11b/g, channels 1..14 */
115 REG_RULE(2412-10, 2484+10, 40, 6, 20, 0),
116 /* IEEE 802.11a, channels 34..48 */
117 REG_RULE(5170-10, 5240+10, 40, 6, 20,
118 NL80211_RRF_PASSIVE_SCAN
),
119 /* IEEE 802.11a, channels 52..64 */
120 REG_RULE(5260-10, 5320+10, 40, 6, 20,
121 NL80211_RRF_NO_IBSS
|
126 static const struct ieee80211_regdomain eu_regdom
= {
128 /* This alpha2 is bogus, we leave it here just for stupid
129 * backward compatibility */
132 /* IEEE 802.11b/g, channels 1..13 */
133 REG_RULE(2412-10, 2472+10, 40, 6, 20, 0),
134 /* IEEE 802.11a, channel 36 */
135 REG_RULE(5180-10, 5180+10, 40, 6, 23,
136 NL80211_RRF_PASSIVE_SCAN
),
137 /* IEEE 802.11a, channel 40 */
138 REG_RULE(5200-10, 5200+10, 40, 6, 23,
139 NL80211_RRF_PASSIVE_SCAN
),
140 /* IEEE 802.11a, channel 44 */
141 REG_RULE(5220-10, 5220+10, 40, 6, 23,
142 NL80211_RRF_PASSIVE_SCAN
),
143 /* IEEE 802.11a, channels 48..64 */
144 REG_RULE(5240-10, 5320+10, 40, 6, 20,
145 NL80211_RRF_NO_IBSS
|
147 /* IEEE 802.11a, channels 100..140 */
148 REG_RULE(5500-10, 5700+10, 40, 6, 30,
149 NL80211_RRF_NO_IBSS
|
154 static const struct ieee80211_regdomain
*static_regdom(char *alpha2
)
156 if (alpha2
[0] == 'U' && alpha2
[1] == 'S')
158 if (alpha2
[0] == 'J' && alpha2
[1] == 'P')
160 if (alpha2
[0] == 'E' && alpha2
[1] == 'U')
162 /* Default, as per the old rules */
166 static bool is_old_static_regdom(const struct ieee80211_regdomain
*rd
)
168 if (rd
== &us_regdom
|| rd
== &jp_regdom
|| rd
== &eu_regdom
)
173 static inline bool is_old_static_regdom(const struct ieee80211_regdomain
*rd
)
179 static void reset_regdomains(void)
181 /* avoid freeing static information or freeing something twice */
182 if (cfg80211_regdomain
== cfg80211_world_regdom
)
183 cfg80211_regdomain
= NULL
;
184 if (cfg80211_world_regdom
== &world_regdom
)
185 cfg80211_world_regdom
= NULL
;
186 if (cfg80211_regdomain
== &world_regdom
)
187 cfg80211_regdomain
= NULL
;
188 if (is_old_static_regdom(cfg80211_regdomain
))
189 cfg80211_regdomain
= NULL
;
191 kfree(cfg80211_regdomain
);
192 kfree(cfg80211_world_regdom
);
194 cfg80211_world_regdom
= &world_regdom
;
195 cfg80211_regdomain
= NULL
;
198 /* Dynamic world regulatory domain requested by the wireless
199 * core upon initialization */
200 static void update_world_regdomain(const struct ieee80211_regdomain
*rd
)
202 BUG_ON(!last_request
);
206 cfg80211_world_regdom
= rd
;
207 cfg80211_regdomain
= rd
;
210 bool is_world_regdom(const char *alpha2
)
214 if (alpha2
[0] == '0' && alpha2
[1] == '0')
219 static bool is_alpha2_set(const char *alpha2
)
223 if (alpha2
[0] != 0 && alpha2
[1] != 0)
228 static bool is_alpha_upper(char letter
)
231 if (letter
>= 65 && letter
<= 90)
236 static bool is_unknown_alpha2(const char *alpha2
)
240 /* Special case where regulatory domain was built by driver
241 * but a specific alpha2 cannot be determined */
242 if (alpha2
[0] == '9' && alpha2
[1] == '9')
247 static bool is_an_alpha2(const char *alpha2
)
251 if (is_alpha_upper(alpha2
[0]) && is_alpha_upper(alpha2
[1]))
256 static bool alpha2_equal(const char *alpha2_x
, const char *alpha2_y
)
258 if (!alpha2_x
|| !alpha2_y
)
260 if (alpha2_x
[0] == alpha2_y
[0] &&
261 alpha2_x
[1] == alpha2_y
[1])
266 static bool regdom_changed(const char *alpha2
)
268 if (!cfg80211_regdomain
)
270 if (alpha2_equal(cfg80211_regdomain
->alpha2
, alpha2
))
275 /* This lets us keep regulatory code which is updated on a regulatory
276 * basis in userspace. */
277 static int call_crda(const char *alpha2
)
279 char country_env
[9 + 2] = "COUNTRY=";
285 if (!is_world_regdom((char *) alpha2
))
286 printk(KERN_INFO
"cfg80211: Calling CRDA for country: %c%c\n",
287 alpha2
[0], alpha2
[1]);
289 printk(KERN_INFO
"cfg80211: Calling CRDA to update world "
290 "regulatory domain\n");
292 country_env
[8] = alpha2
[0];
293 country_env
[9] = alpha2
[1];
295 return kobject_uevent_env(®_pdev
->dev
.kobj
, KOBJ_CHANGE
, envp
);
298 /* This has the logic which determines when a new request
299 * should be ignored. */
300 static int ignore_request(struct wiphy
*wiphy
, enum reg_set_by set_by
,
301 char *alpha2
, struct ieee80211_regdomain
*rd
)
303 /* All initial requests are respected */
308 case REGDOM_SET_BY_INIT
:
310 case REGDOM_SET_BY_CORE
:
311 /* Always respect new wireless core hints, should only
312 * come in for updating the world regulatory domain at init
315 case REGDOM_SET_BY_COUNTRY_IE
:
316 if (last_request
->initiator
== REGDOM_SET_BY_COUNTRY_IE
) {
317 if (last_request
->wiphy
!= wiphy
) {
318 /* Two cards with two APs claiming different
319 * different Country IE alpha2s!
320 * You're special!! */
321 if (!alpha2_equal(last_request
->alpha2
,
322 cfg80211_regdomain
->alpha2
)) {
323 /* XXX: Deal with conflict, consider
324 * building a new one out of the
331 /* Two consecutive Country IE hints on the same wiphy */
332 if (!alpha2_equal(cfg80211_regdomain
->alpha2
, alpha2
))
336 if (WARN_ON(!is_alpha2_set(alpha2
) || !is_an_alpha2(alpha2
)),
337 "Invalid Country IE regulatory hint passed "
338 "to the wireless core\n")
340 /* We ignore Country IE hints for now, as we haven't yet
341 * added the dot11MultiDomainCapabilityEnabled flag
344 case REGDOM_SET_BY_DRIVER
:
346 if (last_request
->initiator
== REGDOM_SET_BY_DRIVER
) {
347 /* Two separate drivers hinting different things,
348 * this is possible if you have two devices present
349 * on a system with different EEPROM regulatory
350 * readings. XXX: Do intersection, we support only
351 * the first regulatory hint for now */
352 if (last_request
->wiphy
!= wiphy
)
356 /* Driver should not be trying to hint different
357 * regulatory domains! */
358 BUG_ON(!alpha2_equal(alpha2
,
359 cfg80211_regdomain
->alpha2
));
362 if (last_request
->initiator
== REGDOM_SET_BY_CORE
)
364 /* XXX: Handle intersection, and add the
365 * dot11MultiDomainCapabilityEnabled flag to wiphy. For now
366 * we assume the driver has this set to false, following the
367 * 802.11d dot11MultiDomainCapabilityEnabled documentation */
368 if (last_request
->initiator
== REGDOM_SET_BY_COUNTRY_IE
)
371 case REGDOM_SET_BY_USER
:
372 if (last_request
->initiator
== REGDOM_SET_BY_USER
||
373 last_request
->initiator
== REGDOM_SET_BY_CORE
)
375 /* Drivers can use their wiphy's reg_notifier()
376 * to override any information */
377 if (last_request
->initiator
== REGDOM_SET_BY_DRIVER
)
379 /* XXX: Handle intersection */
380 if (last_request
->initiator
== REGDOM_SET_BY_COUNTRY_IE
)
388 /* Used by nl80211 before kmalloc'ing our regulatory domain */
389 bool reg_is_valid_request(const char *alpha2
)
394 return alpha2_equal(last_request
->alpha2
, alpha2
);
397 /* Sanity check on a regulatory rule */
398 static bool is_valid_reg_rule(const struct ieee80211_reg_rule
*rule
)
400 const struct ieee80211_freq_range
*freq_range
= &rule
->freq_range
;
403 if (freq_range
->start_freq_khz
== 0 || freq_range
->end_freq_khz
== 0)
406 if (freq_range
->start_freq_khz
> freq_range
->end_freq_khz
)
409 freq_diff
= freq_range
->end_freq_khz
- freq_range
->start_freq_khz
;
411 if (freq_range
->max_bandwidth_khz
> freq_diff
)
417 static bool is_valid_rd(const struct ieee80211_regdomain
*rd
)
419 const struct ieee80211_reg_rule
*reg_rule
= NULL
;
422 if (!rd
->n_reg_rules
)
425 for (i
= 0; i
< rd
->n_reg_rules
; i
++) {
426 reg_rule
= &rd
->reg_rules
[i
];
427 if (!is_valid_reg_rule(reg_rule
))
434 /* Returns value in KHz */
435 static u32
freq_max_bandwidth(const struct ieee80211_freq_range
*freq_range
,
439 for (i
= 0; i
< ARRAY_SIZE(supported_bandwidths
); i
++) {
440 u32 start_freq_khz
= freq
- supported_bandwidths
[i
]/2;
441 u32 end_freq_khz
= freq
+ supported_bandwidths
[i
]/2;
442 if (start_freq_khz
>= freq_range
->start_freq_khz
&&
443 end_freq_khz
<= freq_range
->end_freq_khz
)
444 return supported_bandwidths
[i
];
449 /* XXX: add support for the rest of enum nl80211_reg_rule_flags, we may
450 * want to just have the channel structure use these */
451 static u32
map_regdom_flags(u32 rd_flags
)
453 u32 channel_flags
= 0;
454 if (rd_flags
& NL80211_RRF_PASSIVE_SCAN
)
455 channel_flags
|= IEEE80211_CHAN_PASSIVE_SCAN
;
456 if (rd_flags
& NL80211_RRF_NO_IBSS
)
457 channel_flags
|= IEEE80211_CHAN_NO_IBSS
;
458 if (rd_flags
& NL80211_RRF_DFS
)
459 channel_flags
|= IEEE80211_CHAN_RADAR
;
460 return channel_flags
;
464 * freq_reg_info - get regulatory information for the given frequency
465 * @center_freq: Frequency in KHz for which we want regulatory information for
466 * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one
467 * you can set this to 0. If this frequency is allowed we then set
468 * this value to the maximum allowed bandwidth.
469 * @reg_rule: the regulatory rule which we have for this frequency
471 * Use this function to get the regulatory rule for a specific frequency.
473 static int freq_reg_info(u32 center_freq
, u32
*bandwidth
,
474 const struct ieee80211_reg_rule
**reg_rule
)
477 u32 max_bandwidth
= 0;
479 if (!cfg80211_regdomain
)
482 for (i
= 0; i
< cfg80211_regdomain
->n_reg_rules
; i
++) {
483 const struct ieee80211_reg_rule
*rr
;
484 const struct ieee80211_freq_range
*fr
= NULL
;
485 const struct ieee80211_power_rule
*pr
= NULL
;
487 rr
= &cfg80211_regdomain
->reg_rules
[i
];
488 fr
= &rr
->freq_range
;
489 pr
= &rr
->power_rule
;
490 max_bandwidth
= freq_max_bandwidth(fr
, center_freq
);
491 if (max_bandwidth
&& *bandwidth
<= max_bandwidth
) {
493 *bandwidth
= max_bandwidth
;
498 return !max_bandwidth
;
501 static void handle_channel(struct ieee80211_channel
*chan
)
504 u32 flags
= chan
->orig_flags
;
505 u32 max_bandwidth
= 0;
506 const struct ieee80211_reg_rule
*reg_rule
= NULL
;
507 const struct ieee80211_power_rule
*power_rule
= NULL
;
509 r
= freq_reg_info(MHZ_TO_KHZ(chan
->center_freq
),
510 &max_bandwidth
, ®_rule
);
513 flags
|= IEEE80211_CHAN_DISABLED
;
518 power_rule
= ®_rule
->power_rule
;
520 chan
->flags
= flags
| map_regdom_flags(reg_rule
->flags
);
521 chan
->max_antenna_gain
= min(chan
->orig_mag
,
522 (int) MBI_TO_DBI(power_rule
->max_antenna_gain
));
523 chan
->max_bandwidth
= KHZ_TO_MHZ(max_bandwidth
);
525 chan
->max_power
= min(chan
->orig_mpwr
,
526 (int) MBM_TO_DBM(power_rule
->max_eirp
));
528 chan
->max_power
= (int) MBM_TO_DBM(power_rule
->max_eirp
);
531 static void handle_band(struct ieee80211_supported_band
*sband
)
535 for (i
= 0; i
< sband
->n_channels
; i
++)
536 handle_channel(&sband
->channels
[i
]);
539 static void update_all_wiphy_regulatory(enum reg_set_by setby
)
541 struct cfg80211_registered_device
*drv
;
543 list_for_each_entry(drv
, &cfg80211_drv_list
, list
)
544 wiphy_update_regulatory(&drv
->wiphy
, setby
);
547 void wiphy_update_regulatory(struct wiphy
*wiphy
, enum reg_set_by setby
)
549 enum ieee80211_band band
;
550 for (band
= 0; band
< IEEE80211_NUM_BANDS
; band
++) {
551 if (wiphy
->bands
[band
])
552 handle_band(wiphy
->bands
[band
]);
553 if (wiphy
->reg_notifier
)
554 wiphy
->reg_notifier(wiphy
, setby
);
558 /* Caller must hold &cfg80211_drv_mutex */
559 int __regulatory_hint(struct wiphy
*wiphy
, enum reg_set_by set_by
,
560 const char *alpha2
, struct ieee80211_regdomain
*rd
)
562 struct regulatory_request
*request
;
566 r
= ignore_request(wiphy
, set_by
, (char *) alpha2
, rd
);
571 rd_alpha2
= rd
->alpha2
;
573 rd_alpha2
= (char *) alpha2
;
576 case REGDOM_SET_BY_CORE
:
577 case REGDOM_SET_BY_COUNTRY_IE
:
578 case REGDOM_SET_BY_DRIVER
:
579 case REGDOM_SET_BY_USER
:
580 request
= kzalloc(sizeof(struct regulatory_request
),
585 request
->alpha2
[0] = rd_alpha2
[0];
586 request
->alpha2
[1] = rd_alpha2
[1];
587 request
->initiator
= set_by
;
588 request
->wiphy
= wiphy
;
591 last_request
= request
;
594 r
= call_crda(alpha2
);
595 #ifndef CONFIG_WIRELESS_OLD_REGULATORY
597 printk(KERN_ERR
"cfg80211: Failed calling CRDA\n");
608 /* If rd is not NULL and if this call fails the caller must free it */
609 int regulatory_hint(struct wiphy
*wiphy
, const char *alpha2
,
610 struct ieee80211_regdomain
*rd
)
613 BUG_ON(!rd
&& !alpha2
);
615 mutex_lock(&cfg80211_drv_mutex
);
617 r
= __regulatory_hint(wiphy
, REGDOM_SET_BY_DRIVER
, alpha2
, rd
);
619 goto unlock_and_exit
;
621 /* If the driver passed a regulatory domain we skipped asking
622 * userspace for one so we can now go ahead and set it */
626 mutex_unlock(&cfg80211_drv_mutex
);
629 EXPORT_SYMBOL(regulatory_hint
);
632 static void print_rd_rules(const struct ieee80211_regdomain
*rd
)
635 const struct ieee80211_reg_rule
*reg_rule
= NULL
;
636 const struct ieee80211_freq_range
*freq_range
= NULL
;
637 const struct ieee80211_power_rule
*power_rule
= NULL
;
639 printk(KERN_INFO
"\t(start_freq - end_freq @ bandwidth), "
640 "(max_antenna_gain, max_eirp)\n");
642 for (i
= 0; i
< rd
->n_reg_rules
; i
++) {
643 reg_rule
= &rd
->reg_rules
[i
];
644 freq_range
= ®_rule
->freq_range
;
645 power_rule
= ®_rule
->power_rule
;
647 /* There may not be documentation for max antenna gain
648 * in certain regions */
649 if (power_rule
->max_antenna_gain
)
650 printk(KERN_INFO
"\t(%d KHz - %d KHz @ %d KHz), "
651 "(%d mBi, %d mBm)\n",
652 freq_range
->start_freq_khz
,
653 freq_range
->end_freq_khz
,
654 freq_range
->max_bandwidth_khz
,
655 power_rule
->max_antenna_gain
,
656 power_rule
->max_eirp
);
658 printk(KERN_INFO
"\t(%d KHz - %d KHz @ %d KHz), "
660 freq_range
->start_freq_khz
,
661 freq_range
->end_freq_khz
,
662 freq_range
->max_bandwidth_khz
,
663 power_rule
->max_eirp
);
667 static void print_regdomain(const struct ieee80211_regdomain
*rd
)
670 if (is_world_regdom(rd
->alpha2
))
671 printk(KERN_INFO
"cfg80211: World regulatory "
672 "domain updated:\n");
674 if (is_unknown_alpha2(rd
->alpha2
))
675 printk(KERN_INFO
"cfg80211: Regulatory domain "
676 "changed to driver built-in settings "
677 "(unknown country)\n");
679 printk(KERN_INFO
"cfg80211: Regulatory domain "
680 "changed to country: %c%c\n",
681 rd
->alpha2
[0], rd
->alpha2
[1]);
686 void print_regdomain_info(const struct ieee80211_regdomain
*rd
)
688 printk(KERN_INFO
"cfg80211: Regulatory domain: %c%c\n",
689 rd
->alpha2
[0], rd
->alpha2
[1]);
693 static int __set_regdom(const struct ieee80211_regdomain
*rd
)
695 /* Some basic sanity checks first */
697 if (is_world_regdom(rd
->alpha2
)) {
698 if (WARN_ON(!reg_is_valid_request(rd
->alpha2
)))
700 update_world_regdomain(rd
);
704 if (!is_alpha2_set(rd
->alpha2
) && !is_an_alpha2(rd
->alpha2
) &&
705 !is_unknown_alpha2(rd
->alpha2
))
711 /* allow overriding the static definitions if CRDA is present */
712 if (!is_old_static_regdom(cfg80211_regdomain
) &&
713 !regdom_changed(rd
->alpha2
))
716 /* Now lets set the regulatory domain, update all driver channels
717 * and finally inform them of what we have done, in case they want
718 * to review or adjust their own settings based on their own
719 * internal EEPROM data */
721 if (WARN_ON(!reg_is_valid_request(rd
->alpha2
)))
726 /* Country IE parsing coming soon */
727 switch (last_request
->initiator
) {
728 case REGDOM_SET_BY_CORE
:
729 case REGDOM_SET_BY_DRIVER
:
730 case REGDOM_SET_BY_USER
:
731 if (!is_valid_rd(rd
)) {
732 printk(KERN_ERR
"cfg80211: Invalid "
733 "regulatory domain detected:\n");
734 print_regdomain_info(rd
);
738 case REGDOM_SET_BY_COUNTRY_IE
: /* Not yet */
745 cfg80211_regdomain
= rd
;
751 /* Use this call to set the current regulatory domain. Conflicts with
752 * multiple drivers can be ironed out later. Caller must've already
753 * kmalloc'd the rd structure. If this calls fails you should kfree()
754 * the passed rd. Caller must hold cfg80211_drv_mutex */
755 int set_regdom(const struct ieee80211_regdomain
*rd
)
759 /* Note that this doesn't update the wiphys, this is done below */
760 r
= __set_regdom(rd
);
764 /* This would make this whole thing pointless */
765 BUG_ON(rd
!= cfg80211_regdomain
);
767 /* update all wiphys now with the new established regulatory domain */
768 update_all_wiphy_regulatory(last_request
->initiator
);
775 int regulatory_init(void)
779 reg_pdev
= platform_device_register_simple("regulatory", 0, NULL
, 0);
780 if (IS_ERR(reg_pdev
))
781 return PTR_ERR(reg_pdev
);
783 #ifdef CONFIG_WIRELESS_OLD_REGULATORY
784 cfg80211_regdomain
= static_regdom(ieee80211_regdom
);
786 printk(KERN_INFO
"cfg80211: Using static regulatory domain info\n");
787 print_regdomain_info(cfg80211_regdomain
);
788 /* The old code still requests for a new regdomain and if
789 * you have CRDA you get it updated, otherwise you get
790 * stuck with the static values. We ignore "EU" code as
791 * that is not a valid ISO / IEC 3166 alpha2 */
792 if (ieee80211_regdom
[0] != 'E' || ieee80211_regdom
[1] != 'U')
793 err
= __regulatory_hint(NULL
, REGDOM_SET_BY_CORE
,
794 ieee80211_regdom
, NULL
);
796 cfg80211_regdomain
= cfg80211_world_regdom
;
798 err
= __regulatory_hint(NULL
, REGDOM_SET_BY_CORE
, "00", NULL
);
800 printk(KERN_ERR
"cfg80211: calling CRDA failed - "
801 "unable to update world regulatory domain, "
802 "using static definition\n");
808 void regulatory_exit(void)
810 mutex_lock(&cfg80211_drv_mutex
);
816 platform_device_unregister(reg_pdev
);
818 mutex_unlock(&cfg80211_drv_mutex
);