diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2020-06-02 09:57:55 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-09-15 14:42:49 +0200 |
commit | b8ae5933bb138ad156af38fdb3226e14dc762f8f (patch) | |
tree | 3d5f955be9a1eaa30c72d4d0cfcc3dc00e5ee609 /common/restart.c | |
parent | 11359b39028689c0f9893645c0feb80ab7052baf (diff) | |
download | barebox-b8ae5933bb138ad156af38fdb3226e14dc762f8f.tar.gz barebox-b8ae5933bb138ad156af38fdb3226e14dc762f8f.tar.xz |
common: restart: number unnamed restart handlers
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>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/restart.c')
-rw-r--r-- | common/restart.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/common/restart.c b/common/restart.c index b19ae54657..dd15c8d5c3 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; } |