drivers/greybus/hd.c
Source file repositories/reference/linux-study-clean/drivers/greybus/hd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/greybus/hd.c- Extension
.c- Size
- 5709 bytes
- Lines
- 257
- Domain
- Driver Families
- Bucket
- drivers/greybus
- 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/kernel.hlinux/slab.hlinux/greybus.hgreybus_trace.h
Detected Declarations
function gb_hd_outputfunction bus_id_showfunction gb_hd_cport_reservefunction gb_hd_cport_release_reservedfunction gb_hd_cport_allocatefunction gb_hd_cport_releasefunction gb_hd_releasefunction gb_hd_addfunction gb_hd_delfunction gb_hd_shutdownfunction gb_hd_putfunction gb_hd_initfunction gb_hd_exitexport gb_hd_outputexport gb_hd_cport_reserveexport gb_hd_cport_release_reservedexport gb_hd_createexport gb_hd_addexport gb_hd_delexport gb_hd_shutdownexport gb_hd_put
Annotated Snippet
ret = device_add(&hd->dev);
if (ret)
return ret;
ret = gb_svc_add(hd->svc);
if (ret) {
device_del(&hd->dev);
return ret;
}
trace_gb_hd_add(hd);
return 0;
}
EXPORT_SYMBOL_GPL(gb_hd_add);
void gb_hd_del(struct gb_host_device *hd)
{
trace_gb_hd_del(hd);
/*
* Tear down the svc and flush any on-going hotplug processing before
* removing the remaining interfaces.
*/
gb_svc_del(hd->svc);
device_del(&hd->dev);
}
EXPORT_SYMBOL_GPL(gb_hd_del);
void gb_hd_shutdown(struct gb_host_device *hd)
{
gb_svc_del(hd->svc);
}
EXPORT_SYMBOL_GPL(gb_hd_shutdown);
void gb_hd_put(struct gb_host_device *hd)
{
put_device(&hd->dev);
}
EXPORT_SYMBOL_GPL(gb_hd_put);
int __init gb_hd_init(void)
{
ida_init(&gb_hd_bus_id_map);
return 0;
}
void gb_hd_exit(void)
{
ida_destroy(&gb_hd_bus_id_map);
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/slab.h`, `linux/greybus.h`, `greybus_trace.h`.
- Detected declarations: `function gb_hd_output`, `function bus_id_show`, `function gb_hd_cport_reserve`, `function gb_hd_cport_release_reserved`, `function gb_hd_cport_allocate`, `function gb_hd_cport_release`, `function gb_hd_release`, `function gb_hd_add`, `function gb_hd_del`, `function gb_hd_shutdown`.
- Atlas domain: Driver Families / drivers/greybus.
- 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.