summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-10-17 09:09:54 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-10-27 11:13:29 +0200
commit21dda946e7aa86246bf7ca22fb1a1609407c4bb9 (patch)
treef0d9175cf0387e7972b92927dbfcd30cd0d2ca54 /common
parent1c32f4eb396c20af8031df10b3239b32d3b64005 (diff)
downloadbarebox-21dda946e7aa86246bf7ca22fb1a1609407c4bb9.tar.gz
barebox-21dda946e7aa86246bf7ca22fb1a1609407c4bb9.tar.xz
restart: do restart-priority OF parsing in restart_handler_register
The restart-priority OF property is parsed for a number of MFDs, but there is no reason really not to parse it for every restart handler that has a device tree node like we already do for watchdogs. Add a new struct restart_handler::of_node field and look into it if populated. With this of_get_restart_priority, is no longer used, so drop it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20221017071000.1458292-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/restart.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/common/restart.c b/common/restart.c
index b6f2bbf25b..9e988838bc 100644
--- a/common/restart.c
+++ b/common/restart.c
@@ -27,6 +27,11 @@ int restart_handler_register(struct restart_handler *rst)
if (!rst->priority)
rst->priority = RESTART_DEFAULT_PRIORITY;
+ if (rst->of_node) {
+ of_property_read_u32(rst->of_node, "restart-priority",
+ &rst->priority);
+ }
+
list_add_tail(&rst->list, &restart_handler_list);
pr_debug("registering restart handler \"%s\" with priority %d\n",
@@ -102,21 +107,6 @@ void __noreturn restart_machine(void)
hang();
}
-/**
- * of_get_restart_priority() - get the desired restart priority from device tree
- * @node: The device_node to read the property from
- *
- * return: The priority
- */
-unsigned int of_get_restart_priority(struct device_node *node)
-{
- unsigned int priority = RESTART_DEFAULT_PRIORITY;
-
- of_property_read_u32(node, "restart-priority", &priority);
-
- return priority;
-}
-
/*
* restart_handlers_print - print informations about all restart handlers
*/