From 21dda946e7aa86246bf7ca22fb1a1609407c4bb9 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 17 Oct 2022 09:09:54 +0200 Subject: 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 Link: https://lore.barebox.org/20221017071000.1458292-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- common/restart.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'common/restart.c') 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 */ -- cgit v1.2.3