From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: "Edmund Henniges" <eh@emlix.com>, "Daniel Glöckner" <dg@emlix.com>
Subject: [PATCH 01/19] poller: Give pollers a name
Date: Wed, 20 May 2020 11:43:45 +0200 [thread overview]
Message-ID: <20200520094403.12651-2-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20200520094403.12651-1-s.hauer@pengutronix.de>
It helps debugging when pollers have a name, so give them one.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/mioa701/gpio0_poweroff.c | 2 +-
arch/arm/boards/sama5d3xek/init.c | 2 +-
common/poller.c | 8 +++++---
common/ratp/ratp.c | 2 +-
drivers/input/gpio_keys.c | 2 +-
drivers/input/imx_keypad.c | 2 +-
drivers/input/input.c | 2 +-
drivers/input/qt1070.c | 2 +-
drivers/input/twl6030_pwrbtn.c | 2 +-
drivers/led/core.c | 2 +-
drivers/net/usb/ax88179_178a.c | 2 +-
drivers/usb/gadget/udc-core.c | 2 +-
drivers/watchdog/wd_core.c | 2 +-
include/poller.h | 5 +++--
14 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/arch/arm/boards/mioa701/gpio0_poweroff.c b/arch/arm/boards/mioa701/gpio0_poweroff.c
index 4b34922507..8caccebeab 100644
--- a/arch/arm/boards/mioa701/gpio0_poweroff.c
+++ b/arch/arm/boards/mioa701/gpio0_poweroff.c
@@ -73,7 +73,7 @@ static struct poller_struct gpio0_poller = {
static int gpio0_poweroff_probe(void)
{
- return poller_register(&gpio0_poller);
+ return poller_register(&gpio0_poller, "power-button");
}
device_initcall(gpio0_poweroff_probe);
diff --git a/arch/arm/boards/sama5d3xek/init.c b/arch/arm/boards/sama5d3xek/init.c
index c768e98d26..d9be4c5f9d 100644
--- a/arch/arm/boards/sama5d3xek/init.c
+++ b/arch/arm/boards/sama5d3xek/init.c
@@ -408,7 +408,7 @@ static void ek_add_device_hdmi(void)
hdmi_reset_start = get_time_ns();
hdmi_poller.func = hdmi_off_poller;
- poller_register(&hdmi_poller);
+ poller_register(&hdmi_poller, "hdmi-reset");
}
#else
static void ek_add_device_hdmi(void)
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)
diff --git a/common/ratp/ratp.c b/common/ratp/ratp.c
index ca751a30eb..556dc638d8 100644
--- a/common/ratp/ratp.c
+++ b/common/ratp/ratp.c
@@ -451,7 +451,7 @@ int barebox_ratp(struct console_device *cdev)
if (ret < 0)
goto out;
- ret = poller_register(&ctx->poller);
+ ret = poller_register(&ctx->poller, "ratp");
if (ret)
goto out1;
diff --git a/drivers/input/gpio_keys.c b/drivers/input/gpio_keys.c
index 38c0f11535..11d598c402 100644
--- a/drivers/input/gpio_keys.c
+++ b/drivers/input/gpio_keys.c
@@ -166,7 +166,7 @@ static int __init gpio_keys_probe(struct device_d *dev)
if (ret)
return ret;
- ret = poller_register(&gk->poller);
+ ret = poller_register(&gk->poller, dev_name(dev));
if (ret)
return ret;
diff --git a/drivers/input/imx_keypad.c b/drivers/input/imx_keypad.c
index 44ff9b7856..6757fac72b 100644
--- a/drivers/input/imx_keypad.c
+++ b/drivers/input/imx_keypad.c
@@ -410,7 +410,7 @@ static int __init imx_keypad_probe(struct device_d *dev)
keypad->poller.func = imx_keypad_check_for_events;
- ret = poller_register(&keypad->poller);
+ ret = poller_register(&keypad->poller, dev_name(dev));
if (ret)
return ret;
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 1e8f6e178e..bcc8667417 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -201,7 +201,7 @@ static int input_init(void)
ic->fifo = kfifo_alloc(32);
ic->notifier.notify = input_console_notify;
input_register_notfier(&ic->notifier);
- poller_async_register(&ic->poller);
+ poller_async_register(&ic->poller, "input");
return console_register(&ic->console);
}
diff --git a/drivers/input/qt1070.c b/drivers/input/qt1070.c
index 59acee5c39..9e1dcc57ee 100644
--- a/drivers/input/qt1070.c
+++ b/drivers/input/qt1070.c
@@ -269,7 +269,7 @@ static int qt1070_probe(struct device_d *dev)
console_register(&data->cdev);
- ret = poller_register(&data->poller);
+ ret = poller_register(&data->poller, dev_name(dev));
if (ret)
goto err;
diff --git a/drivers/input/twl6030_pwrbtn.c b/drivers/input/twl6030_pwrbtn.c
index fc4c728778..481688b4a9 100644
--- a/drivers/input/twl6030_pwrbtn.c
+++ b/drivers/input/twl6030_pwrbtn.c
@@ -97,7 +97,7 @@ static int __init twl6030_pwrbtn_probe(struct device_d *dev)
idata->cdev.getc = twl6030_pwrbtn_getc;
console_register(&idata->cdev);
- return poller_register(&idata->poller);
+ return poller_register(&idata->poller, dev_name(dev));
}
static struct driver_d twl6030_pwrbtn_driver = {
diff --git a/drivers/led/core.c b/drivers/led/core.c
index eeeeaa0ff3..ab171c6184 100644
--- a/drivers/led/core.c
+++ b/drivers/led/core.c
@@ -209,7 +209,7 @@ static struct poller_struct led_poller = {
static int led_blink_init(void)
{
- return poller_register(&led_poller);
+ return poller_register(&led_poller, "led");
}
late_initcall(led_blink_init);
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index 6fea5a7b1d..fddb187144 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -409,7 +409,7 @@ static int ax88179_bind(struct usbnet *dev)
priv->last = get_time_ns();
priv->poller.func = ax88179_poller;
- poller_register(&priv->poller);
+ poller_register(&priv->poller, dev_name(&dev->udev->dev));
return 0;
}
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
index 096f05ed48..126d76e8bb 100644
--- a/drivers/usb/gadget/udc-core.c
+++ b/drivers/usb/gadget/udc-core.c
@@ -319,7 +319,7 @@ static int udc_bind_to_driver(struct usb_udc *udc, struct usb_gadget_driver *dri
if (udc->gadget->ops->udc_poll) {
udc->poller.func = udc_poll_driver;
- ret = poller_register(&udc->poller);
+ ret = poller_register(&udc->poller, dev_name(&udc->dev));
if (ret)
return ret;
}
diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
index 34040408f7..a17234f4b6 100644
--- a/drivers/watchdog/wd_core.c
+++ b/drivers/watchdog/wd_core.c
@@ -116,7 +116,7 @@ static int watchdog_register_poller(struct watchdog *wd)
struct param_d *p;
int ret;
- ret = poller_async_register(&wd->poller);
+ ret = poller_async_register(&wd->poller, dev_name(&wd->dev));
if (ret)
return ret;
diff --git a/include/poller.h b/include/poller.h
index b22b8a1b89..886557252b 100644
--- a/include/poller.h
+++ b/include/poller.h
@@ -12,9 +12,10 @@ struct poller_struct {
void (*func)(struct poller_struct *poller);
int registered;
struct list_head list;
+ char *name;
};
-int poller_register(struct poller_struct *poller);
+int poller_register(struct poller_struct *poller, const char *name);
int poller_unregister(struct poller_struct *poller);
struct poller_async;
@@ -27,7 +28,7 @@ struct poller_async {
int active;
};
-int poller_async_register(struct poller_async *pa);
+int poller_async_register(struct poller_async *pa, const char *name);
int poller_async_unregister(struct poller_async *pa);
int poller_call_async(struct poller_async *pa, uint64_t delay_ns,
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-05-20 9:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-20 9:43 [PATCH 00/19] Slices and fastboot over UDP Sascha Hauer
2020-05-20 9:43 ` Sascha Hauer [this message]
2020-05-20 9:43 ` [PATCH 02/19] poller: Add a poller command Sascha Hauer
2020-05-20 9:43 ` [PATCH 03/19] fastboot: split generic code from USB gadget Sascha Hauer
2020-05-20 9:43 ` [PATCH 04/19] fastboot: don't close fd 0 when downloading to ram Sascha Hauer
2020-05-20 9:43 ` [PATCH 05/19] fastboot: Use unique tempfile name Sascha Hauer
2020-05-20 9:43 ` [PATCH 06/19] Introduce slices Sascha Hauer
2020-05-20 9:43 ` [PATCH 07/19] Introduce idle slice Sascha Hauer
2020-05-22 11:56 ` Daniel Glöckner
2020-05-25 8:09 ` Sascha Hauer
2020-05-20 9:43 ` [PATCH 08/19] net: Add a slice to struct eth_device Sascha Hauer
2020-05-20 9:43 ` [PATCH 09/19] net: mdiobus: Add slice Sascha Hauer
2020-05-20 9:43 ` [PATCH 10/19] usb: Add a slice to usb host controllers Sascha Hauer
2020-05-20 9:43 ` [PATCH 11/19] usbnet: Add slice Sascha Hauer
2020-05-20 9:43 ` [PATCH 12/19] net: Call net_poll() in a poller Sascha Hauer
2020-05-20 9:43 ` [PATCH 13/19] net: reply to ping requests Sascha Hauer
2020-05-20 9:43 ` [PATCH 14/19] usbnet: Be more friendly in the receive path Sascha Hauer
2020-05-20 9:43 ` [PATCH 15/19] poller: Allow to run pollers inside of pollers Sascha Hauer
2020-05-20 9:44 ` [PATCH 16/19] defconfigs: update renamed fastboot options Sascha Hauer
2020-05-20 9:44 ` [PATCH 17/19] fastboot: rename usbgadget.fastboot_* variables to fastboot.* Sascha Hauer
2020-05-20 9:44 ` [PATCH 18/19] fastboot net: implement fastboot over UDP Sascha Hauer
2020-05-20 9:44 ` [PATCH 19/19] fastboot net: remove may_send 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=20200520094403.12651-2-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=dg@emlix.com \
--cc=eh@emlix.com \
/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