drivers/net/wireless/marvell/libertas/main.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/marvell/libertas/main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/marvell/libertas/main.c- Extension
.c- Size
- 26439 bytes
- Lines
- 1074
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/delay.hlinux/etherdevice.hlinux/hardirq.hlinux/netdevice.hlinux/if_arp.hlinux/kthread.hlinux/kfifo.hlinux/slab.hnet/cfg80211.hhost.hdecl.hdev.hcfg.hdebugfs.hcmd.hmesh.h
Detected Declarations
function lbs_fw_index_to_data_ratefunction lbs_set_iface_typefunction lbs_start_ifacefunction lbs_dev_openfunction lbs_command_queue_emptyfunction lbs_stop_ifacefunction lbs_eth_stopfunction lbs_host_to_card_donefunction lbs_set_mac_addressfunction mac_in_listfunction lbs_add_mcast_addrsfunction lbs_update_mcastfunction lbs_set_mcast_workerfunction lbs_set_multicast_listfunction lbs_threadfunction lbs_setup_firmwarefunction lbs_suspendfunction lbs_resumefunction lbs_cmd_timeout_handlerfunction lbs_tx_lockup_handlerfunction lbs_init_adapterfunction lbs_free_adapterfunction lbs_remove_cardfunction lbs_rtap_supportedfunction lbs_start_cardfunction lbs_stop_cardfunction lbs_queue_eventfunction lbs_notify_command_responsefunction lbs_init_modulefunction lbs_exit_modulemodule init lbs_init_moduleexport lbs_debugexport lbs_host_to_card_doneexport lbs_suspendexport lbs_resumeexport lbs_add_cardexport lbs_remove_cardexport lbs_start_cardexport lbs_stop_cardexport lbs_queue_eventexport lbs_notify_command_response
Annotated Snippet
static const struct net_device_ops lbs_netdev_ops = {
.ndo_open = lbs_dev_open,
.ndo_stop = lbs_eth_stop,
.ndo_start_xmit = lbs_hard_start_xmit,
.ndo_set_mac_address = lbs_set_mac_address,
.ndo_set_rx_mode = lbs_set_multicast_list,
.ndo_validate_addr = eth_validate_addr,
};
/**
* lbs_add_card - adds the card. It will probe the
* card, allocate the lbs_priv and initialize the device.
*
* @card: A pointer to card
* @dmdev: A pointer to &struct device
* returns: A pointer to &struct lbs_private structure
*/
struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
{
struct net_device *dev;
struct wireless_dev *wdev;
struct lbs_private *priv = NULL;
int err;
/* Allocate an Ethernet device and register it */
wdev = lbs_cfg_alloc(dmdev);
if (IS_ERR(wdev)) {
err = PTR_ERR(wdev);
pr_err("cfg80211 init failed\n");
goto err_cfg;
}
wdev->iftype = NL80211_IFTYPE_STATION;
priv = wdev_priv(wdev);
priv->wdev = wdev;
err = lbs_init_adapter(priv);
if (err) {
pr_err("failed to initialize adapter structure\n");
goto err_wdev;
}
dev = alloc_netdev(0, "wlan%d", NET_NAME_UNKNOWN, ether_setup);
if (!dev) {
err = -ENOMEM;
dev_err(dmdev, "no memory for network device instance\n");
goto err_adapter;
}
dev->ieee80211_ptr = wdev;
dev->ml_priv = priv;
SET_NETDEV_DEV(dev, dmdev);
wdev->netdev = dev;
priv->dev = dev;
dev->netdev_ops = &lbs_netdev_ops;
dev->watchdog_timeo = 5 * HZ;
dev->ethtool_ops = &lbs_ethtool_ops;
dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
priv->card = card;
strcpy(dev->name, "wlan%d");
lbs_deb_thread("Starting main thread...\n");
init_waitqueue_head(&priv->waitq);
priv->main_thread = kthread_run(lbs_thread, dev, "lbs_main");
if (IS_ERR(priv->main_thread)) {
err = PTR_ERR(priv->main_thread);
lbs_deb_thread("Error creating main thread.\n");
goto err_ndev;
}
priv->work_thread = create_singlethread_workqueue("lbs_worker");
INIT_WORK(&priv->mcast_work, lbs_set_mcast_worker);
priv->wol_criteria = EHS_REMOVE_WAKEUP;
priv->wol_gpio = 0xff;
priv->wol_gap = 20;
priv->ehs_remove_supported = true;
return priv;
err_ndev:
free_netdev(dev);
err_adapter:
lbs_free_adapter(priv);
err_wdev:
Annotation
- Immediate include surface: `linux/module.h`, `linux/delay.h`, `linux/etherdevice.h`, `linux/hardirq.h`, `linux/netdevice.h`, `linux/if_arp.h`, `linux/kthread.h`, `linux/kfifo.h`.
- Detected declarations: `function lbs_fw_index_to_data_rate`, `function lbs_set_iface_type`, `function lbs_start_iface`, `function lbs_dev_open`, `function lbs_command_queue_empty`, `function lbs_stop_iface`, `function lbs_eth_stop`, `function lbs_host_to_card_done`, `function lbs_set_mac_address`, `function mac_in_list`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.