drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlwifi/fw/debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/iwlwifi/fw/debugfs.c- Extension
.c- Size
- 12403 bytes
- Lines
- 458
- 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.
- 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
api/commands.hdebugfs.hdbg.hlinux/hex.hlinux/seq_file.h
Detected Declarations
struct hcmd_write_datastruct iwl_dbgfs_fw_info_privstruct iwl_dbgfs_fw_info_statefunction _iwl_dbgfs_releasefunction iwl_dbgfs_fw_dbg_collect_writefunction iwl_dbgfs_enabled_severities_writefunction iwl_fw_timestamp_marker_wkfunction iwl_fw_trigger_timestampfunction iwl_dbgfs_timestamp_marker_writefunction iwl_dbgfs_timestamp_marker_readfunction iwl_dbgfs_send_hcmd_writefunction iwl_dbgfs_fw_dbg_domain_readfunction iwl_dbgfs_fw_ver_readfunction iwl_dbgfs_fw_info_seq_stopfunction iwl_dbgfs_fw_info_seq_showfunction iwl_dbgfs_fw_info_openfunction iwl_fwrt_dbgfs_register
Annotated Snippet
static const struct file_operations iwl_dbgfs_##name##_ops = { \
.read = _iwl_dbgfs_##name##_read, \
.open = _iwl_dbgfs_##name##_open, \
.llseek = generic_file_llseek, \
.release = _iwl_dbgfs_release, \
}
#define FWRT_DEBUGFS_WRITE_WRAPPER(name, buflen, argtype) \
static ssize_t _iwl_dbgfs_##name##_write(struct file *file, \
const char __user *user_buf, \
size_t count, loff_t *ppos) \
{ \
argtype *arg = \
((struct dbgfs_##name##_data *)file->private_data)->arg;\
char buf[buflen] = {}; \
size_t buf_size = min(count, sizeof(buf) - 1); \
\
if (copy_from_user(buf, user_buf, buf_size)) \
return -EFAULT; \
\
return iwl_dbgfs_##name##_write(arg, buf, buf_size); \
}
#define _FWRT_DEBUGFS_READ_WRITE_FILE_OPS(name, buflen, argtype) \
FWRT_DEBUGFS_OPEN_WRAPPER(name, buflen, argtype) \
FWRT_DEBUGFS_WRITE_WRAPPER(name, buflen, argtype) \
FWRT_DEBUGFS_READ_WRAPPER(name) \
static const struct file_operations iwl_dbgfs_##name##_ops = { \
.write = _iwl_dbgfs_##name##_write, \
.read = _iwl_dbgfs_##name##_read, \
.open = _iwl_dbgfs_##name##_open, \
.llseek = generic_file_llseek, \
.release = _iwl_dbgfs_release, \
}
#define _FWRT_DEBUGFS_WRITE_FILE_OPS(name, buflen, argtype) \
FWRT_DEBUGFS_OPEN_WRAPPER(name, buflen, argtype) \
FWRT_DEBUGFS_WRITE_WRAPPER(name, buflen, argtype) \
static const struct file_operations iwl_dbgfs_##name##_ops = { \
.write = _iwl_dbgfs_##name##_write, \
.open = _iwl_dbgfs_##name##_open, \
.llseek = generic_file_llseek, \
.release = _iwl_dbgfs_release, \
}
#define FWRT_DEBUGFS_READ_FILE_OPS(name, bufsz) \
_FWRT_DEBUGFS_READ_FILE_OPS(name, bufsz, struct iwl_fw_runtime)
#define FWRT_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \
_FWRT_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct iwl_fw_runtime)
#define FWRT_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \
_FWRT_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz, struct iwl_fw_runtime)
#define FWRT_DEBUGFS_ADD_FILE_ALIAS(alias, name, parent, mode) do { \
debugfs_create_file(alias, mode, parent, fwrt, \
&iwl_dbgfs_##name##_ops); \
} while (0)
#define FWRT_DEBUGFS_ADD_FILE(name, parent, mode) \
FWRT_DEBUGFS_ADD_FILE_ALIAS(#name, name, parent, mode)
static ssize_t iwl_dbgfs_fw_dbg_collect_write(struct iwl_fw_runtime *fwrt,
char *buf, size_t count)
{
if (count == 0)
return 0;
if (!iwl_trans_fw_running(fwrt->trans))
return count;
iwl_dbg_tlv_time_point(fwrt, IWL_FW_INI_TIME_POINT_USER_TRIGGER, NULL);
iwl_fw_dbg_collect(fwrt, FW_DBG_TRIGGER_USER, buf, (count - 1), NULL);
return count;
}
FWRT_DEBUGFS_WRITE_FILE_OPS(fw_dbg_collect, 16);
static int iwl_dbgfs_enabled_severities_write(struct iwl_fw_runtime *fwrt,
char *buf, size_t count)
{
struct iwl_dbg_host_event_cfg_cmd event_cfg;
struct iwl_host_cmd hcmd = {
.id = WIDE_ID(DEBUG_GROUP, HOST_EVENT_CFG),
.flags = CMD_ASYNC,
.data[0] = &event_cfg,
.len[0] = sizeof(event_cfg),
};
u32 enabled_severities;
Annotation
- Immediate include surface: `api/commands.h`, `debugfs.h`, `dbg.h`, `linux/hex.h`, `linux/seq_file.h`.
- Detected declarations: `struct hcmd_write_data`, `struct iwl_dbgfs_fw_info_priv`, `struct iwl_dbgfs_fw_info_state`, `function _iwl_dbgfs_release`, `function iwl_dbgfs_fw_dbg_collect_write`, `function iwl_dbgfs_enabled_severities_write`, `function iwl_fw_timestamp_marker_wk`, `function iwl_fw_trigger_timestamp`, `function iwl_dbgfs_timestamp_marker_write`, `function iwl_dbgfs_timestamp_marker_read`.
- 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.
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.