Skip to content

Commit

Permalink
cfg80211: simplify strict custom alpha2 regdomain check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Luis R. Rodriguez authored and Johannes Berg committed Oct 11, 2013
1 parent cea8524 commit fa1fb9c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions net/wireless/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,13 @@ static bool reg_dev_ignore_cell_hint(struct wiphy *wiphy)
}
#endif

static bool wiphy_strict_alpha2_regd(struct wiphy *wiphy)
{
if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY &&
!(wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY))
return true;
return false;
}

static bool ignore_reg_update(struct wiphy *wiphy,
enum nl80211_reg_initiator initiator)
Expand All @@ -995,9 +1002,8 @@ static bool ignore_reg_update(struct wiphy *wiphy,
* wiphy->regd will be set once the device has its own
* desired regulatory domain set
*/
if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY && !wiphy->regd &&
if (wiphy_strict_alpha2_regd(wiphy) && !wiphy->regd &&
initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
!(wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) &&
!is_world_regdom(lr->alpha2)) {
REG_DBG_PRINT("Ignoring regulatory request %s since the driver requires its own regulatory domain to be set first\n",
reg_initiator_name(initiator));
Expand Down

0 comments on commit fa1fb9c

Please sign in to comment.