include/linux/gameport.h
Source file repositories/reference/linux-study-clean/include/linux/gameport.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/gameport.h- Extension
.h- Size
- 5353 bytes
- Lines
- 210
- 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.
- 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/types.hlinux/list.hlinux/mutex.hlinux/device.hlinux/timer.hlinux/slab.huapi/linux/gameport.h
Detected Declarations
struct gameportstruct gameport_driverfunction gameport_register_portfunction gameport_unregister_portfunction __printffunction gameport_free_portfunction gameport_set_namefunction gameport_set_drvdatafunction gameport_pin_driverfunction gameport_unpin_driverfunction module_gameport_driverfunction gameport_readfunction gameport_cooked_readfunction gameport_calibratefunction gameport_timefunction gameport_set_poll_handlerfunction gameport_set_poll_interval
Annotated Snippet
struct device_driver driver;
bool ignore;
};
#define to_gameport_driver(d) container_of_const(d, struct gameport_driver, driver)
int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode);
void gameport_close(struct gameport *gameport);
#if IS_REACHABLE(CONFIG_GAMEPORT)
void __gameport_register_port(struct gameport *gameport, struct module *owner);
/* use a define to avoid include chaining to get THIS_MODULE */
#define gameport_register_port(gameport) \
__gameport_register_port(gameport, THIS_MODULE)
void gameport_unregister_port(struct gameport *gameport);
__printf(2, 3)
void gameport_set_phys(struct gameport *gameport, const char *fmt, ...);
#else
static inline void gameport_register_port(struct gameport *gameport)
{
return;
}
static inline void gameport_unregister_port(struct gameport *gameport)
{
return;
}
static inline __printf(2, 3)
void gameport_set_phys(struct gameport *gameport, const char *fmt, ...)
{
return;
}
#endif
static inline struct gameport *gameport_allocate_port(void)
{
struct gameport *gameport = kzalloc_obj(struct gameport);
return gameport;
}
static inline void gameport_free_port(struct gameport *gameport)
{
kfree(gameport);
}
static inline void gameport_set_name(struct gameport *gameport, const char *name)
{
strscpy(gameport->name, name, sizeof(gameport->name));
}
/*
* Use the following functions to manipulate gameport's per-port
* driver-specific data.
*/
static inline void *gameport_get_drvdata(struct gameport *gameport)
{
return dev_get_drvdata(&gameport->dev);
}
static inline void gameport_set_drvdata(struct gameport *gameport, void *data)
{
dev_set_drvdata(&gameport->dev, data);
}
/*
* Use the following functions to pin gameport's driver in process context
*/
static inline int gameport_pin_driver(struct gameport *gameport)
{
return mutex_lock_interruptible(&gameport->drv_mutex);
}
static inline void gameport_unpin_driver(struct gameport *gameport)
{
mutex_unlock(&gameport->drv_mutex);
}
int __must_check __gameport_register_driver(struct gameport_driver *drv,
struct module *owner, const char *mod_name);
/* use a define to avoid include chaining to get THIS_MODULE & friends */
#define gameport_register_driver(drv) \
Annotation
- Immediate include surface: `linux/types.h`, `linux/list.h`, `linux/mutex.h`, `linux/device.h`, `linux/timer.h`, `linux/slab.h`, `uapi/linux/gameport.h`.
- Detected declarations: `struct gameport`, `struct gameport_driver`, `function gameport_register_port`, `function gameport_unregister_port`, `function __printf`, `function gameport_free_port`, `function gameport_set_name`, `function gameport_set_drvdata`, `function gameport_pin_driver`, `function gameport_unpin_driver`.
- 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.
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.