drivers/net/wireless/ath/ath11k/spectral.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath11k/spectral.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath11k/spectral.c- Extension
.c- Size
- 28690 bytes
- Lines
- 1056
- 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/relay.hcore.hdebug.h
Detected Declarations
struct spectral_tlvstruct spectral_summary_fft_reportstruct ath11k_spectral_summary_reportstruct spectral_search_fft_reportstruct ath11k_spectral_search_reportfunction remove_buf_file_handlerfunction ath11k_spectral_scan_triggerfunction ath11k_spectral_scan_configfunction ath11k_read_file_spec_scan_ctlfunction ath11k_write_file_spec_scan_ctlfunction ath11k_read_file_spectral_countfunction ath11k_write_file_spectral_countfunction ath11k_read_file_spectral_binsfunction ath11k_write_file_spectral_binsfunction ath11k_spectral_pull_summaryfunction ath11k_spectral_pull_searchfunction ath11k_spectral_get_max_expfunction ath11k_spectral_parse_fftfunction ath11k_spectral_process_fftfunction ath11k_spectral_process_datafunction ath11k_spectral_ring_allocfunction ath11k_spectral_ring_freefunction ath11k_spectral_debug_unregisterfunction ath11k_spectral_vif_stopfunction ath11k_spectral_reset_bufferfunction ath11k_spectral_deinitfunction ath11k_spectral_debug_registerfunction ath11k_spectral_initfunction ath11k_spectral_get_mode
Annotated Snippet
static const struct file_operations fops_scan_ctl = {
.read = ath11k_read_file_spec_scan_ctl,
.write = ath11k_write_file_spec_scan_ctl,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
static ssize_t ath11k_read_file_spectral_count(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath11k *ar = file->private_data;
char buf[32];
size_t len;
u16 spectral_count;
mutex_lock(&ar->conf_mutex);
spectral_count = ar->spectral.count;
mutex_unlock(&ar->conf_mutex);
len = sprintf(buf, "%d\n", spectral_count);
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}
static ssize_t ath11k_write_file_spectral_count(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath11k *ar = file->private_data;
unsigned long val;
ssize_t ret;
ret = kstrtoul_from_user(user_buf, count, 0, &val);
if (ret)
return ret;
if (val > ATH11K_SPECTRAL_SCAN_COUNT_MAX)
return -EINVAL;
mutex_lock(&ar->conf_mutex);
ar->spectral.count = val;
mutex_unlock(&ar->conf_mutex);
return count;
}
static const struct file_operations fops_scan_count = {
.read = ath11k_read_file_spectral_count,
.write = ath11k_write_file_spectral_count,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
static ssize_t ath11k_read_file_spectral_bins(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath11k *ar = file->private_data;
char buf[32];
unsigned int bins, fft_size;
size_t len;
mutex_lock(&ar->conf_mutex);
fft_size = ar->spectral.fft_size;
bins = 1 << fft_size;
mutex_unlock(&ar->conf_mutex);
len = sprintf(buf, "%d\n", bins);
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}
static ssize_t ath11k_write_file_spectral_bins(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath11k *ar = file->private_data;
unsigned long val;
ssize_t ret;
ret = kstrtoul_from_user(user_buf, count, 0, &val);
if (ret)
return ret;
if (val < ATH11K_SPECTRAL_MIN_BINS ||
val > ar->ab->hw_params.spectral.max_fft_bins)
return -EINVAL;
Annotation
- Immediate include surface: `linux/relay.h`, `core.h`, `debug.h`.
- Detected declarations: `struct spectral_tlv`, `struct spectral_summary_fft_report`, `struct ath11k_spectral_summary_report`, `struct spectral_search_fft_report`, `struct ath11k_spectral_search_report`, `function remove_buf_file_handler`, `function ath11k_spectral_scan_trigger`, `function ath11k_spectral_scan_config`, `function ath11k_read_file_spec_scan_ctl`, `function ath11k_write_file_spec_scan_ctl`.
- 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.