net/netdev: separate netdev_list_lock from net_lock

use netdev_list_lock to protect all network card traversal, registration,
and deregistration operations.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu
2025-06-16 17:38:55 +08:00
committed by Xiang Xiao
parent 906279e37a
commit 0af74a54bb
12 changed files with 92 additions and 29 deletions
+2 -2
View File
@@ -63,7 +63,7 @@ FAR struct net_driver_s *netdev_default(void)
/* Examine each registered network device */
net_lock();
netdev_list_lock();
for (dev = g_netdevices; dev; dev = dev->flink)
{
/* Is the interface in the "up" state? */
@@ -84,6 +84,6 @@ FAR struct net_driver_s *netdev_default(void)
}
}
net_unlock();
netdev_list_unlock();
return ret;
}