drivers/base/platform.c
Source file repositories/reference/linux-study-clean/drivers/base/platform.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/base/platform.c- Extension
.c- Size
- 40375 bytes
- Lines
- 1562
- Domain
- Driver Families
- Bucket
- drivers/base
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/string.hlinux/platform_device.hlinux/of_device.hlinux/of_irq.hlinux/module.hlinux/init.hlinux/interrupt.hlinux/ioport.hlinux/dma-mapping.hlinux/memblock.hlinux/err.hlinux/slab.hlinux/pm_runtime.hlinux/pm_domain.hlinux/idr.hlinux/acpi.hlinux/clk/clk-conf.hlinux/limits.hlinux/property.hlinux/kmemleak.hlinux/types.hlinux/iommu.hlinux/dma-map-ops.hbase.hpower/power.h
Detected Declarations
struct irq_affinity_devresstruct platform_objectfunction devm_platform_get_and_ioremap_resourcefunction devm_platform_ioremap_resource_bynamefunction request_irqfunction platform_get_irq_optionalfunction platform_get_irqfunction platform_irq_countfunction platform_disable_acpi_irqfunction devm_platform_get_irqs_affinity_releasefunction devm_platform_get_irqs_affinityfunction __platform_get_irq_bynamefunction platform_get_irqfunction platform_get_irq_bynamefunction platform_add_devicesfunction setup_pdev_dma_masksfunction platform_device_putfunction platform_device_releasefunction platform_device_release_fullfunction platform_device_add_resourcesfunction platform_device_add_datafunction platform_device_registerfunction devicefunction platform_device_registerfunction platform_device_putfunction __platform_driver_registerfunction platform_driver_unregisterfunction platform_probe_failfunction is_bound_to_driverfunction platform_driver_registerfunction __platform_create_bundlefunction platform_unregister_driversfunction platform_register_driversfunction platform_match_idfunction platform_legacy_suspendfunction platform_legacy_resumefunction platform_pm_suspendfunction platform_pm_resumefunction platform_pm_freezefunction platform_pm_thawfunction platform_pm_powerofffunction platform_pm_restorefunction modalias_showfunction numa_node_showfunction platform_dev_attrs_visiblefunction platform_matchfunction platform_ueventfunction platform_probe
Annotated Snippet
const struct device_driver *drv = dev->driver;
int ret = 0;
if (!drv)
return 0;
if (drv->pm) {
if (drv->pm->suspend)
ret = drv->pm->suspend(dev);
} else {
ret = platform_legacy_suspend(dev, PMSG_SUSPEND);
}
return ret;
}
int platform_pm_resume(struct device *dev)
{
const struct device_driver *drv = dev->driver;
int ret = 0;
if (!drv)
return 0;
if (drv->pm) {
if (drv->pm->resume)
ret = drv->pm->resume(dev);
} else {
ret = platform_legacy_resume(dev);
}
return ret;
}
#endif /* CONFIG_SUSPEND */
#ifdef CONFIG_HIBERNATE_CALLBACKS
int platform_pm_freeze(struct device *dev)
{
const struct device_driver *drv = dev->driver;
int ret = 0;
if (!drv)
return 0;
if (drv->pm) {
if (drv->pm->freeze)
ret = drv->pm->freeze(dev);
} else {
ret = platform_legacy_suspend(dev, PMSG_FREEZE);
}
return ret;
}
int platform_pm_thaw(struct device *dev)
{
const struct device_driver *drv = dev->driver;
int ret = 0;
if (!drv)
return 0;
if (drv->pm) {
if (drv->pm->thaw)
ret = drv->pm->thaw(dev);
} else {
ret = platform_legacy_resume(dev);
}
return ret;
}
int platform_pm_poweroff(struct device *dev)
{
const struct device_driver *drv = dev->driver;
int ret = 0;
if (!drv)
return 0;
if (drv->pm) {
if (drv->pm->poweroff)
ret = drv->pm->poweroff(dev);
} else {
ret = platform_legacy_suspend(dev, PMSG_HIBERNATE);
}
return ret;
Annotation
- Immediate include surface: `linux/string.h`, `linux/platform_device.h`, `linux/of_device.h`, `linux/of_irq.h`, `linux/module.h`, `linux/init.h`, `linux/interrupt.h`, `linux/ioport.h`.
- Detected declarations: `struct irq_affinity_devres`, `struct platform_object`, `function devm_platform_get_and_ioremap_resource`, `function devm_platform_ioremap_resource_byname`, `function request_irq`, `function platform_get_irq_optional`, `function platform_get_irq`, `function platform_irq_count`, `function platform_disable_acpi_irq`, `function devm_platform_get_irqs_affinity_release`.
- Atlas domain: Driver Families / drivers/base.
- Implementation status: pattern implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.