drivers/mmc/core/pwrseq.c
Source file repositories/reference/linux-study-clean/drivers/mmc/core/pwrseq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mmc/core/pwrseq.c- Extension
.c- Size
- 2377 bytes
- Lines
- 118
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/err.hlinux/module.hlinux/of.hlinux/mmc/host.hpwrseq.h
Detected Declarations
function mmc_pwrseq_allocfunction mmc_pwrseq_pre_power_onfunction mmc_pwrseq_post_power_onfunction mmc_pwrseq_power_offfunction mmc_pwrseq_resetfunction mmc_pwrseq_freefunction mmc_pwrseq_registerfunction mmc_pwrseq_unregisterexport mmc_pwrseq_registerexport mmc_pwrseq_unregister
Annotated Snippet
if (device_match_of_node(p->dev, np)) {
if (!try_module_get(p->owner))
dev_err(host->parent,
"increasing module refcount failed\n");
else
host->pwrseq = p;
break;
}
}
of_node_put(np);
mutex_unlock(&pwrseq_list_mutex);
if (!host->pwrseq)
return -EPROBE_DEFER;
dev_info(host->parent, "allocated mmc-pwrseq\n");
return 0;
}
void mmc_pwrseq_pre_power_on(struct mmc_host *host)
{
struct mmc_pwrseq *pwrseq = host->pwrseq;
if (pwrseq && pwrseq->ops->pre_power_on)
pwrseq->ops->pre_power_on(host);
}
void mmc_pwrseq_post_power_on(struct mmc_host *host)
{
struct mmc_pwrseq *pwrseq = host->pwrseq;
if (pwrseq && pwrseq->ops->post_power_on)
pwrseq->ops->post_power_on(host);
}
void mmc_pwrseq_power_off(struct mmc_host *host)
{
struct mmc_pwrseq *pwrseq = host->pwrseq;
if (pwrseq && pwrseq->ops->power_off)
pwrseq->ops->power_off(host);
}
void mmc_pwrseq_reset(struct mmc_host *host)
{
struct mmc_pwrseq *pwrseq = host->pwrseq;
if (pwrseq && pwrseq->ops->reset)
pwrseq->ops->reset(host);
}
void mmc_pwrseq_free(struct mmc_host *host)
{
struct mmc_pwrseq *pwrseq = host->pwrseq;
if (pwrseq) {
module_put(pwrseq->owner);
host->pwrseq = NULL;
}
}
int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq)
{
if (!pwrseq || !pwrseq->ops || !pwrseq->dev)
return -EINVAL;
mutex_lock(&pwrseq_list_mutex);
list_add(&pwrseq->pwrseq_node, &pwrseq_list);
mutex_unlock(&pwrseq_list_mutex);
return 0;
}
EXPORT_SYMBOL_GPL(mmc_pwrseq_register);
void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq)
{
if (pwrseq) {
mutex_lock(&pwrseq_list_mutex);
list_del(&pwrseq->pwrseq_node);
mutex_unlock(&pwrseq_list_mutex);
}
}
EXPORT_SYMBOL_GPL(mmc_pwrseq_unregister);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/err.h`, `linux/module.h`, `linux/of.h`, `linux/mmc/host.h`, `pwrseq.h`.
- Detected declarations: `function mmc_pwrseq_alloc`, `function mmc_pwrseq_pre_power_on`, `function mmc_pwrseq_post_power_on`, `function mmc_pwrseq_power_off`, `function mmc_pwrseq_reset`, `function mmc_pwrseq_free`, `function mmc_pwrseq_register`, `function mmc_pwrseq_unregister`, `export mmc_pwrseq_register`, `export mmc_pwrseq_unregister`.
- 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.