drivers/net/wireless/ath/ath9k/debug.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath9k/debug.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath9k/debug.c- Extension
.c- Size
- 41334 bytes
- Lines
- 1462
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/slab.hlinux/vmalloc.hlinux/export.hlinux/unaligned.hath9k.h
Detected Declarations
function Copyrightfunction ath9k_debugfs_read_buffunction ath9k_debugfs_release_buffunction read_file_debugfunction write_file_debugfunction read_file_anifunction write_file_anifunction read_file_bt_ant_diversityfunction write_file_bt_ant_diversityfunction ath9k_debug_stat_antfunction read_file_antenna_diversityfunction read_file_dmafunction ath_debug_stat_interruptfunction read_file_interruptfunction read_file_xmitfunction print_queuefunction read_file_queuesfunction read_file_miscfunction read_file_resetfunction open_file_resetfunction write_file_resetfunction ath_debug_stat_txfunction ath_debug_stat_rxfunction read_file_regidxfunction write_file_regidxfunction read_file_regvalfunction write_file_regvalfunction open_file_regdumpfunction read_file_dump_nfcalfunction read_file_btcoexfunction read_file_acktofunction read_file_wowfunction write_file_wowfunction read_file_tpcfunction write_file_tpcfunction read_file_nf_overridefunction write_file_nf_overridefunction ath9k_get_et_stringsfunction ath9k_get_et_sset_countfunction ath9k_get_et_statsfunction ath9k_deinit_debugfunction ath9k_init_debug
Annotated Snippet
static const struct file_operations fops_debug = {
.read = read_file_debug,
.write = write_file_debug,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
#endif
#define DMA_BUF_LEN 1024
static ssize_t read_file_ani(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath_softc *sc = file->private_data;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ath_hw *ah = sc->sc_ah;
unsigned int len = 0;
const unsigned int size = 1024;
ssize_t retval = 0;
char *buf;
int i;
struct {
const char *name;
unsigned int val;
} ani_info[] = {
{ "ANI RESET", ah->stats.ast_ani_reset },
{ "OFDM LEVEL", ah->ani.ofdmNoiseImmunityLevel },
{ "CCK LEVEL", ah->ani.cckNoiseImmunityLevel },
{ "SPUR UP", ah->stats.ast_ani_spurup },
{ "SPUR DOWN", ah->stats.ast_ani_spurdown },
{ "OFDM WS-DET ON", ah->stats.ast_ani_ofdmon },
{ "OFDM WS-DET OFF", ah->stats.ast_ani_ofdmoff },
{ "MRC-CCK ON", ah->stats.ast_ani_ccklow },
{ "MRC-CCK OFF", ah->stats.ast_ani_cckhigh },
{ "FIR-STEP UP", ah->stats.ast_ani_stepup },
{ "FIR-STEP DOWN", ah->stats.ast_ani_stepdown },
{ "INV LISTENTIME", ah->stats.ast_ani_lneg_or_lzero },
{ "OFDM ERRORS", ah->stats.ast_ani_ofdmerrs },
{ "CCK ERRORS", ah->stats.ast_ani_cckerrs },
};
buf = kzalloc(size, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;
len += scnprintf(buf + len, size - len, "%15s: %s\n", "ANI",
common->disable_ani ? "DISABLED" : "ENABLED");
if (common->disable_ani)
goto exit;
for (i = 0; i < ARRAY_SIZE(ani_info); i++)
len += scnprintf(buf + len, size - len, "%15s: %u\n",
ani_info[i].name, ani_info[i].val);
exit:
if (len > size)
len = size;
retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
kfree(buf);
return retval;
}
static ssize_t write_file_ani(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath_softc *sc = file->private_data;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
unsigned long ani;
ssize_t ret;
ret = kstrtoul_from_user(user_buf, count, 0, &ani);
if (ret)
return ret;
if (ani > 1)
return -EINVAL;
common->disable_ani = !ani;
if (common->disable_ani) {
clear_bit(ATH_OP_ANI_RUN, &common->op_flags);
ath_stop_ani(sc);
} else {
Annotation
- Immediate include surface: `linux/slab.h`, `linux/vmalloc.h`, `linux/export.h`, `linux/unaligned.h`, `ath9k.h`.
- Detected declarations: `function Copyright`, `function ath9k_debugfs_read_buf`, `function ath9k_debugfs_release_buf`, `function read_file_debug`, `function write_file_debug`, `function read_file_ani`, `function write_file_ani`, `function read_file_bt_ant_diversity`, `function write_file_bt_ant_diversity`, `function ath9k_debug_stat_ant`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.