summaryrefslogtreecommitdiffstats
path: root/drivers/power/reset/xgene-reboot.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:11:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:11:27 +0000
commit34996e42f82bfd60bc2c191e5cae3c6ab233ec6c (patch)
tree62db60558cbf089714b48daeabca82bf2b20b20e /drivers/power/reset/xgene-reboot.c
parentAdding debian version 6.8.12-1. (diff)
downloadlinux-34996e42f82bfd60bc2c191e5cae3c6ab233ec6c.tar.xz
linux-34996e42f82bfd60bc2c191e5cae3c6ab233ec6c.zip
Merging upstream version 6.9.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/power/reset/xgene-reboot.c')
-rw-r--r--drivers/power/reset/xgene-reboot.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/drivers/power/reset/xgene-reboot.c b/drivers/power/reset/xgene-reboot.c
index c2e5a99940..b5eee19bac 100644
--- a/drivers/power/reset/xgene-reboot.c
+++ b/drivers/power/reset/xgene-reboot.c
@@ -22,17 +22,13 @@
struct xgene_reboot_context {
struct device *dev;
- void *csr;
+ void __iomem *csr;
u32 mask;
- struct notifier_block restart_handler;
};
-static int xgene_restart_handler(struct notifier_block *this,
- unsigned long mode, void *cmd)
+static int xgene_restart_handler(struct sys_off_data *data)
{
- struct xgene_reboot_context *ctx =
- container_of(this, struct xgene_reboot_context,
- restart_handler);
+ struct xgene_reboot_context *ctx = data->cb_data;
/* Issue the reboot */
writel(ctx->mask, ctx->csr);
@@ -54,23 +50,20 @@ static int xgene_reboot_probe(struct platform_device *pdev)
if (!ctx)
return -ENOMEM;
- ctx->csr = of_iomap(dev->of_node, 0);
- if (!ctx->csr) {
+ ctx->csr = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(ctx->csr)) {
dev_err(dev, "can not map resource\n");
- return -ENODEV;
+ return PTR_ERR(ctx->csr);
}
if (of_property_read_u32(dev->of_node, "mask", &ctx->mask))
ctx->mask = 0xFFFFFFFF;
ctx->dev = dev;
- ctx->restart_handler.notifier_call = xgene_restart_handler;
- ctx->restart_handler.priority = 128;
- err = register_restart_handler(&ctx->restart_handler);
- if (err) {
- iounmap(ctx->csr);
+ 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;
}