arch/arm/mach-omap2/omap_device.c
Source file repositories/reference/linux-study-clean/arch/arm/mach-omap2/omap_device.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/mach-omap2/omap_device.c- Extension
.c- Size
- 15576 bytes
- Lines
- 623
- Domain
- Architecture Layer
- Bucket
- arch/arm
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/kernel.hlinux/platform_device.hlinux/slab.hlinux/err.hlinux/io.hlinux/clk.hlinux/clkdev.hlinux/pm_domain.hlinux/pm_runtime.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/notifier.hcommon.hsoc.homap_device.homap_hwmod.h
Detected Declarations
function _add_clkdevfunction clk_getfunction PTR_ERRfunction _omap_device_notifier_callfunction _omap_device_enable_hwmodsfunction _omap_device_idle_hwmodsfunction omap_device_deletefunction _od_runtime_suspendfunction _od_runtime_resumefunction _od_fail_runtime_suspendfunction _od_fail_runtime_resumefunction _od_suspend_noirqfunction _od_resume_noirqfunction _omap_device_enable_hwmodsfunction _omap_device_idle_hwmodsfunction omap_hwmod_assert_hardresetfunction omap_hwmod_deassert_hardresetfunction omap_device_initfunction omap_device_late_idlefunction omap_device_late_init
Annotated Snippet
if (!oh) {
dev_err(&pdev->dev, "Cannot lookup hwmod '%s'\n",
oh_name);
ret = -EINVAL;
goto odbfd_exit1;
}
hwmods[i] = oh;
if (oh->flags & HWMOD_INIT_NO_IDLE)
device_active = true;
}
od = omap_device_alloc(pdev, hwmods, oh_cnt);
if (IS_ERR(od)) {
dev_err(&pdev->dev, "Cannot allocate omap_device for :%s\n",
oh_name);
ret = PTR_ERR(od);
goto odbfd_exit1;
}
/* Fix up missing resource names */
for (i = 0; i < pdev->num_resources; i++) {
struct resource *r = &pdev->resource[i];
if (r->name == NULL)
r->name = dev_name(&pdev->dev);
}
if (!skip_pm_domain) {
dev_pm_domain_set(&pdev->dev, &omap_device_pm_domain);
if (device_active) {
omap_device_enable(pdev);
pm_runtime_set_active(&pdev->dev);
}
}
odbfd_exit1:
kfree(hwmods);
odbfd_exit:
/* if data/we are at fault.. load up a fail handler */
if (ret)
dev_pm_domain_set(&pdev->dev, &omap_device_fail_pm_domain);
return ret;
}
static int _omap_device_notifier_call(struct notifier_block *nb,
unsigned long event, void *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct omap_device *od;
int err;
switch (event) {
case BUS_NOTIFY_REMOVED_DEVICE:
if (pdev->archdata.od)
omap_device_delete(pdev->archdata.od);
break;
case BUS_NOTIFY_UNBOUND_DRIVER:
od = to_omap_device(pdev);
if (od && (od->_state == OMAP_DEVICE_STATE_ENABLED)) {
dev_info(dev, "enabled after unload, idling\n");
err = omap_device_idle(pdev);
if (err)
dev_err(dev, "failed to idle\n");
}
break;
case BUS_NOTIFY_BIND_DRIVER:
od = to_omap_device(pdev);
if (od) {
od->_driver_status = BUS_NOTIFY_BIND_DRIVER;
if (od->_state == OMAP_DEVICE_STATE_ENABLED &&
pm_runtime_status_suspended(dev)) {
pm_runtime_set_active(dev);
}
}
break;
case BUS_NOTIFY_ADD_DEVICE:
if (pdev->dev.of_node)
omap_device_build_from_dt(pdev);
fallthrough;
default:
od = to_omap_device(pdev);
if (od)
od->_driver_status = event;
}
return NOTIFY_DONE;
}
/**
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/platform_device.h`, `linux/slab.h`, `linux/err.h`, `linux/io.h`, `linux/clk.h`, `linux/clkdev.h`, `linux/pm_domain.h`.
- Detected declarations: `function _add_clkdev`, `function clk_get`, `function PTR_ERR`, `function _omap_device_notifier_call`, `function _omap_device_enable_hwmods`, `function _omap_device_idle_hwmods`, `function omap_device_delete`, `function _od_runtime_suspend`, `function _od_runtime_resume`, `function _od_fail_runtime_suspend`.
- Atlas domain: Architecture Layer / arch/arm.
- 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.