drivers/net/wireless/ath/carl9170/usb.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/carl9170/usb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/carl9170/usb.c- Extension
.c- Size
- 27968 bytes
- Lines
- 1232
- 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/module.hlinux/slab.hlinux/usb.hlinux/firmware.hlinux/etherdevice.hlinux/device.hnet/mac80211.hcarl9170.hcmd.hhw.hfwcmd.h
Detected Declarations
function carl9170_usb_submit_data_urbfunction carl9170_usb_tx_data_completefunction carl9170_usb_submit_cmd_urbfunction carl9170_usb_cmd_completefunction carl9170_usb_rx_irq_completefunction carl9170_usb_submit_rx_urbfunction carl9170_usb_rx_workfunction carl9170_usb_handle_tx_errfunction carl9170_usb_taskletfunction carl9170_usb_rx_completefunction carl9170_usb_send_rx_irq_urbfunction carl9170_usb_init_rx_bulk_urbsfunction carl9170_usb_flushfunction carl9170_usb_cancel_urbsfunction __carl9170_exec_cmdfunction carl9170_exec_cmdfunction carl9170_usb_txfunction carl9170_release_firmwarefunction carl9170_usb_stopfunction carl9170_usb_openfunction carl9170_usb_load_firmwarefunction carl9170_usb_restartfunction carl9170_usb_resetfunction carl9170_usb_init_devicefunction carl9170_usb_firmware_failedfunction carl9170_usb_firmware_finishfunction carl9170_usb_firmware_step2function carl9170_usb_probefunction carl9170_usb_disconnectfunction carl9170_usb_suspendfunction carl9170_usb_resume
Annotated Snippet
if (net_ratelimit()) {
dev_err(&ar->udev->dev, "tx submit failed (%d)\n",
urb->status);
}
usb_unanchor_urb(urb);
usb_anchor_urb(urb, &ar->tx_err);
}
usb_free_urb(urb);
if (likely(err == 0))
return;
err_acc:
atomic_dec(&ar->tx_anch_urbs);
}
static void carl9170_usb_tx_data_complete(struct urb *urb)
{
struct ar9170 *ar = usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0));
if (WARN_ON_ONCE(!ar)) {
dev_kfree_skb_irq(urb->context);
return;
}
atomic_dec(&ar->tx_anch_urbs);
switch (urb->status) {
/* everything is fine */
case 0:
carl9170_tx_callback(ar, urb->context);
break;
/* disconnect */
case -ENOENT:
case -ECONNRESET:
case -ENODEV:
case -ESHUTDOWN:
/*
* Defer the frame clean-up to the tasklet worker.
* This is necessary, because carl9170_tx_drop
* does not work in an irqsave context.
*/
usb_anchor_urb(urb, &ar->tx_err);
return;
/* a random transmission error has occurred? */
default:
if (net_ratelimit()) {
dev_err(&ar->udev->dev, "tx failed (%d)\n",
urb->status);
}
usb_anchor_urb(urb, &ar->tx_err);
break;
}
if (likely(IS_STARTED(ar)))
carl9170_usb_submit_data_urb(ar);
}
static int carl9170_usb_submit_cmd_urb(struct ar9170 *ar)
{
struct urb *urb;
int err;
if (atomic_inc_return(&ar->tx_cmd_urbs) != 1) {
atomic_dec(&ar->tx_cmd_urbs);
return 0;
}
urb = usb_get_from_anchor(&ar->tx_cmd);
if (!urb) {
atomic_dec(&ar->tx_cmd_urbs);
return 0;
}
usb_anchor_urb(urb, &ar->tx_anch);
err = usb_submit_urb(urb, GFP_ATOMIC);
if (unlikely(err)) {
usb_unanchor_urb(urb);
atomic_dec(&ar->tx_cmd_urbs);
}
usb_free_urb(urb);
return err;
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/slab.h`, `linux/usb.h`, `linux/firmware.h`, `linux/etherdevice.h`, `linux/device.h`, `net/mac80211.h`, `carl9170.h`.
- Detected declarations: `function carl9170_usb_submit_data_urb`, `function carl9170_usb_tx_data_complete`, `function carl9170_usb_submit_cmd_urb`, `function carl9170_usb_cmd_complete`, `function carl9170_usb_rx_irq_complete`, `function carl9170_usb_submit_rx_urb`, `function carl9170_usb_rx_work`, `function carl9170_usb_handle_tx_err`, `function carl9170_usb_tasklet`, `function carl9170_usb_rx_complete`.
- 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.