imx9/imx9_usbdev.c: Fix interrupt handling in SMP mode
The interrupt handler accesses the device as well as the driver's private data. Use critical_section for mutual exclusion with drivers/usbdev, which also protects the same data with critical_section. Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
parent
70b5aa4df0
commit
382ed6550f
1 changed files with 12 additions and 0 deletions
|
|
@ -1974,6 +1974,10 @@ static int imx9_usbinterrupt(int irq, void *context, void *arg)
|
||||||
|
|
||||||
usbtrace(TRACE_INTENTRY(IMX9_TRACEINTID_USB), 0);
|
usbtrace(TRACE_INTENTRY(IMX9_TRACEINTID_USB), 0);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
irqstate_t flags = enter_critical_section();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Read the interrupts and then clear them */
|
/* Read the interrupts and then clear them */
|
||||||
|
|
||||||
disr = imx9_getreg(priv, IMX9_USBDEV_USBSTS_OFFSET);
|
disr = imx9_getreg(priv, IMX9_USBDEV_USBSTS_OFFSET);
|
||||||
|
|
@ -1985,6 +1989,10 @@ static int imx9_usbinterrupt(int irq, void *context, void *arg)
|
||||||
|
|
||||||
imx9_usbreset(priv);
|
imx9_usbreset(priv);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
leave_critical_section(flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
usbtrace(TRACE_INTEXIT(IMX9_TRACEINTID_USB), 0);
|
usbtrace(TRACE_INTEXIT(IMX9_TRACEINTID_USB), 0);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
@ -2153,6 +2161,10 @@ static int imx9_usbinterrupt(int irq, void *context, void *arg)
|
||||||
imx9_putreg(priv, IMX9_USBDEV_ENDPTNAK_OFFSET, pending);
|
imx9_putreg(priv, IMX9_USBDEV_ENDPTNAK_OFFSET, pending);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
leave_critical_section(flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
usbtrace(TRACE_INTEXIT(IMX9_TRACEINTID_USB), 0);
|
usbtrace(TRACE_INTEXIT(IMX9_TRACEINTID_USB), 0);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue