drivers/usb/common/debug.c
Source file repositories/reference/linux-study-clean/drivers/usb/common/debug.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/common/debug.c- Extension
.c- Size
- 8761 bytes
- Lines
- 320
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
Dependency Surface
linux/kernel.hlinux/usb/ch9.h
Detected Declarations
function Copyrightfunction usb_decode_set_clear_featurefunction usb_decode_set_addressfunction usb_decode_get_set_descriptorfunction usb_decode_get_configurationfunction usb_decode_set_configurationfunction usb_decode_get_intffunction usb_decode_set_intffunction usb_decode_synch_framefunction usb_decode_set_selfunction usb_decode_set_isoch_delayfunction usb_decode_ctrl_genericfunction usb_decode_ctrl_standardexport usb_decode_ctrl
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Common USB debugging functions
*
* Copyright (C) 2010-2011 Texas Instruments Incorporated - https://www.ti.com
*
* Authors: Felipe Balbi <balbi@ti.com>,
* Sebastian Andrzej Siewior <bigeasy@linutronix.de>
*/
#include <linux/kernel.h>
#include <linux/usb/ch9.h>
static void usb_decode_get_status(__u8 bRequestType, __u16 wIndex,
__u16 wLength, char *str, size_t size)
{
switch (bRequestType & USB_RECIP_MASK) {
case USB_RECIP_DEVICE:
snprintf(str, size, "Get Device Status(Length = %d)", wLength);
break;
case USB_RECIP_INTERFACE:
snprintf(str, size,
"Get Interface Status(Intf = %d, Length = %d)",
wIndex, wLength);
break;
case USB_RECIP_ENDPOINT:
snprintf(str, size, "Get Endpoint Status(ep%d%s)",
wIndex & ~USB_DIR_IN,
wIndex & USB_DIR_IN ? "in" : "out");
break;
}
}
static const char *usb_decode_device_feature(u16 wValue)
{
switch (wValue) {
case USB_DEVICE_SELF_POWERED:
return "Self Powered";
case USB_DEVICE_REMOTE_WAKEUP:
return "Remote Wakeup";
case USB_DEVICE_TEST_MODE:
return "Test Mode";
case USB_DEVICE_U1_ENABLE:
return "U1 Enable";
case USB_DEVICE_U2_ENABLE:
return "U2 Enable";
case USB_DEVICE_LTM_ENABLE:
return "LTM Enable";
default:
return "UNKNOWN";
}
}
static const char *usb_decode_test_mode(u16 wIndex)
{
switch (wIndex) {
case USB_TEST_J:
return ": TEST_J";
case USB_TEST_K:
return ": TEST_K";
case USB_TEST_SE0_NAK:
return ": TEST_SE0_NAK";
case USB_TEST_PACKET:
return ": TEST_PACKET";
case USB_TEST_FORCE_ENABLE:
return ": TEST_FORCE_EN";
default:
return ": UNKNOWN";
}
}
static void usb_decode_set_clear_feature(__u8 bRequestType,
__u8 bRequest, __u16 wValue,
__u16 wIndex, char *str, size_t size)
{
switch (bRequestType & USB_RECIP_MASK) {
case USB_RECIP_DEVICE:
snprintf(str, size, "%s Device Feature(%s%s)",
bRequest == USB_REQ_CLEAR_FEATURE ? "Clear" : "Set",
usb_decode_device_feature(wValue),
wValue == USB_DEVICE_TEST_MODE ?
usb_decode_test_mode(wIndex) : "");
break;
case USB_RECIP_INTERFACE:
snprintf(str, size, "%s Interface Feature(%s)",
bRequest == USB_REQ_CLEAR_FEATURE ? "Clear" : "Set",
wValue == USB_INTRF_FUNC_SUSPEND ?
"Function Suspend" : "UNKNOWN");
break;
case USB_RECIP_ENDPOINT:
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/usb/ch9.h`.
- Detected declarations: `function Copyright`, `function usb_decode_set_clear_feature`, `function usb_decode_set_address`, `function usb_decode_get_set_descriptor`, `function usb_decode_get_configuration`, `function usb_decode_set_configuration`, `function usb_decode_get_intf`, `function usb_decode_set_intf`, `function usb_decode_synch_frame`, `function usb_decode_set_sel`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: integration 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.