drivers/bus/fsl-mc/mc-io.c
Source file repositories/reference/linux-study-clean/drivers/bus/fsl-mc/mc-io.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bus/fsl-mc/mc-io.c- Extension
.c- Size
- 6799 bytes
- Lines
- 273
- Domain
- Driver Families
- Bucket
- drivers/bus
- 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.
- 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/io.hlinux/fsl/mc.hfsl-mc-private.h
Detected Declarations
function fsl_mc_io_set_dpmcpfunction fsl_mc_io_unset_dpmcpfunction fsl_create_mc_iofunction fsl_destroy_mc_iofunction fsl_mc_portal_allocatefunction fsl_mc_portal_freeexport fsl_mc_portal_allocateexport fsl_mc_portal_free
Annotated Snippet
if (!dpmcp_dev->consumer_link) {
error = -EINVAL;
goto error_cleanup_mc_io;
}
}
*new_mc_io = mc_io;
return 0;
error_cleanup_mc_io:
fsl_destroy_mc_io(mc_io);
error_cleanup_resource:
fsl_mc_resource_free(resource);
return error;
}
EXPORT_SYMBOL_GPL(fsl_mc_portal_allocate);
/**
* fsl_mc_portal_free - Returns an MC portal to the pool of free MC portals
* of a given MC bus
*
* @mc_io: Pointer to the fsl_mc_io object that wraps the MC portal to free
*/
void fsl_mc_portal_free(struct fsl_mc_io *mc_io)
{
struct fsl_mc_device *dpmcp_dev;
struct fsl_mc_resource *resource;
/*
* Every mc_io obtained by calling fsl_mc_portal_allocate() is supposed
* to have a DPMCP object associated with.
*/
dpmcp_dev = mc_io->dpmcp_dev;
resource = dpmcp_dev->resource;
if (!resource || resource->type != FSL_MC_POOL_DPMCP)
return;
if (resource->data != dpmcp_dev)
return;
fsl_destroy_mc_io(mc_io);
fsl_mc_resource_free(resource);
dpmcp_dev->consumer_link = NULL;
}
EXPORT_SYMBOL_GPL(fsl_mc_portal_free);
Annotation
- Immediate include surface: `linux/io.h`, `linux/fsl/mc.h`, `fsl-mc-private.h`.
- Detected declarations: `function fsl_mc_io_set_dpmcp`, `function fsl_mc_io_unset_dpmcp`, `function fsl_create_mc_io`, `function fsl_destroy_mc_io`, `function fsl_mc_portal_allocate`, `function fsl_mc_portal_free`, `export fsl_mc_portal_allocate`, `export fsl_mc_portal_free`.
- Atlas domain: Driver Families / drivers/bus.
- Implementation status: integration 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.