summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-03-12 09:04:21 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-05-20 15:43:58 +0200
commit932fff4911529d3663fa01b99cfb5dddb42feb6e (patch)
tree658b59aecea7960217fd063dac58cc450548097a
parentc10b20dc83ac25b1d81c39eaad4529d9911813b1 (diff)
downloadbarebox-932fff4911529d3663fa01b99cfb5dddb42feb6e.tar.gz
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>
-rw-r--r--arch/arm/boards/mioa701/gpio0_poweroff.c2
-rw-r--r--arch/arm/boards/sama5d3xek/init.c2
-rw-r--r--common/poller.c8
-rw-r--r--common/ratp/ratp.c2
-rw-r--r--common/serdev.c2
-rw-r--r--drivers/input/gpio_keys.c2
-rw-r--r--drivers/input/imx_keypad.c2
-rw-r--r--drivers/input/input.c2
-rw-r--r--drivers/input/qt1070.c2
-rw-r--r--drivers/input/twl6030_pwrbtn.c2
-rw-r--r--drivers/input/usb_kbd.c2
-rw-r--r--drivers/led/core.c2
-rw-r--r--drivers/net/usb/ax88179_178a.c2
-rw-r--r--drivers/usb/gadget/udc-core.c2
-rw-r--r--drivers/watchdog/wd_core.c2
-rw-r--r--include/poller.h5
16 files changed, 22 insertions, 19 deletions
diff --git a/arch/arm/boards/mioa701/gpio0_poweroff.c b/arch/arm/boards/mioa701/gpio0_poweroff.c
index 4b34922..8cacceb 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 c768e98..d9be4c5 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 32795b6..b1a2122 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 ca751a3..556dc63 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/common/serdev.c b/common/serdev.c
index c87b8a8..c50b3bd 100644
--- a/common/serdev.c
+++ b/common/serdev.c
@@ -73,7 +73,7 @@ int serdev_device_open(struct serdev_device *serdev)
if (!serdev->fifo)
return -ENOMEM;
- ret = poller_async_register(&serdev->poller);
+ ret = poller_async_register(&serdev->poller, "serdev");
if (ret)
return ret;
diff --git a/drivers/input/gpio_keys.c b/drivers/input/gpio_keys.c
index 38c0f11..11d598c 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 44ff9b7..6757fac 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 1e8f6e1..bcc8667 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 59acee5..9e1dcc5 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 fc4c728..481688b 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/input/usb_kbd.c b/drivers/input/usb_kbd.c
index a2b92c2..032e11a 100644
--- a/drivers/input/usb_kbd.c
+++ b/drivers/input/usb_kbd.c
@@ -204,7 +204,7 @@ static int usb_kbd_probe(struct usb_device *usbdev,
return ret;
}
- ret = poller_async_register(&data->poller);
+ ret = poller_async_register(&data->poller, "usb-kbd");
if (ret) {
dev_err(&usbdev->dev, "can't setup poller\n");
return ret;
diff --git a/drivers/led/core.c b/drivers/led/core.c
index eeeeaa0..ab171c6 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 6fea5a7..fddb187 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 096f05e..126d76e 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 3404040..a17234f 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 b22b8a1..8865572 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,