lib/devres.c
Source file repositories/reference/linux-study-clean/lib/devres.c
File Facts
- System
- Linux kernel
- Corpus path
lib/devres.c- Extension
.c- Size
- 10494 bytes
- Lines
- 400
- Domain
- Kernel Services
- Bucket
- lib
- Inferred role
- Kernel Services: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bug.hlinux/device.hlinux/errno.hlinux/export.hlinux/gfp_types.hlinux/io.hlinux/ioport.hlinux/of_address.hlinux/types.h
Detected Declarations
struct arch_io_reserve_memtype_wc_devresenum devm_ioremap_typefunction devm_ioremap_releasefunction devm_ioremap_matchfunction ioremapfunction ioremap_ucfunction ioremap_wcfunction iounmapfunction __devm_ioremap_resourcefunction devm_ioremap_resource_wcfunction of_iomapfunction devm_ioport_map_releasefunction devm_ioport_map_matchfunction ioport_mapfunction ioport_unmapfunction devm_arch_phys_ac_add_releasefunction arch_phys_wc_addfunction devm_arch_io_free_memtype_wc_releasefunction arch_io_reserve_memtype_wcexport devm_ioremapexport devm_ioremap_ucexport devm_ioremap_wcexport devm_iounmapexport devm_ioremap_resourceexport devm_ioremap_resource_wcexport devm_of_iomapexport devm_ioport_mapexport devm_ioport_unmapexport devm_arch_phys_wc_addexport devm_arch_io_reserve_memtype_wc
Annotated Snippet
struct arch_io_reserve_memtype_wc_devres {
resource_size_t start;
resource_size_t size;
};
static void devm_arch_io_free_memtype_wc_release(struct device *dev, void *res)
{
const struct arch_io_reserve_memtype_wc_devres *this = res;
arch_io_free_memtype_wc(this->start, this->size);
}
/**
* devm_arch_io_reserve_memtype_wc - Managed arch_io_reserve_memtype_wc()
* @dev: Managed device
* @start: Memory base address
* @size: Size of memory range
*
* Reserves a memory range with WC caching using arch_io_reserve_memtype_wc()
* and sets up a release callback See arch_io_reserve_memtype_wc() for more
* information.
*/
int devm_arch_io_reserve_memtype_wc(struct device *dev, resource_size_t start,
resource_size_t size)
{
struct arch_io_reserve_memtype_wc_devres *dr;
int ret;
dr = devres_alloc_node(devm_arch_io_free_memtype_wc_release, sizeof(*dr), GFP_KERNEL,
dev_to_node(dev));
if (!dr)
return -ENOMEM;
ret = arch_io_reserve_memtype_wc(start, size);
if (ret < 0) {
devres_free(dr);
return ret;
}
dr->start = start;
dr->size = size;
devres_add(dev, dr);
return ret;
}
EXPORT_SYMBOL(devm_arch_io_reserve_memtype_wc);
Annotation
- Immediate include surface: `linux/bug.h`, `linux/device.h`, `linux/errno.h`, `linux/export.h`, `linux/gfp_types.h`, `linux/io.h`, `linux/ioport.h`, `linux/of_address.h`.
- Detected declarations: `struct arch_io_reserve_memtype_wc_devres`, `enum devm_ioremap_type`, `function devm_ioremap_release`, `function devm_ioremap_match`, `function ioremap`, `function ioremap_uc`, `function ioremap_wc`, `function iounmap`, `function __devm_ioremap_resource`, `function devm_ioremap_resource_wc`.
- Atlas domain: Kernel Services / lib.
- 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.