drivers/power/reset/xgene-reboot.c
Source file repositories/reference/linux-study-clean/drivers/power/reset/xgene-reboot.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/power/reset/xgene-reboot.c- Extension
.c- Size
- 2018 bytes
- Lines
- 84
- 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.
- 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/delay.hlinux/io.hlinux/notifier.hlinux/of.hlinux/of_address.hlinux/platform_device.hlinux/reboot.hlinux/stat.hlinux/slab.h
Detected Declarations
struct xgene_reboot_contextfunction xgene_restart_handlerfunction xgene_reboot_probe
Annotated Snippet
struct xgene_reboot_context {
struct device *dev;
void __iomem *csr;
u32 mask;
};
static int xgene_restart_handler(struct sys_off_data *data)
{
struct xgene_reboot_context *ctx = data->cb_data;
/* Issue the reboot */
writel(ctx->mask, ctx->csr);
mdelay(1000);
dev_emerg(ctx->dev, "Unable to restart system\n");
return NOTIFY_DONE;
}
static int xgene_reboot_probe(struct platform_device *pdev)
{
struct xgene_reboot_context *ctx;
struct device *dev = &pdev->dev;
int err;
ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx)
return -ENOMEM;
ctx->csr = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(ctx->csr)) {
dev_err(dev, "can not map resource\n");
return PTR_ERR(ctx->csr);
}
if (of_property_read_u32(dev->of_node, "mask", &ctx->mask))
ctx->mask = 0xFFFFFFFF;
ctx->dev = dev;
err = devm_register_sys_off_handler(dev, SYS_OFF_MODE_RESTART, 128,
xgene_restart_handler, ctx);
if (err)
dev_err(dev, "cannot register restart handler (err=%d)\n", err);
return err;
}
static const struct of_device_id xgene_reboot_of_match[] = {
{ .compatible = "apm,xgene-reboot" },
{}
};
static struct platform_driver xgene_reboot_driver = {
.probe = xgene_reboot_probe,
.driver = {
.name = "xgene-reboot",
.of_match_table = xgene_reboot_of_match,
},
};
builtin_platform_driver(xgene_reboot_driver);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/io.h`, `linux/notifier.h`, `linux/of.h`, `linux/of_address.h`, `linux/platform_device.h`, `linux/reboot.h`, `linux/stat.h`.
- Detected declarations: `struct xgene_reboot_context`, `function xgene_restart_handler`, `function xgene_reboot_probe`.
- Atlas domain: Driver Families / drivers/power.
- Implementation status: source 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.