From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/3] common: restart: number unnamed restart handlers
Date: Tue, 2 Jun 2020 09:57:55 +0200 [thread overview]
Message-ID: <20200602075757.4734-1-a.fatoum@pengutronix.de> (raw)
Follow-up commit allows referencing specific restart handler by name.
Restart handlers default to "default" as name when none is given.
Number them sequentially instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
common/restart.c | 4 +++-
include/restart.h | 1 -
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/common/restart.c b/common/restart.c
index b19ae54657c0..dd15c8d5c362 100644
--- a/common/restart.c
+++ b/common/restart.c
@@ -19,6 +19,7 @@
#include <of.h>
static LIST_HEAD(restart_handler_list);
+static unsigned resetidx;
/**
* restart_handler_register() - register a handler for restarting the system
@@ -31,7 +32,7 @@ static LIST_HEAD(restart_handler_list);
int restart_handler_register(struct restart_handler *rst)
{
if (!rst->name)
- rst->name = RESTART_DEFAULT_NAME;
+ rst->name = basprintf("reset%u", resetidx);
if (!rst->priority)
rst->priority = RESTART_DEFAULT_PRIORITY;
@@ -40,6 +41,7 @@ int restart_handler_register(struct restart_handler *rst)
pr_debug("registering restart handler \"%s\" with priority %d\n",
rst->name, rst->priority);
+ resetidx++;
return 0;
}
diff --git a/include/restart.h b/include/restart.h
index 7ec0910e9404..6880b03b936f 100644
--- a/include/restart.h
+++ b/include/restart.h
@@ -15,7 +15,6 @@ int restart_handler_register(struct restart_handler *);
int restart_handler_register_fn(void (*restart_fn)(struct restart_handler *));
#define RESTART_DEFAULT_PRIORITY 100
-#define RESTART_DEFAULT_NAME "default"
unsigned int of_get_restart_priority(struct device_node *node);
--
2.27.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2020-06-02 7:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-02 7:57 Ahmad Fatoum [this message]
2020-06-02 7:57 ` [PATCH 2/3] restart: give all restart handlers a descriptive name Ahmad Fatoum
2020-06-03 7:12 ` Sascha Hauer
2020-09-15 12:05 ` [PATCH] fixup! " Ahmad Fatoum
2020-06-02 7:57 ` [PATCH 3/3] commands: reset: allow specifying reset by name Ahmad Fatoum
2020-06-03 7:11 ` [PATCH 1/3] common: restart: number unnamed restart handlers Sascha Hauer
2020-06-03 13:32 ` Ahmad Fatoum
2020-06-08 5:20 ` Sascha Hauer
2020-09-15 8:48 ` Ahmad Fatoum
2020-09-15 12:32 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200602075757.4734-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox