diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-03-12 09:04:21 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-05-20 15:43:58 +0200 |
commit | 932fff4911529d3663fa01b99cfb5dddb42feb6e (patch) | |
tree | 658b59aecea7960217fd063dac58cc450548097a /common/poller.c | |
parent | c10b20dc83ac25b1d81c39eaad4529d9911813b1 (diff) | |
download | barebox-932fff4911529d3663fa01b99cfb5dddb42feb6e.tar.gz barebox-932fff4911529d3663fa01b99cfb5dddb42feb6e.tar.xz |
poller: Give pollers a name
It helps debugging when pollers have a name, so give them one.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/poller.c')
-rw-r--r-- | common/poller.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/common/poller.c b/common/poller.c index 32795b641f..b1a2122f91 100644 --- a/common/poller.c +++ b/common/poller.c @@ -16,11 +16,12 @@ static LIST_HEAD(poller_list); static int poller_active; -int poller_register(struct poller_struct *poller) +int poller_register(struct poller_struct *poller, const char *name) { if (poller->registered) return -EBUSY; + poller->name = xstrdup(name); list_add_tail(&poller->list, &poller_list); poller->registered = 1; @@ -35,6 +36,7 @@ int poller_unregister(struct poller_struct *poller) list_del(&poller->list); poller->registered = 0; + free(poller->name); return 0; } @@ -92,12 +94,12 @@ int poller_call_async(struct poller_async *pa, uint64_t delay_ns, return 0; } -int poller_async_register(struct poller_async *pa) +int poller_async_register(struct poller_async *pa, const char *name) { pa->poller.func = poller_async_callback; pa->active = 0; - return poller_register(&pa->poller); + return poller_register(&pa->poller, name); } int poller_async_unregister(struct poller_async *pa) |