cfg80211: ignore consecutive equal regulatory hints
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Thu, 22 Jan 2009 23:05:48 +0000 (15:05 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 29 Jan 2009 21:01:15 +0000 (16:01 -0500)
We ignore regulatory hints for the same alpha2 if we already
have processed the same alpha2 on the current regulatory domain.
For a driver regulatory_hint() this means we copy onto its
wiphy->regd the previously procesed regulatory domain from CRDA
without having to call CRDA again.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/wireless/reg.c

index 4d2d2d4..c201abd 100644 (file)
@@ -1080,8 +1080,13 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
                }
                return REG_INTERSECT;
        case REGDOM_SET_BY_DRIVER:
-               if (last_request->initiator == REGDOM_SET_BY_CORE)
-                       return 0;
+               if (last_request->initiator == REGDOM_SET_BY_CORE) {
+                       if (is_old_static_regdom(cfg80211_regdomain))
+                               return 0;
+                       if (!alpha2_equal(cfg80211_regdomain->alpha2, alpha2))
+                               return 0;
+                       return -EALREADY;
+               }
                return REG_INTERSECT;
        case REGDOM_SET_BY_USER:
                if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE)
@@ -1101,6 +1106,10 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
                                return -EAGAIN;
                }
 
+               if (!is_old_static_regdom(cfg80211_regdomain) &&
+                   alpha2_equal(cfg80211_regdomain->alpha2, alpha2))
+                       return -EALREADY;
+
                return 0;
        }