summaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorAndrew Davis <afd@ti.com>2024-02-12 17:28:15 +0100
committerSebastian Reichel <sebastian.reichel@collabora.com>2024-02-13 02:17:25 +0100
commit7ddfd33c6ee58ee915d09177a7dbac2c5be7b536 (patch)
tree5f7d72e778eabb42f0067e2c2384be614ee38339 /drivers/power
parentpower: reset: atc260x-poweroff: Use devm_register_sys_off_handler(POWER_OFF) (diff)
downloadlinux-7ddfd33c6ee58ee915d09177a7dbac2c5be7b536.tar.xz
linux-7ddfd33c6ee58ee915d09177a7dbac2c5be7b536.zip
power: reset: xgene-reboot: Use devm_platform_ioremap_resource() helper
Use device life-cycle managed ioremap function to simplify probe and exit paths. While here add __iomem to the returned pointer to fix a sparse warning. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240212162831.67838-4-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.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/power/reset/xgene-reboot.c b/drivers/power/reset/xgene-reboot.c
index c2e5a99940d3..6b545a83d888 100644
--- a/drivers/power/reset/xgene-reboot.c
+++ b/drivers/power/reset/xgene-reboot.c
@@ -22,7 +22,7 @@
struct xgene_reboot_context {
struct device *dev;
- void *csr;
+ void __iomem *csr;
u32 mask;
struct notifier_block restart_handler;
};
@@ -54,7 +54,7 @@ static int xgene_reboot_probe(struct platform_device *pdev)
if (!ctx)
return -ENOMEM;
- ctx->csr = of_iomap(dev->of_node, 0);
+ ctx->csr = devm_platform_ioremap_resource(pdev, 0);
if (!ctx->csr) {
dev_err(dev, "can not map resource\n");
return -ENODEV;
@@ -67,10 +67,8 @@ static int xgene_reboot_probe(struct platform_device *pdev)
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);
+ if (err)
dev_err(dev, "cannot register restart handler (err=%d)\n", err);
- }
return err;
}