summaryrefslogtreecommitdiff
path: root/src/portable
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-11-03 22:22:13 +0700
committerhathach <[email protected]>2023-11-03 22:22:13 +0700
commit4b9320e40ea65ca023925d0a644b116b7066e06f (patch)
tree3da627889eb08f63fb1a32d2c5f354fe16e69b8d /src/portable
parentf3eaf0652d70e738207d41d97b0c8c56c80175d1 (diff)
fix race condition when dev0 is removed while enumerating
Diffstat (limited to 'src/portable')
-rw-r--r--src/portable/raspberrypi/pio_usb/hcd_pio_usb.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c b/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
index 93bc1bf43..f4de3c51d 100644
--- a/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
+++ b/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
@@ -182,14 +182,6 @@ void __no_inline_not_in_flash_func(pio_usb_host_irq_handler)(uint8_t root_id) {
root_port_t *rport = PIO_USB_ROOT_PORT(root_id);
uint32_t const ints = rport->ints;
- if ( ints & PIO_USB_INTS_CONNECT_BITS ) {
- hcd_event_device_attach(tu_rhport, true);
- }
-
- if ( ints & PIO_USB_INTS_DISCONNECT_BITS ) {
- hcd_event_device_remove(tu_rhport, true);
- }
-
if ( ints & PIO_USB_INTS_ENDPOINT_COMPLETE_BITS ) {
handle_endpoint_irq(rport, XFER_RESULT_SUCCESS, &rport->ep_complete);
}
@@ -202,6 +194,14 @@ void __no_inline_not_in_flash_func(pio_usb_host_irq_handler)(uint8_t root_id) {
handle_endpoint_irq(rport, XFER_RESULT_FAILED, &rport->ep_error);
}
+ if ( ints & PIO_USB_INTS_CONNECT_BITS ) {
+ hcd_event_device_attach(tu_rhport, true);
+ }
+
+ if ( ints & PIO_USB_INTS_DISCONNECT_BITS ) {
+ hcd_event_device_remove(tu_rhport, true);
+ }
+
// clear all
rport->ints &= ~ints;
}