Commit fa1fb9cb1c734204018d2b4e6f38c4a9b4146612

Authored by Luis R. Rodriguez
Committed by Johannes Berg
1 parent cea85247f8

cfg80211: simplify strict custom alpha2 regdomain check

This makes it easier to read.

Cc: smihir@qti.qualcomm.com
Cc: tushnimb@qca.qualcomm.com
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Showing 1 changed file with 8 additions and 2 deletions Side-by-side Diff

... ... @@ -972,6 +972,13 @@
972 972 }
973 973 #endif
974 974  
  975 +static bool wiphy_strict_alpha2_regd(struct wiphy *wiphy)
  976 +{
  977 + if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY &&
  978 + !(wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY))
  979 + return true;
  980 + return false;
  981 +}
975 982  
976 983 static bool ignore_reg_update(struct wiphy *wiphy,
977 984 enum nl80211_reg_initiator initiator)
978 985  
... ... @@ -995,9 +1002,8 @@
995 1002 * wiphy->regd will be set once the device has its own
996 1003 * desired regulatory domain set
997 1004 */
998   - if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY && !wiphy->regd &&
  1005 + if (wiphy_strict_alpha2_regd(wiphy) && !wiphy->regd &&
999 1006 initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
1000   - !(wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) &&
1001 1007 !is_world_regdom(lr->alpha2)) {
1002 1008 REG_DBG_PRINT("Ignoring regulatory request %s since the driver requires its own regulatory domain to be set first\n",
1003 1009 reg_initiator_name(initiator));