drivers/greybus/module.c
Source file repositories/reference/linux-study-clean/drivers/greybus/module.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/greybus/module.c- Extension
.c- Size
- 5045 bytes
- Lines
- 236
- Domain
- Driver Families
- Bucket
- drivers/greybus
- 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/greybus.hgreybus_trace.h
Detected Declarations
function eject_storefunction module_id_showfunction num_interfaces_showfunction gb_module_releasefunction gb_module_register_interfacefunction gb_module_deregister_interfacefunction gb_module_addfunction gb_module_delfunction gb_module_put
Annotated Snippet
ret = device_add(&module->dev);
if (ret) {
dev_err(&module->dev, "failed to register module: %d\n", ret);
return ret;
}
trace_gb_module_add(module);
for (i = 0; i < module->num_interfaces; ++i)
gb_module_register_interface(module->interfaces[i]);
return 0;
}
/* Deregister a module and its interfaces. */
void gb_module_del(struct gb_module *module)
{
size_t i;
for (i = 0; i < module->num_interfaces; ++i)
gb_module_deregister_interface(module->interfaces[i]);
trace_gb_module_del(module);
device_del(&module->dev);
}
void gb_module_put(struct gb_module *module)
{
size_t i;
for (i = 0; i < module->num_interfaces; ++i)
gb_interface_put(module->interfaces[i]);
put_device(&module->dev);
}
Annotation
- Immediate include surface: `linux/greybus.h`, `greybus_trace.h`.
- Detected declarations: `function eject_store`, `function module_id_show`, `function num_interfaces_show`, `function gb_module_release`, `function gb_module_register_interface`, `function gb_module_deregister_interface`, `function gb_module_add`, `function gb_module_del`, `function gb_module_put`.
- Atlas domain: Driver Families / drivers/greybus.
- 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.