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

Function netdev_lower_unregister

drivers/net/netdev_upperhalf.c:1468–1519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1466 ****************************************************************************/
1467
1468int netdev_lower_unregister(FAR struct netdev_lowerhalf_s *dev)
1469{
1470 FAR struct netdev_upperhalf_s *upper;
1471 int cpu = 1;
1472 int ret;
1473
1474 if (dev == NULL || dev->netdev.d_private == NULL)
1475 {
1476 nerr("ERROR: Invalid lower half device\n");
1477 return -EINVAL;
1478 }
1479
1480 upper = (FAR struct netdev_upperhalf_s *)dev->netdev.d_private;
1481
1482#ifdef CONFIG_NET_VLAN
1483 netdev_upper_vlan_foreach(upper, vlan_unregister);
1484#endif
1485
1486 ret = netdev_unregister(&dev->netdev);
1487 if (ret < 0)
1488 {
1489 return ret;
1490 }
1491
1492 switch (dev->rxtype)
1493 {
1494 case NETDEV_RX_THREAD_RSS:
1495 cpu = CONFIG_SMP_NCPUS;
1496 case NETDEV_RX_THREAD:
1497
1498 /* Stop the dedicated thread for network operations in thread mode */
1499
1500 netdev_upper_exit_thread(upper);
1501 while (--cpu >= 0)
1502 {
1503 FAR struct netdev_thread_s *t = &upper->thread[cpu];
1504
1505 nxsem_destroy(&t->sem);
1506 nxsem_destroy(&t->sem_exit);
1507 }
1508 break;
1509 }
1510
1511#if CONFIG_IOB_NCHAINS > 0
1512 iob_free_queue(&upper->txq);
1513#endif
1514
1515 kmm_free(upper);
1516 dev->netdev.d_private = NULL;
1517
1518 return OK;
1519}
1520
1521/****************************************************************************
1522 * Name: netdev_lower_carrier_on

Callers 6

kvaser_probeFunction · 0.85
ctucanfd_probeFunction · 0.85
vlan_unregisterFunction · 0.85
net_rpmsg_drv_initFunction · 0.85
cdcncm_uninitializeFunction · 0.85
cdcmbim_uninitializeFunction · 0.85

Calls 6

netdev_unregisterFunction · 0.85
netdev_upper_exit_threadFunction · 0.85
nxsem_destroyFunction · 0.85
iob_free_queueFunction · 0.85
kmm_freeFunction · 0.85

Tested by

no test coverage detected