drivers/net/wireless/ath/ath12k/reg.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath12k/reg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath12k/reg.c- Extension
.c- Size
- 28098 bytes
- Lines
- 995
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/rtnetlink.hcore.hdebug.hmac.h
Detected Declarations
function ath12k_regdom_changesfunction ath12k_reg_notifierfunction for_each_arfunction ath12k_reg_update_chan_listfunction ath12k_copy_regdfunction ath12k_regd_updatefunction ath12k_map_fw_dfs_regionfunction ath12k_get_bw_reg_flagsfunction ath12k_map_fw_reg_flagsfunction ath12k_map_fw_phy_flagsfunction ath12k_reg_get_regdom_strfunction ath12k_reg_adjust_bwfunction ath12k_reg_update_rulefunction ath12k_reg_update_weather_radar_bandfunction ath12k_reg_update_freq_rangefunction ath12k_reg_ap_pwr_convertfunction ath12k_reg_build_regdfunction ath12k_regd_update_chan_list_workfunction ath12k_regd_update_workfunction ath12k_reg_reset_reg_infofunction ath12k_reg_validate_reg_infofunction ath12k_reg_handle_chan_listfunction ath12k_reg_initfunction ath12k_reg_free
Annotated Snippet
for_each_ar(ah, ar, i) {
ret = ath12k_reg_update_chan_list(ar, true);
if (ret && ret != -EINVAL) {
ath12k_warn(ar->ab,
"failed to update chan list for pdev %u, ret %d\n",
i, ret);
break;
}
}
return;
}
/* Currently supporting only General User Hints. Cell base user
* hints to be handled later.
* Hints from other sources like Core, Beacons are not expected for
* self managed wiphy's
*/
if (!(request->initiator == NL80211_REGDOM_SET_BY_USER &&
request->user_reg_hint_type == NL80211_USER_REG_HINT_USER)) {
ath12k_warn(ar->ab, "Unexpected Regulatory event for this wiphy\n");
return;
}
if (!IS_ENABLED(CONFIG_ATH_REG_DYNAMIC_USER_REG_HINTS)) {
ath12k_dbg(ar->ab, ATH12K_DBG_REG,
"Country Setting is not allowed\n");
return;
}
if (!ath12k_regdom_changes(hw, request->alpha2)) {
ath12k_dbg(ar->ab, ATH12K_DBG_REG, "Country is already set\n");
return;
}
/* Allow fresh updates to wiphy regd */
ah->regd_updated = false;
/* Send the reg change request to all the radios */
for_each_ar(ah, ar, i) {
reinit_completion(&ar->regd_update_completed);
if (ar->ab->hw_params->current_cc_support) {
memcpy(¤t_arg.alpha2, request->alpha2, 2);
memcpy(&ar->alpha2, ¤t_arg.alpha2, 2);
ret = ath12k_wmi_send_set_current_country_cmd(ar, ¤t_arg);
if (ret)
ath12k_warn(ar->ab,
"failed set current country code: %d\n", ret);
} else {
arg.flags = ALPHA_IS_SET;
memcpy(&arg.cc_info.alpha2, request->alpha2, 2);
arg.cc_info.alpha2[2] = 0;
ret = ath12k_wmi_send_init_country_cmd(ar, &arg);
if (ret)
ath12k_warn(ar->ab,
"failed set INIT Country code: %d\n", ret);
}
wiphy_lock(wiphy);
ath12k_mac_11d_scan_stop(ar);
wiphy_unlock(wiphy);
ar->regdom_set_by_user = true;
}
}
int ath12k_reg_update_chan_list(struct ath12k *ar, bool wait)
{
struct ieee80211_supported_band **bands;
struct ath12k_wmi_scan_chan_list_arg *arg;
struct ieee80211_channel *channel;
struct ieee80211_hw *hw = ath12k_ar_to_hw(ar);
struct ath12k_wmi_channel_arg *ch;
enum nl80211_band band;
int num_channels = 0;
int i, ret = 0;
if (ar->ah->state == ATH12K_HW_STATE_RESTARTING)
return 0;
bands = hw->wiphy->bands;
for (band = 0; band < NUM_NL80211_BANDS; band++) {
if (!(ar->mac.sbands[band].channels && bands[band]))
continue;
for (i = 0; i < bands[band]->n_channels; i++) {
if (bands[band]->channels[i].flags &
IEEE80211_CHAN_DISABLED)
continue;
Annotation
- Immediate include surface: `linux/rtnetlink.h`, `core.h`, `debug.h`, `mac.h`.
- Detected declarations: `function ath12k_regdom_changes`, `function ath12k_reg_notifier`, `function for_each_ar`, `function ath12k_reg_update_chan_list`, `function ath12k_copy_regd`, `function ath12k_regd_update`, `function ath12k_map_fw_dfs_region`, `function ath12k_get_bw_reg_flags`, `function ath12k_map_fw_reg_flags`, `function ath12k_map_fw_phy_flags`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.