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>
This commit is contained in:
Andrew Davis 2024-02-12 10:28:15 -06:00 committed by Sebastian Reichel
parent ab1439b051
commit 7ddfd33c6e

View File

@ -22,7 +22,7 @@
struct xgene_reboot_context { struct xgene_reboot_context {
struct device *dev; struct device *dev;
void *csr; void __iomem *csr;
u32 mask; u32 mask;
struct notifier_block restart_handler; struct notifier_block restart_handler;
}; };
@ -54,7 +54,7 @@ static int xgene_reboot_probe(struct platform_device *pdev)
if (!ctx) if (!ctx)
return -ENOMEM; return -ENOMEM;
ctx->csr = of_iomap(dev->of_node, 0); ctx->csr = devm_platform_ioremap_resource(pdev, 0);
if (!ctx->csr) { if (!ctx->csr) {
dev_err(dev, "can not map resource\n"); dev_err(dev, "can not map resource\n");
return -ENODEV; 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.notifier_call = xgene_restart_handler;
ctx->restart_handler.priority = 128; ctx->restart_handler.priority = 128;
err = register_restart_handler(&ctx->restart_handler); err = register_restart_handler(&ctx->restart_handler);
if (err) { if (err)
iounmap(ctx->csr);
dev_err(dev, "cannot register restart handler (err=%d)\n", err); dev_err(dev, "cannot register restart handler (err=%d)\n", err);
}
return err; return err;
} }