05.10.2021 11:50, LakshmiPraveen Kopparthi пишет: >> Interrupt is disabled in ISR, this lock does nothing. > > Ok. But there are some registers that are read and updated in the ISR > and in the foreground. > I will add the lock for these register access. Please either add everything into a single patch or remove the unused code. If you will need to add a lock, then like Michał Mirosław suggested in the other reply, you won't need to store/restore IRQ flags in the interrupt context.