drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c- Extension
.c- Size
- 13167 bytes
- Lines
- 393
- 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.
- 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
../wifi.h../core.h../usb.h../base.h../rtl8192d/reg.h../rtl8192d/def.h../rtl8192d/fw_common.h../rtl8192d/hw_common.h../rtl8192d/phy_common.h../rtl8192d/trx_common.hphy.hdm.hhw.htrx.hled.hlinux/module.h
Detected Declarations
function rtl92du_init_shared_datafunction rtl92du_deinit_shared_datafunction rtl92du_init_sw_varsfunction rtl92du_deinit_sw_varsfunction rtl8192du_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2024 Realtek Corporation.*/
#include "../wifi.h"
#include "../core.h"
#include "../usb.h"
#include "../base.h"
#include "../rtl8192d/reg.h"
#include "../rtl8192d/def.h"
#include "../rtl8192d/fw_common.h"
#include "../rtl8192d/hw_common.h"
#include "../rtl8192d/phy_common.h"
#include "../rtl8192d/trx_common.h"
#include "phy.h"
#include "dm.h"
#include "hw.h"
#include "trx.h"
#include "led.h"
#include <linux/module.h>
static struct usb_interface *rtl92du_get_other_intf(struct ieee80211_hw *hw)
{
struct usb_interface *intf;
struct usb_device *udev;
u8 other_interfaceindex;
/* See SET_IEEE80211_DEV(hw, &intf->dev); in usb.c */
intf = container_of_const(wiphy_dev(hw->wiphy), struct usb_interface, dev);
if (intf->altsetting[0].desc.bInterfaceNumber == 0)
other_interfaceindex = 1;
else
other_interfaceindex = 0;
udev = interface_to_usbdev(intf);
return usb_ifnum_to_if(udev, other_interfaceindex);
}
static int rtl92du_init_shared_data(struct ieee80211_hw *hw)
{
struct usb_interface *other_intf = rtl92du_get_other_intf(hw);
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_priv *other_rtlpriv = NULL;
struct ieee80211_hw *other_hw = NULL;
if (other_intf)
other_hw = usb_get_intfdata(other_intf);
if (other_hw) {
/* The other interface was already probed. */
other_rtlpriv = rtl_priv(other_hw);
rtlpriv->curveindex_2g = other_rtlpriv->curveindex_2g;
rtlpriv->curveindex_5g = other_rtlpriv->curveindex_5g;
rtlpriv->mutex_for_power_on_off = other_rtlpriv->mutex_for_power_on_off;
rtlpriv->mutex_for_hw_init = other_rtlpriv->mutex_for_hw_init;
if (!rtlpriv->curveindex_2g || !rtlpriv->curveindex_5g ||
!rtlpriv->mutex_for_power_on_off || !rtlpriv->mutex_for_hw_init)
return -ENOMEM;
return 0;
}
/* The other interface doesn't exist or was not probed yet. */
rtlpriv->curveindex_2g = kcalloc(TARGET_CHNL_NUM_2G,
sizeof(*rtlpriv->curveindex_2g),
GFP_KERNEL);
rtlpriv->curveindex_5g = kcalloc(TARGET_CHNL_NUM_5G,
sizeof(*rtlpriv->curveindex_5g),
GFP_KERNEL);
rtlpriv->mutex_for_power_on_off = kzalloc_obj(*rtlpriv->mutex_for_power_on_off);
rtlpriv->mutex_for_hw_init = kzalloc_obj(*rtlpriv->mutex_for_hw_init);
if (!rtlpriv->curveindex_2g || !rtlpriv->curveindex_5g ||
!rtlpriv->mutex_for_power_on_off || !rtlpriv->mutex_for_hw_init) {
kfree(rtlpriv->curveindex_2g);
kfree(rtlpriv->curveindex_5g);
kfree(rtlpriv->mutex_for_power_on_off);
kfree(rtlpriv->mutex_for_hw_init);
rtlpriv->curveindex_2g = NULL;
rtlpriv->curveindex_5g = NULL;
rtlpriv->mutex_for_power_on_off = NULL;
rtlpriv->mutex_for_hw_init = NULL;
return -ENOMEM;
}
mutex_init(rtlpriv->mutex_for_power_on_off);
mutex_init(rtlpriv->mutex_for_hw_init);
Annotation
- Immediate include surface: `../wifi.h`, `../core.h`, `../usb.h`, `../base.h`, `../rtl8192d/reg.h`, `../rtl8192d/def.h`, `../rtl8192d/fw_common.h`, `../rtl8192d/hw_common.h`.
- Detected declarations: `function rtl92du_init_shared_data`, `function rtl92du_deinit_shared_data`, `function rtl92du_init_sw_vars`, `function rtl92du_deinit_sw_vars`, `function rtl8192du_probe`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.