mirror of
https://github.com/apache/nuttx.git
synced 2026-05-24 16:11:56 +08:00
mpfs/mpfs_usb.c: Fix interrupt handling in SMP mode
The interrupt handler accesses the device as well as the driver's private data. Thus, must take the big kernel lock in SMP mode to protect them. Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
@@ -3430,6 +3430,10 @@ static int mpfs_usb_interrupt(int irq, void *context, void *arg)
|
||||
uint16_t pending_tx_ep;
|
||||
int i;
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
irqstate_t flags = enter_critical_section();
|
||||
#endif
|
||||
|
||||
/* Get the device interrupts */
|
||||
|
||||
isr = getreg8(MPFS_USB_IRQ);
|
||||
@@ -3455,6 +3459,9 @@ static int mpfs_usb_interrupt(int irq, void *context, void *arg)
|
||||
priv->usbdev.dualspeed = 1;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
leave_critical_section(flags);
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -3539,6 +3546,9 @@ static int mpfs_usb_interrupt(int irq, void *context, void *arg)
|
||||
mpfs_resume(priv);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
leave_critical_section(flags);
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user