int ath_reg_notifier_apply(struct wiphy *wiphy, struct regulatory_request *request, struct ath_regulatory *reg) { struct ath_common *common = container_of(reg, struct ath_common, regulatory); u16 country_code; /* We always apply this */ ath_reg_apply_radar_flags(wiphy); /* * This would happen when we have sent a custom regulatory request * a world regulatory domain and the scheduler hasn't yet processed * any pending requests in the queue. */ if (!request) return 0; switch (request->initiator) { case NL80211_REGDOM_SET_BY_CORE: /* * If common->reg_world_copy is world roaming it means we *were* * world roaming... so we now have to restore that data. */ if (!ath_is_world_regd(&common->reg_world_copy)) break; memcpy(reg, &common->reg_world_copy, sizeof(struct ath_regulatory)); break; case NL80211_REGDOM_SET_BY_DRIVER: case NL80211_REGDOM_SET_BY_USER: break; case NL80211_REGDOM_SET_BY_COUNTRY_IE: if (!ath_is_world_regd(reg)) break; country_code = ath_regd_find_country_by_name(request->alpha2); if (country_code == (u16) -1) break; reg->current_rd = COUNTRY_ERD_FLAG; reg->current_rd |= country_code; printk(KERN_DEBUG "ath: regdomain 0x%0x updated by CountryIE\n", reg->current_rd); __ath_regd_init(reg); ath_reg_apply_world_flags(wiphy, request->initiator, reg); break; } return 0; }
int ath_reg_notifier_apply(struct wiphy *wiphy, struct regulatory_request *request, struct ath_regulatory *reg) { struct ath_common *common = container_of(reg, struct ath_common, regulatory); u16 country_code; ath_reg_apply_radar_flags(wiphy); if (!request) return 0; switch (request->initiator) { case NL80211_REGDOM_SET_BY_CORE: if (!ath_is_world_regd(&common->reg_world_copy)) break; memcpy(reg, &common->reg_world_copy, sizeof(struct ath_regulatory)); break; case NL80211_REGDOM_SET_BY_DRIVER: case NL80211_REGDOM_SET_BY_USER: break; case NL80211_REGDOM_SET_BY_COUNTRY_IE: if (!ath_is_world_regd(reg)) break; country_code = ath_regd_find_country_by_name(request->alpha2); if (country_code == (u16) -1) break; reg->current_rd = COUNTRY_ERD_FLAG; reg->current_rd |= country_code; printk(KERN_DEBUG "ath: regdomain 0x%0x updated by CountryIE\n", reg->current_rd); __ath_regd_init(reg); ath_reg_apply_world_flags(wiphy, request->initiator, reg); break; } return 0; }
int ath_regd_init(struct ath_regulatory *reg, struct wiphy *wiphy, void (*reg_notifier)(struct wiphy *wiphy, struct regulatory_request *request)) { struct ath_common *common = container_of(reg, struct ath_common, regulatory); int r; r = __ath_regd_init(reg); if (r) return r; if (ath_is_world_regd(reg)) memcpy(&common->reg_world_copy, reg, sizeof(struct ath_regulatory)); ath_regd_init_wiphy(reg, wiphy, reg_notifier); return 0; }
static int __ath_reg_dyn_country(struct wiphy *wiphy, struct ath_regulatory *reg, struct regulatory_request *request) { u16 country_code; if (request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE && !ath_is_world_regd(reg)) return -EINVAL; country_code = ath_regd_find_country_by_name(request->alpha2); if (country_code == (u16) -1) return -EINVAL; reg->current_rd = COUNTRY_ERD_FLAG; reg->current_rd |= country_code; __ath_regd_init(reg); ath_reg_apply_world_flags(wiphy, request->initiator, reg); return 0; }