summaryrefslogtreecommitdiff
path: root/src/portable
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2023-11-03 23:25:03 +0700
committerGitHub <[email protected]>2023-11-03 23:25:03 +0700
commitf84eafcaa2138a360e0baf8271b28f45cf120961 (patch)
tree2b41630fbbd8b9c7c17f812024d2cf5f2f2c7444 /src/portable
parentf3eaf0652d70e738207d41d97b0c8c56c80175d1 (diff)
parent9377fd6901dd9c7b5361a9ce5c01a99cc6761750 (diff)
Merge pull request #2310 from hathach/fix-usbh-enumeration-removal-race
Fix usbh enumeration removal race
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;
}