If the synchronization is not there, compiler or CPU
can freely reorder execution in request_irq and free_irq.
This caused broken build optimized by
-Os -ffunction-sections -fdata-sections -Wl,--gc-section
The IRQ source has been enabled before handler has
target been set into irq_handler_table.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
void disable_irq(unsigned int irqnum)
{
NVIC_DisableIRQ(irqnum);
+ __memory_barrier();
}
void enable_irq(unsigned int irqnum)
{
+ __memory_barrier();
NVIC_EnableIRQ(irqnum);
}