wireless: update regulatory sample code
Subsystems (2)
PATCH 1/1 wireless: update regulatory sample code
Update the same code for the recent changes. I did this as a separate patch to avoid removing a lot of sample code only to add it back again in the next patch.
--- Documentation/networking/regulatory.txt | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
Documentation/networking/regulatory.txt +8 -11
@@ -131,7 +131,7 @@ are expected to do this during initializ r = zd_reg2alpha2(mac->regdomain, alpha2); if (!r) - regulatory_hint(hw->wiphy, alpha2, NULL); + regulatory_hint(alpha2); Example code - drivers providing a built in regulatory domain: --------------------------------------------------------------
@@ -178,17 +178,14 @@ Then in some part of your code after you rd = kzalloc(size_of_regd, GFP_KERNEL); if (!rd) - return -ENOMEM; + return -ENOMEM; memcpy(rd, &mydriver_jp_regdom, sizeof(struct ieee80211_regdomain)); - for (i=0; i < num_rules; i++) { - memcpy(&rd->reg_rules[i], &mydriver_jp_regdom.reg_rules[i], - sizeof(struct ieee80211_reg_rule)); - } - r = regulatory_hint(hw->wiphy, NULL, rd); - if (r) { - kfree(rd); - return r; - } + for (i=0; i < num_rules; i++) + memcpy(&rd->reg_rules[i], + &mydriver_jp_regdom.reg_rules[i], + sizeof(struct ieee80211_reg_rule)); + regulatory_struct_hint(rd, BIT(IEEE80211_BAND_2GHZ) | + BIT(IEEE80211_BAND_5GHZ));
Quoted 12 lines · Johannes Berg
Update the same code for the recent changes. I did this as a separate patch to avoid removing a lot of sample code only to add it back again in the next patch.
Signed-off-by Johannes Berg <[email protected]>--- Documentation/networking/regulatory.txt | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
Documentation/networking/regulatory.txt 2008-10-22 20:54:12.000000000 +0200 are expected to do this during initializ · line 136
Quoted 7 lines
Documentation/networking/regulatory.txt 2008-10-22 20:54:12.000000000 +0200 renamed from Documentation/networking/regulatory.txt 2008-10-22 20:51:50.000000000 +0200 +1
-1@@ -131,7 +131,7 @@ are expected to do this during initializ r = zd_reg2alpha2(mac->regdomain, alpha2); if (!r) - regulatory_hint(hw->wiphy, alpha2, NULL); + regulatory_hint(alpha2); Example code - drivers providing a built in regulatory domain:
Should we mention how currently this should be avoided unless your regulatory definition is also intersected with hw capabilities and that the same channels are the ones that are registered to cfg80211?
Luis
Quoted 19 lines · Luis R. Rodriguez
Quoted 18 lines · Johannes Berg
Update the same code for the recent changes. I did this as a separate patch to avoid removing a lot of sample code only to add it back again in the next patch.
Signed-off-by Johannes Berg <[email protected]>--- Documentation/networking/regulatory.txt | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)Documentation/networking/regulatory.txt 2008-10-22 20:54:12.000000000 +0200 renamed from Documentation/networking/regulatory.txt 2008-10-22 20:51:50.000000000 +0200 +1
-1@@ -131,7 +131,7 @@ are expected to do this during initializ r = zd_reg2alpha2(mac->regdomain, alpha2); if (!r) - regulatory_hint(hw->wiphy, alpha2, NULL); + regulatory_hint(alpha2);
Quoted 5 lines
Documentation/networking/regulatory.txt 2008-10-22 20:54:12.000000000 +0200 are expected to do this during initializ · line 136
Quoted 1 line
Documentation/networking/regulatory.txt 2008-10-22 20:54:12.000000000 +0200 renamed from Documentation/networking/regulatory.txt 2008-10-22 20:51:50.000000000 +0200 +0
-0Example code - drivers providing a built in regulatory domain:Should we mention how currently this should be avoided unless your regulatory definition is also intersected with hw capabilities and that the same channels are the ones that are registered to cfg80211?
?
johannes
Quoted 20 lines · Johannes Berg
Quoted 19 lines · Luis R. Rodriguez
Quoted 18 lines · Johannes Berg
Update the same code for the recent changes. I did this as a separate patch to avoid removing a lot of sample code only to add it back again in the next patch.
Signed-off-by Johannes Berg <[email protected]>--- Documentation/networking/regulatory.txt | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)Documentation/networking/regulatory.txt 2008-10-22 20:54:12.000000000 +0200 renamed from Documentation/networking/regulatory.txt 2008-10-22 20:51:50.000000000 +0200 +1
-1@@ -131,7 +131,7 @@ are expected to do this during initializ r = zd_reg2alpha2(mac->regdomain, alpha2); if (!r) - regulatory_hint(hw->wiphy, alpha2, NULL); + regulatory_hint(alpha2);
Quoted 5 lines
Quoted 5 lines
Documentation/networking/regulatory.txt 2008-10-22 20:54:12.000000000 +0200 are expected to do this during initializ · line 136
Quoted 1 line
Documentation/networking/regulatory.txt 2008-10-22 20:54:12.000000000 +0200 renamed from Documentation/networking/regulatory.txt 2008-10-22 20:51:50.000000000 +0200 +0
-0Example code - drivers providing a built in regulatory domain:Should we mention how currently this should be avoided unless your regulatory definition is also intersected with hw capabilities and that the same channels are the ones that are registered to cfg80211?
Well rd hint for when we provide a structure, that code right now disregards when initiator == USER, and this works well only for when the driver sending the rd struct hint also only registered to cfg80211 the channels its legally capable of. If a driver which does not use reg_notifier() and registers *all* of its channels uses this then the USER set regdom will be used and *all* channels will be left intact.
Luis
Quoted 11 lines · Luis R. Rodriguez
Quoted 3 lines
Quoted 3 lines
Should we mention how currently this should be avoided unless your regulatory definition is also intersected with hw capabilities and that the same channels are the ones that are registered to cfg80211?
Well rd hint for when we provide a structure, that code right now disregards when initiator == USER, and this works well only for when the driver sending the rd struct hint also only registered to cfg80211 the channels its legally capable of. If a driver which does not use
reg_notifier()and registers *all* of its channels uses this then the USER set regdom will be used and *all* channels will be left intact.
No, only those that are available from CRDA will be used. And this is totally irrelevant in the case where this applies anyway because the Intel drivers register only the channels from their eeprom, the same set they hint at. Yet it's still unrelated.
johannes