drivers/net/wireless/ath/ath12k/debugfs.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath12k/debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath12k/debugfs.c- Extension
.c- Size
- 46440 bytes
- Lines
- 1585
- 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.
- 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
core.hdp_tx.hdebug.hdebugfs.hdebugfs_htt_stats.h
Detected Declarations
function Copyrightfunction ath12k_read_simulate_fw_crashfunction ath12k_write_simulate_fw_crashfunction ath12k_write_tpc_stats_typefunction ath12k_debug_tpc_stats_requestfunction ath12k_get_tpc_ctl_mode_idxfunction ath12k_tpc_get_ratefunction ath12k_get_ratecodefunction ath12k_he_supports_extra_mcsfunction ath12k_tpc_fill_preamfunction ath12k_tpc_stats_printfunction ath12k_tpc_stats_fillfunction ath12k_open_tpc_statsfunction ath12k_read_tpc_statsfunction ath12k_release_tpc_statsfunction ath12k_write_extd_rx_statsfunction ath12k_read_extd_rx_statsfunction ath12k_open_link_statsfunction ath12k_release_link_statsfunction ath12k_read_link_statsfunction ath12k_debugfs_op_vif_addfunction ath12k_debugfs_dump_device_dp_statsfunction ath12k_debugfs_pdev_createfunction ath12k_debugfs_soc_createfunction ath12k_debugfs_soc_destroyfunction ath12k_open_vdev_statsfunction ath12k_release_vdev_statsfunction ath12k_read_vdev_statsfunction ath12k_open_bcn_statsfunction ath12k_release_bcn_statsfunction ath12k_read_bcn_statsfunction ath12k_open_pdev_statsfunction ath12k_release_pdev_statsfunction ath12k_read_pdev_statsfunction ath12k_write_simulate_incumbent_signal_interferencefunction ath12k_debugfs_fw_stats_registerfunction ath12k_debugfs_registerfunction ath12k_debugfs_unregisterexport ath12k_debugfs_op_vif_add
Annotated Snippet
static const struct file_operations fops_simulate_radar = {
.write = ath12k_write_simulate_radar,
.open = simple_open
};
static ssize_t ath12k_read_simulate_fw_crash(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
const char buf[] =
"To simulate firmware crash write one of the keywords to this file:\n"
"`assert` - send WMI_FORCE_FW_HANG_CMDID to firmware to cause assert.\n";
return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));
}
static ssize_t
ath12k_write_simulate_fw_crash(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath12k_base *ab = file->private_data;
struct ath12k_pdev *pdev;
struct ath12k *ar = NULL;
char buf[32] = {};
int i, ret;
ssize_t rc;
/* filter partial writes and invalid commands */
if (*ppos != 0 || count >= sizeof(buf) || count == 0)
return -EINVAL;
rc = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);
if (rc < 0)
return rc;
/* drop the possible '\n' from the end */
if (buf[*ppos - 1] == '\n')
buf[*ppos - 1] = '\0';
for (i = 0; i < ab->num_radios; i++) {
pdev = &ab->pdevs[i];
ar = pdev->ar;
if (ar)
break;
}
if (!ar)
return -ENETDOWN;
if (!strcmp(buf, "assert")) {
ath12k_info(ab, "simulating firmware assert crash\n");
ret = ath12k_wmi_force_fw_hang_cmd(ar,
ATH12K_WMI_FW_HANG_ASSERT_TYPE,
ATH12K_WMI_FW_HANG_DELAY);
} else {
return -EINVAL;
}
if (ret) {
ath12k_warn(ab, "failed to simulate firmware crash: %d\n", ret);
return ret;
}
return count;
}
static const struct file_operations fops_simulate_fw_crash = {
.read = ath12k_read_simulate_fw_crash,
.write = ath12k_write_simulate_fw_crash,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
static ssize_t ath12k_write_tpc_stats_type(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath12k *ar = file->private_data;
u8 type;
int ret;
ret = kstrtou8_from_user(user_buf, count, 0, &type);
if (ret)
return ret;
if (type >= WMI_HALPHY_PDEV_TX_STATS_MAX)
return -EINVAL;
Annotation
- Immediate include surface: `core.h`, `dp_tx.h`, `debug.h`, `debugfs.h`, `debugfs_htt_stats.h`.
- Detected declarations: `function Copyright`, `function ath12k_read_simulate_fw_crash`, `function ath12k_write_simulate_fw_crash`, `function ath12k_write_tpc_stats_type`, `function ath12k_debug_tpc_stats_request`, `function ath12k_get_tpc_ctl_mode_idx`, `function ath12k_tpc_get_rate`, `function ath12k_get_ratecode`, `function ath12k_he_supports_extra_mcs`, `function ath12k_tpc_fill_pream`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.