drivers/net/wireless/ath/ath9k/wmi.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath9k/wmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ath9k/wmi.c- Extension
.c- Size
- 9537 bytes
- Lines
- 370
- 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
htc.h
Detected Declarations
function Copyrightfunction ath9k_stop_wmifunction ath9k_destroy_wmifunction ath9k_wmi_event_drainfunction ath9k_wmi_event_taskletfunction ath9k_fatal_workfunction ath9k_wmi_rsp_callbackfunction ath9k_wmi_ctrl_rxfunction ath9k_wmi_ctrl_txfunction ath9k_wmi_connectfunction ath9k_wmi_cmd_issuefunction ath9k_wmi_cmd
Annotated Snippet
if (!skb) {
spin_unlock_irqrestore(&wmi->wmi_lock, flags);
return;
}
spin_unlock_irqrestore(&wmi->wmi_lock, flags);
/* Check if ath9k_htc_probe_device() completed. */
if (!data_race(priv->initialized)) {
kfree_skb(skb);
continue;
}
hdr = (struct wmi_cmd_hdr *) skb->data;
cmd_id = be16_to_cpu(hdr->command_id);
wmi_event = skb_pull(skb, sizeof(struct wmi_cmd_hdr));
switch (cmd_id) {
case WMI_SWBA_EVENTID:
swba = wmi_event;
ath9k_htc_swba(priv, swba);
break;
case WMI_FATAL_EVENTID:
ieee80211_queue_work(wmi->drv_priv->hw,
&wmi->drv_priv->fatal_work);
break;
case WMI_TXSTATUS_EVENTID:
spin_lock_bh(&priv->tx.tx_lock);
if (priv->tx.flags & ATH9K_HTC_OP_TX_DRAIN) {
spin_unlock_bh(&priv->tx.tx_lock);
break;
}
spin_unlock_bh(&priv->tx.tx_lock);
ath9k_htc_txstatus(priv, wmi_event);
break;
default:
break;
}
kfree_skb(skb);
} while (1);
}
void ath9k_fatal_work(struct work_struct *work)
{
struct ath9k_htc_priv *priv = container_of(work, struct ath9k_htc_priv,
fatal_work);
struct ath_common *common = ath9k_hw_common(priv->ah);
ath_dbg(common, FATAL, "FATAL Event received, resetting device\n");
ath9k_htc_reset(priv);
}
static void ath9k_wmi_rsp_callback(struct wmi *wmi, struct sk_buff *skb)
{
skb_pull(skb, sizeof(struct wmi_cmd_hdr));
if (wmi->cmd_rsp_buf != NULL && wmi->cmd_rsp_len != 0)
memcpy(wmi->cmd_rsp_buf, skb->data, wmi->cmd_rsp_len);
complete(&wmi->cmd_wait);
}
static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb,
enum htc_endpoint_id epid)
{
struct wmi *wmi = priv;
struct wmi_cmd_hdr *hdr;
unsigned long flags;
u16 cmd_id;
if (unlikely(wmi->stopped))
goto free_skb;
/* Validate the obtained SKB. */
if (unlikely(skb->len < sizeof(struct wmi_cmd_hdr)))
goto free_skb;
hdr = (struct wmi_cmd_hdr *) skb->data;
cmd_id = be16_to_cpu(hdr->command_id);
if (cmd_id & 0x1000) {
spin_lock_irqsave(&wmi->wmi_lock, flags);
__skb_queue_tail(&wmi->wmi_event_queue, skb);
spin_unlock_irqrestore(&wmi->wmi_lock, flags);
tasklet_schedule(&wmi->wmi_event_tasklet);
return;
}
/* Check if there has been a timeout. */
Annotation
- Immediate include surface: `htc.h`.
- Detected declarations: `function Copyright`, `function ath9k_stop_wmi`, `function ath9k_destroy_wmi`, `function ath9k_wmi_event_drain`, `function ath9k_wmi_event_tasklet`, `function ath9k_fatal_work`, `function ath9k_wmi_rsp_callback`, `function ath9k_wmi_ctrl_rx`, `function ath9k_wmi_ctrl_tx`, `function ath9k_wmi_connect`.
- 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.