diff --git a/sched/irq/irq_attach.c b/sched/irq/irq_attach.c index 0ca62f02387..83249c4a2ef 100644 --- a/sched/irq/irq_attach.c +++ b/sched/irq/irq_attach.c @@ -72,7 +72,7 @@ int irq_attach(int irq, xcpt_t isr, FAR void *arg) * to the unexpected interrupt handler. */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(NULL); if (isr == NULL) { /* Disable the interrupt if we can before detaching it. We might @@ -121,7 +121,7 @@ int irq_attach(int irq, xcpt_t isr, FAR void *arg) g_irqvector[ndx].count = 0; #endif - leave_critical_section(flags); + spin_unlock_irqrestore(NULL, flags); ret = OK; } diff --git a/sched/irq/irq_chain.c b/sched/irq/irq_chain.c index ba83b0befa0..f5bd0736c98 100644 --- a/sched/irq/irq_chain.c +++ b/sched/irq/irq_chain.c @@ -218,7 +218,7 @@ int irqchain_detach(int irq, xcpt_t isr, FAR void *arg) ndx = irq; #endif - flags = enter_critical_section(); + flags = spin_lock_irqsave(NULL); if (g_irqvector[ndx].handler == irqchain_dispatch) { @@ -264,7 +264,7 @@ int irqchain_detach(int irq, xcpt_t isr, FAR void *arg) ret = irq_detach(irq); } - leave_critical_section(flags); + spin_unlock_irqrestore(NULL, flags); } return ret;