drivers/net/wireless/marvell/libertas/if_usb.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/marvell/libertas/if_usb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/marvell/libertas/if_usb.c- Extension
.c- Size
- 26473 bytes
- Lines
- 1012
- 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/delay.hlinux/module.hlinux/firmware.hlinux/netdevice.hlinux/slab.hlinux/usb.hlinux/olpc-ec.hasm/olpc.hhost.hdecl.hdefs.hdev.hcmd.hif_usb.h
Detected Declarations
function if_usb_write_bulk_callbackfunction if_usb_freefunction if_usb_setup_firmwarefunction if_usb_fw_timeofunction if_usb_reset_olpc_cardfunction if_usb_probefunction if_usb_disconnectfunction if_usb_send_fw_pktfunction if_usb_reset_devicefunction usb_tx_blockfunction __if_usb_submit_rx_urbfunction if_usb_submit_rx_urb_fwloadfunction if_usb_submit_rx_urbfunction if_usb_receive_fwloadfunction process_cmdtypedatafunction process_cmdrequestfunction if_usb_receivefunction if_usb_host_to_cardfunction if_usb_issue_boot_commandfunction check_fwfile_formatfunction if_usb_prog_firmwarefunction if_usb_suspendfunction if_usb_resume
Annotated Snippet
if (le16_to_cpu(wake_method.method) == CMD_WAKE_METHOD_COMMAND_INT) {
lbs_deb_usb("Firmware seems to support PS with wake-via-command\n");
} else {
/* The versions which boot up this way don't seem to
work even if we set it to the command interrupt */
priv->fwcapinfo &= ~FW_CAPINFO_PS;
netdev_info(priv->dev,
"Firmware doesn't wake via command interrupt; disabling PS mode\n");
}
}
}
static void if_usb_fw_timeo(struct timer_list *t)
{
struct if_usb_card *cardp = timer_container_of(cardp, t, fw_timeout);
if (cardp->fwdnldover) {
lbs_deb_usb("Download complete, no event. Assuming success\n");
} else {
pr_err("Download timed out\n");
cardp->surprise_removed = 1;
}
wake_up(&cardp->fw_wq);
}
#ifdef CONFIG_OLPC
static void if_usb_reset_olpc_card(struct lbs_private *priv)
{
printk(KERN_CRIT "Resetting OLPC wireless via EC...\n");
olpc_ec_cmd(0x25, NULL, 0, NULL, 0);
}
#endif
/**
* if_usb_probe - sets the configuration values
* @intf: &usb_interface pointer
* @id: pointer to usb_device_id
* returns: 0 on success, error code on failure
*/
static int if_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct usb_endpoint_descriptor *ep_in, *ep_out;
struct usb_device *udev;
struct usb_host_interface *iface_desc;
struct lbs_private *priv;
struct if_usb_card *cardp;
int r = -ENOMEM;
udev = interface_to_usbdev(intf);
cardp = kzalloc_obj(struct if_usb_card);
if (!cardp)
goto error;
timer_setup(&cardp->fw_timeout, if_usb_fw_timeo, 0);
init_waitqueue_head(&cardp->fw_wq);
cardp->udev = udev;
cardp->model = (uint32_t) id->driver_info;
iface_desc = intf->cur_altsetting;
lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X"
" bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n",
le16_to_cpu(udev->descriptor.bcdUSB),
udev->descriptor.bDeviceClass,
udev->descriptor.bDeviceSubClass,
udev->descriptor.bDeviceProtocol);
init_usb_anchor(&cardp->rx_submitted);
init_usb_anchor(&cardp->tx_submitted);
if (usb_find_common_endpoints_reverse(iface_desc, &ep_in, &ep_out, NULL, NULL)) {
lbs_deb_usbd(&udev->dev, "Endpoints not found\n");
goto dealloc;
}
cardp->ep_in_size = usb_endpoint_maxp(ep_in);
cardp->ep_in = usb_endpoint_num(ep_in);
lbs_deb_usbd(&udev->dev, "in_endpoint = %d\n", cardp->ep_in);
lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n", cardp->ep_in_size);
cardp->ep_out_size = usb_endpoint_maxp(ep_out);
cardp->ep_out = usb_endpoint_num(ep_out);
lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n", cardp->ep_out);
lbs_deb_usbd(&udev->dev, "Bulk out size is %d\n", cardp->ep_out_size);
if (!cardp->ep_out_size || !cardp->ep_in_size) {
Annotation
- Immediate include surface: `linux/delay.h`, `linux/module.h`, `linux/firmware.h`, `linux/netdevice.h`, `linux/slab.h`, `linux/usb.h`, `linux/olpc-ec.h`, `asm/olpc.h`.
- Detected declarations: `function if_usb_write_bulk_callback`, `function if_usb_free`, `function if_usb_setup_firmware`, `function if_usb_fw_timeo`, `function if_usb_reset_olpc_card`, `function if_usb_probe`, `function if_usb_disconnect`, `function if_usb_send_fw_pkt`, `function if_usb_reset_device`, `function usb_tx_block`.
- 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.