Skip to content

Commit c8c240e

Browse files
committed
cfg80211: reg: remove support for built-in regdb
Parsing and building C structures from a regdb is no longer needed since the "firmware" file (regulatory.db) can be linked into the kernel image to achieve the same effect. Signed-off-by: Johannes Berg <[email protected]>
1 parent 1ea4ff3 commit c8c240e

File tree

8 files changed

+3
-287
lines changed

8 files changed

+3
-287
lines changed

Documentation/networking/regulatory.txt

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -200,23 +200,5 @@ Then in some part of your code after your wiphy has been registered:
200200
Statically compiled regulatory database
201201
---------------------------------------
202202

203-
In most situations the userland solution using CRDA as described
204-
above is the preferred solution. However in some cases a set of
205-
rules built into the kernel itself may be desirable. To account
206-
for this situation, a configuration option has been provided
207-
(i.e. CONFIG_CFG80211_INTERNAL_REGDB). With this option enabled,
208-
the wireless database information contained in net/wireless/db.txt is
209-
used to generate a data structure encoded in net/wireless/regdb.c.
210-
That option also enables code in net/wireless/reg.c which queries
211-
the data in regdb.c as an alternative to using CRDA.
212-
213-
The file net/wireless/db.txt should be kept up-to-date with the db.txt
214-
file available in the git repository here:
215-
216-
git://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git
217-
218-
Again, most users in most situations should be using the CRDA package
219-
provided with their distribution, and in most other situations users
220-
should be building and using CRDA on their own rather than using
221-
this option. If you are not absolutely sure that you should be using
222-
CONFIG_CFG80211_INTERNAL_REGDB then _DO_NOT_USE_IT_.
203+
When a database should be fixed into the kernel, it can be provided as a
204+
firmware file at build time that is then linked into the kernel.

net/wireless/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

net/wireless/Kconfig

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -140,30 +140,8 @@ config CFG80211_DEBUGFS
140140

141141
If unsure, say N.
142142

143-
config CFG80211_INTERNAL_REGDB
144-
bool "use statically compiled regulatory rules database" if EXPERT
145-
default n
146-
depends on CFG80211
147-
---help---
148-
This option generates an internal data structure representing
149-
the wireless regulatory rules described in net/wireless/db.txt
150-
and includes code to query that database. This is an alternative
151-
to using CRDA for defining regulatory rules for the kernel.
152-
153-
Using this option requires some parsing of the db.txt at build time,
154-
the parser will be upkept with the latest wireless-regdb updates but
155-
older wireless-regdb formats will be ignored. The parser may later
156-
be replaced to avoid issues with conflicts on versions of
157-
wireless-regdb.
158-
159-
For details see:
160-
161-
http://wireless.kernel.org/en/developers/Regulatory
162-
163-
Most distributions have a CRDA package. So if unsure, say N.
164-
165143
config CFG80211_CRDA_SUPPORT
166-
bool "support CRDA" if CFG80211_INTERNAL_REGDB
144+
bool "support CRDA" if EXPERT
167145
default y
168146
depends on CFG80211
169147
help

net/wireless/Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,5 @@ cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o trace.o ocb.o
1414
cfg80211-$(CONFIG_OF) += of.o
1515
cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o
1616
cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o
17-
cfg80211-$(CONFIG_CFG80211_INTERNAL_REGDB) += regdb.o
1817

1918
CFLAGS_trace.o := -I$(src)
20-
21-
$(obj)/regdb.c: $(src)/db.txt $(src)/genregdb.awk
22-
@$(AWK) -f $(srctree)/$(src)/genregdb.awk < $< > $@
23-
24-
clean-files := regdb.c

net/wireless/db.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.

net/wireless/genregdb.awk

Lines changed: 0 additions & 158 deletions
This file was deleted.

net/wireless/reg.c

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
#include "core.h"
6060
#include "reg.h"
6161
#include "rdev-ops.h"
62-
#include "regdb.h"
6362
#include "nl80211.h"
6463

6564
/*
@@ -495,38 +494,6 @@ static int reg_schedule_apply(const struct ieee80211_regdomain *regdom)
495494
return 0;
496495
}
497496

498-
#ifdef CONFIG_CFG80211_INTERNAL_REGDB
499-
static int reg_query_builtin(const char *alpha2)
500-
{
501-
const struct ieee80211_regdomain *regdom = NULL;
502-
unsigned int i;
503-
504-
for (i = 0; i < reg_regdb_size; i++) {
505-
if (alpha2_equal(alpha2, reg_regdb[i]->alpha2)) {
506-
regdom = reg_copy_regd(reg_regdb[i]);
507-
break;
508-
}
509-
}
510-
if (!regdom)
511-
return -ENODATA;
512-
513-
return reg_schedule_apply(regdom);
514-
}
515-
516-
/* Feel free to add any other sanity checks here */
517-
static void reg_regdb_size_check(void)
518-
{
519-
/* We should ideally BUILD_BUG_ON() but then random builds would fail */
520-
WARN_ONCE(!reg_regdb_size, "db.txt is empty, you should update it...");
521-
}
522-
#else
523-
static inline void reg_regdb_size_check(void) {}
524-
static inline int reg_query_builtin(const char *alpha2)
525-
{
526-
return -ENODATA;
527-
}
528-
#endif /* CONFIG_CFG80211_INTERNAL_REGDB */
529-
530497
#ifdef CONFIG_CFG80211_CRDA_SUPPORT
531498
/* Max number of consecutive attempts to communicate with CRDA */
532499
#define REG_MAX_CRDA_TIMEOUTS 10
@@ -885,10 +852,6 @@ int reg_reload_regdb(void)
885852

886853
static bool reg_query_database(struct regulatory_request *request)
887854
{
888-
/* query internal regulatory database (if it exists) */
889-
if (reg_query_builtin(request->alpha2) == 0)
890-
return true;
891-
892855
if (query_regdb_file(request->alpha2) == 0)
893856
return true;
894857

@@ -3580,8 +3543,6 @@ int __init regulatory_init(void)
35803543
spin_lock_init(&reg_pending_beacons_lock);
35813544
spin_lock_init(&reg_indoor_lock);
35823545

3583-
reg_regdb_size_check();
3584-
35853546
rcu_assign_pointer(cfg80211_regdomain, cfg80211_world_regdom);
35863547

35873548
user_alpha2[0] = '9';

net/wireless/regdb.h

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)