drivers/net/wireless/rsi/rsi_91x_usb.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/rsi/rsi_91x_usb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/rsi/rsi_91x_usb.c- Extension
.c- Size
- 24370 bytes
- Lines
- 940
- 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
linux/module.hlinux/types.hnet/rsi_91x.hrsi_usb.hrsi_hal.hrsi_coex.h
Detected Declarations
function rsi_usb_card_writefunction rsi_write_multiplefunction rsi_find_bulk_in_and_out_endpointsfunction rsi_usb_reg_readfunction rsi_usb_reg_writefunction rsi_rx_done_handlerfunction rsi_rx_urb_killfunction rsi_rx_urb_submitfunction rsi_usb_read_register_multiplefunction rsi_usb_write_register_multiplefunction rsi_usb_host_intf_write_pktfunction rsi_usb_master_reg_readfunction rsi_usb_master_reg_writefunction rsi_usb_load_data_master_writefunction rsi_deinit_usb_interfacefunction rsi_usb_init_rxfunction rsi_init_usb_interfacefunction usb_ulp_read_writefunction rsi_reset_cardfunction rsi_probefunction rsi_disconnectfunction rsi_suspendfunction rsi_resume
Annotated Snippet
if (!dev->bulkin_endpoint_addr[1]) {
dev_err(&interface->dev, "missing bt bulk-in endpoint\n");
return -EINVAL;
}
}
return 0;
}
#define RSI_USB_REQ_OUT (USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE)
#define RSI_USB_REQ_IN (USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_DEVICE)
/* rsi_usb_reg_read() - This function reads data from given register address.
* @usbdev: Pointer to the usb_device structure.
* @reg: Address of the register to be read.
* @value: Value to be read.
* @len: length of data to be read.
*
* Return: status: 0 on success, a negative error code on failure.
*/
static int rsi_usb_reg_read(struct usb_device *usbdev,
u32 reg,
u16 *value,
u16 len)
{
u8 *buf;
int status = -ENOMEM;
if (len > RSI_USB_CTRL_BUF_SIZE)
return -EINVAL;
buf = kmalloc(RSI_USB_CTRL_BUF_SIZE, GFP_KERNEL);
if (!buf)
return status;
status = usb_control_msg(usbdev,
usb_rcvctrlpipe(usbdev, 0),
USB_VENDOR_REGISTER_READ,
RSI_USB_REQ_IN,
((reg & 0xffff0000) >> 16), (reg & 0xffff),
(void *)buf,
len,
USB_CTRL_GET_TIMEOUT);
*value = (buf[0] | (buf[1] << 8));
if (status < 0) {
rsi_dbg(ERR_ZONE,
"%s: Reg read failed with error code :%d\n",
__func__, status);
}
kfree(buf);
return status;
}
/**
* rsi_usb_reg_write() - This function writes the given data into the given
* register address.
* @usbdev: Pointer to the usb_device structure.
* @reg: Address of the register.
* @value: Value to write.
* @len: Length of data to be written.
*
* Return: status: 0 on success, a negative error code on failure.
*/
static int rsi_usb_reg_write(struct usb_device *usbdev,
u32 reg,
u32 value,
u16 len)
{
u8 *usb_reg_buf;
int status = -ENOMEM;
if (len > RSI_USB_CTRL_BUF_SIZE)
return -EINVAL;
usb_reg_buf = kmalloc(RSI_USB_CTRL_BUF_SIZE, GFP_KERNEL);
if (!usb_reg_buf)
return status;
usb_reg_buf[0] = value & 0x00ff;
usb_reg_buf[1] = (value & 0xff00) >> 8;
usb_reg_buf[2] = (value & 0x00ff0000) >> 16;
usb_reg_buf[3] = (value & 0xff000000) >> 24;
status = usb_control_msg(usbdev,
usb_sndctrlpipe(usbdev, 0),
USB_VENDOR_REGISTER_WRITE,
RSI_USB_REQ_OUT,
(reg & 0xffff0000) >> 16,
Annotation
- Immediate include surface: `linux/module.h`, `linux/types.h`, `net/rsi_91x.h`, `rsi_usb.h`, `rsi_hal.h`, `rsi_coex.h`.
- Detected declarations: `function rsi_usb_card_write`, `function rsi_write_multiple`, `function rsi_find_bulk_in_and_out_endpoints`, `function rsi_usb_reg_read`, `function rsi_usb_reg_write`, `function rsi_rx_done_handler`, `function rsi_rx_urb_kill`, `function rsi_rx_urb_submit`, `function rsi_usb_read_register_multiple`, `function rsi_usb_write_register_multiple`.
- 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.