mirror of
https://github.com/apache/nuttx.git
synced 2026-08-09 22:45:08 +00:00
The registry is a singly linked list of static structures, so registering one of them a second time does not add a second entry: it points that entry's own link at itself, and the list stops having an end. Nothing notices while every device that turns up matches something near the head, because the search returns before it reaches the loop. The first device that matches nothing at all, meaning anything without a class driver built in, walks the list to look for it and never comes back, holding the registry lock. On a multiprocessor the rest of the system follows it down: every other processor that touches the registry spins, and on the one measured here that included the console, so a board with a USB keyboard and no keyboard driver came up and then answered nothing. Registering twice is easy to do by accident. drivers_initialize() calls usbhost_drivers_initialize(), which registers every class the configuration selected, and board code that also registers one, which many boards do, gets a second call for free. So look before linking, and treat a repeat registration as the no-op the caller expected it to be. Assisted-by: Claude:claude-opus-5 Signed-off-by: Justin Hammond <justin@dynam.ac> |
||
|---|---|---|
| .. | ||
| CMakeLists.txt | ||
| hid_parser.c | ||
| Kconfig | ||
| Make.defs | ||
| usbhost_bthci.c | ||
| usbhost_cdcacm.c | ||
| usbhost_cdcecm.c | ||
| usbhost_cdcmbim.c | ||
| usbhost_composite.c | ||
| usbhost_composite.h | ||
| usbhost_devaddr.c | ||
| usbhost_drivers.c | ||
| usbhost_enumerate.c | ||
| usbhost_findclass.c | ||
| usbhost_ft232r.c | ||
| usbhost_hidkbd.c | ||
| usbhost_hidmouse.c | ||
| usbhost_hub.c | ||
| usbhost_max3421e.c | ||
| usbhost_registerclass.c | ||
| usbhost_registry.c | ||
| usbhost_registry.h | ||
| usbhost_skeleton.c | ||
| usbhost_storage.c | ||
| usbhost_trace.c | ||
| usbhost_waiter.c | ||
| usbhost_xboxcontroller.c | ||
| usbhost_xhci.h | ||
| usbhost_xhci_pci.c | ||
| usbhost_xhci_trace.c | ||
| usbhost_xhci_trace.h | ||