summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorAndrew Davis <afd@ti.com>2024-02-12 19:28:16 +0300
committerSebastian Reichel <sebastian.reichel@collabora.com>2024-02-13 04:17:25 +0300
commit6af1ee028537be0a43ce939eb8f5321096208667 (patch)
tree385521349e4cd4a2a8cb6224a2a1521994d5c5fe /drivers/power
parent7ddfd33c6ee58ee915d09177a7dbac2c5be7b536 (diff)
downloadlinux-6af1ee028537be0a43ce939eb8f5321096208667.tar.xz
power: reset: xgene-reboot: Use devm_register_sys_off_handler(RESTART)
Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240212162831.67838-5-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/reset/xgene-reboot.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/power/reset/xgene-reboot.c b/drivers/power/reset/xgene-reboot.c
index 6b545a83d888..867162dfe7ea 100644
--- a/drivers/power/reset/xgene-reboot.c
+++ b/drivers/power/reset/xgene-reboot.c
@@ -24,15 +24,11 @@ struct xgene_reboot_context {
struct device *dev;
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);
@@ -64,9 +60,8 @@ static int xgene_reboot_probe(struct platform_device *pdev)
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);
+ 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);