drivers/mmc/core/host.c
Source file repositories/reference/linux-study-clean/drivers/mmc/core/host.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mmc/core/host.c- Extension
.c- Size
- 18504 bytes
- Lines
- 706
- Domain
- Driver Families
- Bucket
- drivers/mmc
- 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/device.hlinux/err.hlinux/idr.hlinux/of.hlinux/pagemap.hlinux/export.hlinux/leds.hlinux/slab.hlinux/mmc/host.hlinux/mmc/card.hlinux/mmc/slot-gpio.hcore.hcrypto.hhost.hslot-gpio.hpwrseq.hsdio_ops.h
Detected Declarations
function mmc_host_class_preparefunction mmc_host_class_completefunction mmc_host_classdev_releasefunction mmc_host_classdev_shutdownfunction mmc_register_host_classfunction mmc_unregister_host_classfunction mmc_retune_enablefunction mmc_retune_pausefunction mmc_retune_unpausefunction mmc_retune_disablefunction mmc_retune_timer_stopfunction mmc_retune_holdfunction mmc_retune_releasefunction mmc_retunefunction mmc_retune_timerfunction mmc_of_parse_timing_phasefunction mmc_of_parse_clk_phasefunction mmc_of_parsefunction mmc_of_parse_voltagefunction mmc_first_nonreserved_indexfunction devm_mmc_host_releasefunction mmc_validate_host_capsfunction mmc_add_hostfunction mmc_remove_hostfunction mmc_free_hostexport mmc_retune_pauseexport mmc_retune_unpauseexport mmc_retune_timer_stopexport mmc_retune_releaseexport mmc_of_parse_clk_phaseexport mmc_of_parseexport mmc_of_parse_voltageexport mmc_alloc_hostexport devm_mmc_alloc_hostexport mmc_add_hostexport mmc_remove_hostexport mmc_free_host
Annotated Snippet
err = device_add(&host->class_dev);
if (err)
return err;
led_trigger_register_simple(dev_name(&host->class_dev), &host->led);
mmc_add_host_debugfs(host);
mmc_start_host(host);
return 0;
}
EXPORT_SYMBOL(mmc_add_host);
/**
* mmc_remove_host - remove host hardware
* @host: mmc host
*
* Unregister and remove all cards associated with this host,
* and power down the MMC bus. No new requests will be issued
* after this function has returned.
*/
void mmc_remove_host(struct mmc_host *host)
{
mmc_stop_host(host);
mmc_remove_host_debugfs(host);
device_del(&host->class_dev);
led_trigger_unregister_simple(host->led);
}
EXPORT_SYMBOL(mmc_remove_host);
/**
* mmc_free_host - free the host structure
* @host: mmc host
*
* Free the host once all references to it have been dropped.
*/
void mmc_free_host(struct mmc_host *host)
{
cancel_delayed_work_sync(&host->detect);
mmc_pwrseq_free(host);
put_device(&host->class_dev);
}
EXPORT_SYMBOL(mmc_free_host);
Annotation
- Immediate include surface: `linux/device.h`, `linux/err.h`, `linux/idr.h`, `linux/of.h`, `linux/pagemap.h`, `linux/export.h`, `linux/leds.h`, `linux/slab.h`.
- Detected declarations: `function mmc_host_class_prepare`, `function mmc_host_class_complete`, `function mmc_host_classdev_release`, `function mmc_host_classdev_shutdown`, `function mmc_register_host_class`, `function mmc_unregister_host_class`, `function mmc_retune_enable`, `function mmc_retune_pause`, `function mmc_retune_unpause`, `function mmc_retune_disable`.
- Atlas domain: Driver Families / drivers/mmc.
- 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.