drivers/usb/serial/ssu100.c
Source file repositories/reference/linux-study-clean/drivers/usb/serial/ssu100.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/serial/ssu100.c- Extension
.c- Size
- 12928 bytes
- Lines
- 529
- Domain
- Driver Families
- Bucket
- drivers/usb
- 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/errno.hlinux/slab.hlinux/tty.hlinux/tty_driver.hlinux/tty_flip.hlinux/module.hlinux/serial.hlinux/usb.hlinux/usb/serial.hlinux/serial_reg.hlinux/uaccess.h
Detected Declarations
struct ssu100_port_privatefunction ssu100_control_msgfunction ssu100_setdevicefunction ssu100_getdevicefunction ssu100_getregisterfunction ssu100_setregisterfunction update_mctrlfunction ssu100_initdevicefunction ssu100_set_termiosfunction ssu100_openfunction ssu100_attachfunction ssu100_port_probefunction ssu100_port_removefunction ssu100_tiocmgetfunction ssu100_tiocmsetfunction ssu100_dtr_rtsfunction ssu100_update_msrfunction ssu100_update_lsrfunction ssu100_process_read_urb
Annotated Snippet
struct ssu100_port_private {
spinlock_t status_lock;
u8 shadowLSR;
u8 shadowMSR;
};
static inline int ssu100_control_msg(struct usb_device *dev,
u8 request, u16 data, u16 index)
{
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
request, 0x40, data, index,
NULL, 0, 300);
}
static inline int ssu100_setdevice(struct usb_device *dev, u8 *data)
{
u16 x = ((u16)(data[1] << 8) | (u16)(data[0]));
return ssu100_control_msg(dev, QT_SET_GET_DEVICE, x, 0);
}
static inline int ssu100_getdevice(struct usb_device *dev, u8 *data)
{
int ret;
ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
QT_SET_GET_DEVICE, 0xc0, 0, 0,
data, 3, 300);
if (ret < 3) {
if (ret >= 0)
ret = -EIO;
}
return ret;
}
static inline int ssu100_getregister(struct usb_device *dev,
unsigned short uart,
unsigned short reg,
u8 *data)
{
int ret;
ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
QT_SET_GET_REGISTER, 0xc0, reg,
uart, data, sizeof(*data), 300);
if (ret < (int)sizeof(*data)) {
if (ret >= 0)
ret = -EIO;
}
return ret;
}
static inline int ssu100_setregister(struct usb_device *dev,
unsigned short uart,
unsigned short reg,
u16 data)
{
u16 value = (data << 8) | reg;
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
QT_SET_GET_REGISTER, 0x40, value, uart,
NULL, 0, 300);
}
#define set_mctrl(dev, set) update_mctrl((dev), (set), 0)
#define clear_mctrl(dev, clear) update_mctrl((dev), 0, (clear))
/* these do not deal with device that have more than 1 port */
static inline int update_mctrl(struct usb_device *dev, unsigned int set,
unsigned int clear)
{
unsigned urb_value;
int result;
if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) {
dev_dbg(&dev->dev, "%s - DTR|RTS not being set|cleared\n", __func__);
return 0; /* no change */
}
clear &= ~set; /* 'set' takes precedence over 'clear' */
urb_value = 0;
if (set & TIOCM_DTR)
urb_value |= UART_MCR_DTR;
if (set & TIOCM_RTS)
urb_value |= UART_MCR_RTS;
Annotation
- Immediate include surface: `linux/errno.h`, `linux/slab.h`, `linux/tty.h`, `linux/tty_driver.h`, `linux/tty_flip.h`, `linux/module.h`, `linux/serial.h`, `linux/usb.h`.
- Detected declarations: `struct ssu100_port_private`, `function ssu100_control_msg`, `function ssu100_setdevice`, `function ssu100_getdevice`, `function ssu100_getregister`, `function ssu100_setregister`, `function update_mctrl`, `function ssu100_initdevice`, `function ssu100_set_termios`, `function ssu100_open`.
- Atlas domain: Driver Families / drivers/usb.
- 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.