MCPcopy Create free account
hub / github.com/apache/nuttx / netdev_unregister

Function netdev_unregister

net/netdev/netdev_unregister.c:114–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112 ****************************************************************************/
113
114int netdev_unregister(FAR struct net_driver_s *dev)
115{
116 struct net_driver_s *prev;
117 struct net_driver_s *curr;
118
119 if (dev)
120 {
121 netdev_list_lock();
122
123 /* Find the device in the list of known network devices */
124
125 for (prev = NULL, curr = g_netdevices;
126 curr && curr != dev;
127 prev = curr, curr = curr->flink);
128
129 /* Remove the device to the list of known network devices */
130
131 if (curr)
132 {
133 /* Where was the entry */
134
135 if (prev)
136 {
137 /* The entry was in the middle or at the end of the list */
138
139 prev->flink = curr->flink;
140 }
141 else
142 {
143 /* The entry was at the beginning of the list */
144
145 g_netdevices = curr->flink;
146 }
147
148 curr->flink = NULL;
149 }
150
151#ifdef CONFIG_NETDEV_IFINDEX
152 free_ifindex(dev->d_ifindex);
153#endif
154
155#ifdef CONFIG_NET_MLD
156 if ((dev->d_flags & IFF_MULTICAST) != 0)
157 {
158 /* MLD is only supported on multicast capable devices */
159
160 mld_grpfree_all(dev);
161 }
162#endif
163
164 netdev_list_unlock();
165
166 nxrmutex_destroy(&dev->d_lock);
167
168#if CONFIG_NETDEV_STATISTICS_LOG_PERIOD > 0
169 work_cancel_sync(NETDEV_STATISTICS_WORK, &dev->d_statistics.logwork);
170#endif
171

Callers 8

z80_netuninitializeFunction · 0.85
amebaz_wl_initializeFunction · 0.85
tun_dev_uninitFunction · 0.85
netdev_lower_unregisterFunction · 0.85
lan9250_uninitializeFunction · 0.85
cdcecm_uninitializeFunction · 0.85
usbclass_uninitializeFunction · 0.85
bt_netdev_unregisterFunction · 0.85

Calls 6

netdev_list_lockFunction · 0.85
free_ifindexFunction · 0.85
mld_grpfree_allFunction · 0.85
netdev_list_unlockFunction · 0.85
nxrmutex_destroyFunction · 0.85
work_cancel_syncFunction · 0.85

Tested by

no test coverage detected