drivers/gpio/gpio-sim.c
Source file repositories/reference/linux-study-clean/drivers/gpio/gpio-sim.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpio/gpio-sim.c- Extension
.c- Size
- 40083 bytes
- Lines
- 1645
- Domain
- Driver Families
- Bucket
- drivers/gpio
- 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.
- 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/array_size.hlinux/bitmap.hlinux/cleanup.hlinux/configfs.hlinux/device.hlinux/err.hlinux/gpio/consumer.hlinux/gpio/driver.hlinux/gpio/machine.hlinux/idr.hlinux/interrupt.hlinux/irq.hlinux/irq_sim.hlinux/list.hlinux/lockdep.hlinux/minmax.hlinux/mod_devicetable.hlinux/module.hlinux/mutex.hlinux/notifier.hlinux/platform_device.hlinux/property.hlinux/seq_file.hlinux/slab.hlinux/string.hlinux/string_helpers.hlinux/sysfs.hlinux/types.h
Detected Declarations
struct gpio_sim_chipstruct gpio_sim_attributestruct gpio_sim_devicestruct gpio_sim_bankstruct gpio_sim_hogstruct gpio_sim_linestruct gpio_sim_hogstruct gpio_sim_chip_name_ctxfunction to_gpio_sim_attrfunction gpio_sim_apply_pullfunction gpio_sim_getfunction gpio_sim_setfunction gpio_sim_get_multiplefunction gpio_sim_set_multiplefunction gpio_sim_direction_outputfunction scoped_guardfunction gpio_sim_direction_inputfunction gpio_sim_get_directionfunction gpio_sim_set_configfunction gpio_sim_to_irqfunction gpio_sim_requestfunction gpio_sim_freefunction scoped_guardfunction gpio_sim_irq_requestedfunction gpio_sim_irq_releasedfunction gpio_sim_dbg_showfunction gpio_sim_sysfs_val_showfunction gpio_sim_sysfs_val_storefunction gpio_sim_sysfs_pull_showfunction gpio_sim_sysfs_pull_storefunction gpio_sim_put_devicefunction gpio_sim_dispose_mappingsfunction gpio_sim_sysfs_removefunction gpio_sim_setup_sysfsfunction gpio_sim_add_bankfunction gpio_sim_probefunction device_for_each_child_node_scopedfunction gpio_sim_bank_has_labelfunction gpio_sim_bank_get_devicefunction gpio_sim_line_get_devicefunction gpio_sim_device_is_livefunction gpio_sim_device_config_dev_name_showfunction gpio_sim_device_config_live_showfunction gpio_sim_get_line_names_sizefunction list_for_each_entryfunction gpio_sim_set_line_namesfunction list_for_each_entryfunction gpio_sim_get_reserved_ranges_size
Annotated Snippet
module_init(gpio_sim_init);
static void __exit gpio_sim_exit(void)
{
configfs_unregister_subsystem(&gpio_sim_config_subsys);
mutex_destroy(&gpio_sim_config_subsys.su_mutex);
platform_driver_unregister(&gpio_sim_driver);
}
module_exit(gpio_sim_exit);
MODULE_AUTHOR("Bartosz Golaszewski <brgl@bgdev.pl>");
MODULE_DESCRIPTION("GPIO Simulator Module");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/array_size.h`, `linux/bitmap.h`, `linux/cleanup.h`, `linux/configfs.h`, `linux/device.h`, `linux/err.h`, `linux/gpio/consumer.h`, `linux/gpio/driver.h`.
- Detected declarations: `struct gpio_sim_chip`, `struct gpio_sim_attribute`, `struct gpio_sim_device`, `struct gpio_sim_bank`, `struct gpio_sim_hog`, `struct gpio_sim_line`, `struct gpio_sim_hog`, `struct gpio_sim_chip_name_ctx`, `function to_gpio_sim_attr`, `function gpio_sim_apply_pull`.
- Atlas domain: Driver Families / drivers/gpio.
- 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.