drivers/net/wireless/ath/ar5523/ar5523.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ar5523/ar5523.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/ar5523/ar5523.c- Extension
.c- Size
- 48570 bytes
- Lines
- 1828
- 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
linux/compiler.hlinux/kernel.hlinux/module.hlinux/list.hlinux/completion.hlinux/firmware.hlinux/skbuff.hlinux/usb.hnet/mac80211.har5523.har5523_hw.h
Detected Declarations
function ar5523_read_replyfunction ar5523_cmd_rx_cbfunction ar5523_alloc_rx_cmdfunction ar5523_cancel_rx_cmdfunction ar5523_free_rx_cmdfunction ar5523_submit_rx_cmdfunction ar5523_cmd_tx_cbfunction ar5523_cancel_tx_cmdfunction ar5523_cmdfunction ar5523_cmd_writefunction ar5523_cmd_readfunction ar5523_configfunction ar5523_config_multifunction ar5523_get_statusfunction ar5523_get_capabilityfunction ar5523_get_devcapfunction ar5523_set_ledsteadyfunction ar5523_set_rxfilterfunction ar5523_reset_tx_queuesfunction ar5523_set_chanfunction ar5523_queue_initfunction ar5523_switch_chanfunction ar5523_rx_data_putfunction ar5523_data_rx_cbfunction ar5523_rx_refill_workfunction ar5523_cancel_rx_bufsfunction ar5523_free_rx_bufsfunction ar5523_alloc_rx_bufsfunction ar5523_data_tx_pkt_putfunction ar5523_data_tx_cbfunction ar5523_txfunction ar5523_tx_work_lockedfunction ar5523_tx_workfunction ar5523_tx_wd_timerfunction ar5523_tx_wd_workfunction ar5523_flush_txfunction ar5523_free_tx_cmdfunction ar5523_alloc_tx_cmdfunction periodicallyfunction ar5523_startfunction ar5523_stopfunction ar5523_set_rts_thresholdfunction ar5523_flushfunction ar5523_add_interfacefunction ar5523_remove_interfacefunction ar5523_hwconfigfunction ar5523_get_wlan_modefunction ar5523_create_rateset
Annotated Snippet
if (olen == 0) {
/* convention is 0 =>'s one word */
olen = sizeof(u32);
}
} else
olen = 0;
if (cmd->odata) {
if (cmd->olen < olen) {
ar5523_err(ar, "olen too small %d < %d\n",
cmd->olen, olen);
cmd->olen = 0;
cmd->res = -EOVERFLOW;
} else {
cmd->olen = olen;
memcpy(cmd->odata, &rp[1], olen);
cmd->res = 0;
}
}
out:
complete(&cmd->done);
}
static void ar5523_cmd_rx_cb(struct urb *urb)
{
struct ar5523 *ar = urb->context;
struct ar5523_tx_cmd *cmd = &ar->tx_cmd;
struct ar5523_cmd_hdr *hdr = ar->rx_cmd_buf;
int dlen;
u32 code, hdrlen;
if (urb->status) {
if (urb->status != -ESHUTDOWN)
ar5523_err(ar, "RX USB error %d.\n", urb->status);
goto skip;
}
if (urb->actual_length < sizeof(struct ar5523_cmd_hdr)) {
ar5523_err(ar, "RX USB too short.\n");
goto skip;
}
ar5523_dbg(ar, "%s code %02x priv %d\n", __func__,
be32_to_cpu(hdr->code) & 0xff, hdr->priv);
code = be32_to_cpu(hdr->code);
hdrlen = be32_to_cpu(hdr->len);
switch (code & 0xff) {
default:
/* reply to a read command */
if (hdr->priv != AR5523_CMD_ID) {
ar5523_err(ar, "Unexpected command id: %02x\n",
code & 0xff);
goto skip;
}
ar5523_read_reply(ar, hdr, cmd);
break;
case WDCMSG_DEVICE_AVAIL:
ar5523_dbg(ar, "WDCMSG_DEVICE_AVAIL\n");
cmd->res = 0;
cmd->olen = 0;
complete(&cmd->done);
break;
case WDCMSG_SEND_COMPLETE:
ar5523_dbg(ar, "WDCMSG_SEND_COMPLETE: %d pending\n",
atomic_read(&ar->tx_nr_pending));
if (!test_bit(AR5523_HW_UP, &ar->flags))
ar5523_dbg(ar, "Unexpected WDCMSG_SEND_COMPLETE\n");
else {
mod_timer(&ar->tx_wd_timer,
jiffies + AR5523_TX_WD_TIMEOUT);
ar5523_data_tx_pkt_put(ar);
}
break;
case WDCMSG_TARGET_START:
/* This command returns a bogus id so it needs special
handling */
dlen = hdrlen - sizeof(*hdr);
if (dlen != (int)sizeof(u32)) {
ar5523_err(ar, "Invalid reply to WDCMSG_TARGET_START");
return;
}
if (!cmd->odata) {
ar5523_err(ar, "Unexpected WDCMSG_TARGET_START reply");
Annotation
- Immediate include surface: `linux/compiler.h`, `linux/kernel.h`, `linux/module.h`, `linux/list.h`, `linux/completion.h`, `linux/firmware.h`, `linux/skbuff.h`, `linux/usb.h`.
- Detected declarations: `function ar5523_read_reply`, `function ar5523_cmd_rx_cb`, `function ar5523_alloc_rx_cmd`, `function ar5523_cancel_rx_cmd`, `function ar5523_free_rx_cmd`, `function ar5523_submit_rx_cmd`, `function ar5523_cmd_tx_cb`, `function ar5523_cancel_tx_cmd`, `function ar5523_cmd`, `function ar5523_cmd_write`.
- 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.