drivers/power/reset/vexpress-poweroff.c
Source file repositories/reference/linux-study-clean/drivers/power/reset/vexpress-poweroff.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/power/reset/vexpress-poweroff.c- Extension
.c- Size
- 3408 bytes
- Lines
- 147
- Domain
- Driver Families
- Bucket
- drivers/power
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/delay.hlinux/notifier.hlinux/of.hlinux/platform_device.hlinux/property.hlinux/reboot.hlinux/stat.hlinux/vexpress.h
Detected Declarations
enum vexpress_reset_funcfunction Copyrightfunction vexpress_power_offfunction vexpress_restartfunction vexpress_reset_active_showfunction vexpress_reset_active_storefunction _vexpress_register_restart_handlerfunction vexpress_reset_probe
Annotated Snippet
if (err) {
dev_err(dev, "cannot register restart handler (err=%d)\n", err);
atomic_dec(&vexpress_restart_nb_refcnt);
return err;
}
}
device_create_file(dev, &dev_attr_active);
return 0;
}
static int vexpress_reset_probe(struct platform_device *pdev)
{
enum vexpress_reset_func func;
struct regmap *regmap;
int ret = 0;
regmap = devm_regmap_init_vexpress_config(&pdev->dev);
if (IS_ERR(regmap))
return PTR_ERR(regmap);
dev_set_drvdata(&pdev->dev, regmap);
func = (uintptr_t)device_get_match_data(&pdev->dev);
switch (func) {
case FUNC_SHUTDOWN:
vexpress_power_off_device = &pdev->dev;
pm_power_off = vexpress_power_off;
break;
case FUNC_RESET:
if (!vexpress_restart_device)
ret = _vexpress_register_restart_handler(&pdev->dev);
break;
case FUNC_REBOOT:
ret = _vexpress_register_restart_handler(&pdev->dev);
break;
}
return ret;
}
static struct platform_driver vexpress_reset_driver = {
.probe = vexpress_reset_probe,
.driver = {
.name = "vexpress-reset",
.of_match_table = vexpress_reset_of_match,
.suppress_bind_attrs = true,
},
};
builtin_platform_driver(vexpress_reset_driver);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/notifier.h`, `linux/of.h`, `linux/platform_device.h`, `linux/property.h`, `linux/reboot.h`, `linux/stat.h`, `linux/vexpress.h`.
- Detected declarations: `enum vexpress_reset_func`, `function Copyright`, `function vexpress_power_off`, `function vexpress_restart`, `function vexpress_reset_active_show`, `function vexpress_reset_active_store`, `function _vexpress_register_restart_handler`, `function vexpress_reset_probe`.
- Atlas domain: Driver Families / drivers/power.
- Implementation status: source 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.