From 32a8d09901afdc3e26a6efb45ef1f9aeea4363aa Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Fri, 23 Jun 2017 14:19:58 +0900 Subject: [PATCH] drivers/net/tun.c: Use critical section instead of semaphore in tun_ifdown() --- drivers/net/tun.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 4451d52b0a0..c9425d8c404 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -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; }