nuttx/net: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section()

This commit is contained in:
Gregory Nutt
2016-02-14 08:38:44 -06:00
parent e6bd3544f6
commit aa3e778dc6
8 changed files with 44 additions and 55 deletions

View File

@@ -48,7 +48,7 @@
#include <netinet/in.h>
#include <nuttx/net/net.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include "arp/arp.h"
@@ -104,10 +104,10 @@ void arp_wait_setup(in_addr_t ipaddr, FAR struct arp_notify_s *notify)
/* Add the wait structure to the list with interrupts disabled */
flags = irqsave();
flags = enter_critical_section();
notify->nt_flink = g_arp_waiters;
g_arp_waiters = notify;
irqrestore(flags);
leave_critical_section(flags);
}
/****************************************************************************
@@ -134,7 +134,7 @@ int arp_wait_cancel(FAR struct arp_notify_s *notify)
* head of the list).
*/
flags = irqsave();
flags = enter_critical_section();
for (prev = NULL, curr = g_arp_waiters;
curr && curr != notify;
prev = curr, curr = curr->nt_flink);
@@ -154,7 +154,7 @@ int arp_wait_cancel(FAR struct arp_notify_s *notify)
ret = OK;
}
irqrestore(flags);
leave_critical_section(flags);
(void)sem_destroy(&notify->nt_sem);
return ret;
}
@@ -184,7 +184,7 @@ int arp_wait(FAR struct arp_notify_s *notify, FAR struct timespec *timeout)
* enabled while we wait.
*/
flags = irqsave();
flags = enter_critical_section();
DEBUGVERIFY(clock_gettime(CLOCK_REALTIME, &abstime));
abstime.tv_sec += timeout->tv_sec;
@@ -220,7 +220,7 @@ int arp_wait(FAR struct arp_notify_s *notify, FAR struct timespec *timeout)
/* Re-enable interrupts and return the result of the wait */
irqrestore(flags);
leave_critical_section(flags);
return ret;
}