Skip to content

Commit

Permalink
power: reset: syscon-reboot: Add support for specifying priority
Browse files Browse the repository at this point in the history
Read new optional device tree property priority for specifying priority
level of reset handler. Default value is 192 as before.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
  • Loading branch information
Pali Rohár authored and Sebastian Reichel committed Feb 3, 2023
1 parent d7544cb commit e633329
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/power/reset/syscon-reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static int syscon_reboot_probe(struct platform_device *pdev)
struct syscon_reboot_context *ctx;
struct device *dev = &pdev->dev;
int mask_err, value_err;
int priority;
int err;

ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
Expand All @@ -57,6 +58,9 @@ static int syscon_reboot_probe(struct platform_device *pdev)
return PTR_ERR(ctx->map);
}

if (of_property_read_s32(pdev->dev.of_node, "priority", &priority))
priority = 192;

if (of_property_read_u32(pdev->dev.of_node, "offset", &ctx->offset))
return -EINVAL;

Expand All @@ -77,7 +81,7 @@ static int syscon_reboot_probe(struct platform_device *pdev)
}

ctx->restart_handler.notifier_call = syscon_restart_handle;
ctx->restart_handler.priority = 192;
ctx->restart_handler.priority = priority;
err = register_restart_handler(&ctx->restart_handler);
if (err)
dev_err(dev, "can't register restart notifier (err=%d)\n", err);
Expand Down

0 comments on commit e633329

Please sign in to comment.