drivers/net/tun.c: Use critical section instead of semaphore in tun_ifdown()

This commit is contained in:
Masayuki Ishikawa 2017-06-23 14:19:58 +09:00
parent 096f72a365
commit 32a8d09901

View File

@ -667,8 +667,9 @@ static int tun_ifup(struct net_driver_s *dev)
static int tun_ifdown(struct net_driver_s *dev)
{
FAR struct tun_device_s *priv = (FAR struct tun_device_s *)dev->d_private;
irqstate_t flags;
tun_lock(priv);
flags = enter_critical_section();
/* Cancel the TX poll timer */
@ -677,7 +678,8 @@ static int tun_ifdown(struct net_driver_s *dev)
/* Mark the device "down" */
priv->bifup = false;
tun_unlock(priv);
leave_critical_section(flags);
return OK;
}