drivers/acpi/ec_sys.c
Source file repositories/reference/linux-study-clean/drivers/acpi/ec_sys.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/ec_sys.c- Extension
.c- Size
- 3227 bytes
- Lines
- 145
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/acpi.hlinux/debugfs.hlinux/module.hlinux/uaccess.hinternal.h
Detected Declarations
function acpi_ec_read_iofunction acpi_ec_write_iofunction acpi_ec_add_debugfsfunction acpi_ec_sys_initfunction acpi_ec_sys_exitmodule init acpi_ec_sys_init
Annotated Snippet
static const struct file_operations acpi_ec_io_ops = {
.owner = THIS_MODULE,
.open = simple_open,
.read = acpi_ec_read_io,
.write = acpi_ec_write_io,
.llseek = default_llseek,
};
static void acpi_ec_add_debugfs(struct acpi_ec *ec, unsigned int ec_device_count)
{
struct dentry *dev_dir;
char name[64];
umode_t mode = 0400;
if (ec_device_count == 0)
acpi_ec_debugfs_dir = debugfs_create_dir("ec", NULL);
sprintf(name, "ec%u", ec_device_count);
dev_dir = debugfs_create_dir(name, acpi_ec_debugfs_dir);
debugfs_create_x32("gpe", 0444, dev_dir, &first_ec->gpe);
debugfs_create_bool("use_global_lock", 0444, dev_dir,
&first_ec->global_lock);
if (write_support)
mode = 0600;
debugfs_create_file("io", mode, dev_dir, ec, &acpi_ec_io_ops);
}
static int __init acpi_ec_sys_init(void)
{
if (first_ec)
acpi_ec_add_debugfs(first_ec, 0);
return 0;
}
static void __exit acpi_ec_sys_exit(void)
{
debugfs_remove_recursive(acpi_ec_debugfs_dir);
}
module_init(acpi_ec_sys_init);
module_exit(acpi_ec_sys_exit);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/acpi.h`, `linux/debugfs.h`, `linux/module.h`, `linux/uaccess.h`, `internal.h`.
- Detected declarations: `function acpi_ec_read_io`, `function acpi_ec_write_io`, `function acpi_ec_add_debugfs`, `function acpi_ec_sys_init`, `function acpi_ec_sys_exit`, `module init acpi_ec_sys_init`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.