include/linux/serio.h
Source file repositories/reference/linux-study-clean/include/linux/serio.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/serio.h- Extension
.h- Size
- 4511 bytes
- Lines
- 168
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cleanup.hlinux/types.hlinux/interrupt.hlinux/list.hlinux/spinlock.hlinux/mutex.hlinux/device.hlinux/mod_devicetable.huapi/linux/serio.h
Detected Declarations
struct seriostruct serio_driverfunction module_serio_driverfunction serio_drv_write_wakeupfunction serio_set_drvdatafunction serio_pause_rxfunction serio_continue_rx
Annotated Snippet
extern const struct bus_type serio_bus;
struct serio {
void *port_data;
char name[32];
char phys[32];
char firmware_id[128];
bool manual_bind;
struct serio_device_id id;
/* Protects critical sections from port's interrupt handler */
spinlock_t lock;
int (*write)(struct serio *, unsigned char);
int (*open)(struct serio *);
void (*close)(struct serio *);
int (*start)(struct serio *);
void (*stop)(struct serio *);
struct serio *parent;
/* Entry in parent->children list */
struct list_head child_node;
struct list_head children;
/* Level of nesting in serio hierarchy */
unsigned int depth;
/*
* serio->drv is accessed from interrupt handlers; when modifying
* caller should acquire serio->drv_mutex and serio->lock.
*/
struct serio_driver *drv;
/* Protects serio->drv so attributes can pin current driver */
struct mutex drv_mutex;
struct device dev;
struct list_head node;
/*
* For use by PS/2 layer when several ports share hardware and
* may get indigestion when exposed to concurrent access (i8042).
*/
struct mutex *ps2_cmd_mutex;
};
#define to_serio_port(d) container_of(d, struct serio, dev)
struct serio_driver {
const char *description;
const struct serio_device_id *id_table;
bool manual_bind;
void (*write_wakeup)(struct serio *);
irqreturn_t (*interrupt)(struct serio *, unsigned char, unsigned int);
int (*connect)(struct serio *, struct serio_driver *drv);
int (*reconnect)(struct serio *);
int (*fast_reconnect)(struct serio *);
void (*disconnect)(struct serio *);
void (*cleanup)(struct serio *);
struct device_driver driver;
};
#define to_serio_driver(d) container_of_const(d, struct serio_driver, driver)
int serio_open(struct serio *serio, struct serio_driver *drv);
void serio_close(struct serio *serio);
void serio_rescan(struct serio *serio);
void serio_reconnect(struct serio *serio);
irqreturn_t serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags);
void __serio_register_port(struct serio *serio, struct module *owner);
/* use a define to avoid include chaining to get THIS_MODULE */
#define serio_register_port(serio) \
__serio_register_port(serio, THIS_MODULE)
void serio_unregister_port(struct serio *serio);
void serio_unregister_child_port(struct serio *serio);
int __must_check __serio_register_driver(struct serio_driver *drv,
struct module *owner, const char *mod_name);
/* use a define to avoid include chaining to get THIS_MODULE & friends */
#define serio_register_driver(drv) \
__serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME)
void serio_unregister_driver(struct serio_driver *drv);
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/types.h`, `linux/interrupt.h`, `linux/list.h`, `linux/spinlock.h`, `linux/mutex.h`, `linux/device.h`, `linux/mod_devicetable.h`.
- Detected declarations: `struct serio`, `struct serio_driver`, `function module_serio_driver`, `function serio_drv_write_wakeup`, `function serio_set_drvdata`, `function serio_pause_rx`, `function serio_continue_rx`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.