This is an automated email from the ASF dual-hosted git repository. jiuzhudong pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit fa6c8579dd11968b46ba602bc46598a78e98a328 Author: zhanghongyu <[email protected]> AuthorDate: Sun Jan 4 16:50:01 2026 +0800 driver/net: replace net_lock with netdev_lock modify the code of the adapted protocol stack to avoid deadlocks and the logic that cannot be protected by locks after modification. Signed-off-by: zhanghongyu <[email protected]> --- arch/sim/src/sim/sim_cansock.c | 8 ++++---- drivers/net/enc28j60.c | 8 ++++---- drivers/net/encx24j600.c | 8 ++++---- drivers/net/ftmac100.c | 12 ++++++------ drivers/net/lan91c111.c | 24 +++++++++++------------ drivers/net/lan9250.c | 12 ++++++------ drivers/net/loopback.c | 4 ++-- drivers/net/skeleton.c | 12 ++++++------ drivers/net/slip.c | 8 ++++---- drivers/net/tun.c | 16 +++++++-------- drivers/net/w5500.c | 14 ++++++------- drivers/usbdev/cdcecm.c | 8 ++++---- drivers/usbdev/rndis.c | 8 ++++---- drivers/usbhost/usbhost_cdcmbim.c | 8 ++++---- drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c | 8 ++++---- drivers/wireless/ieee802154/xbee/xbee_netdev.c | 10 +++++----- drivers/wireless/spirit/drivers/spirit_netdev.c | 12 ++++++------ 17 files changed, 90 insertions(+), 90 deletions(-) diff --git a/arch/sim/src/sim/sim_cansock.c b/arch/sim/src/sim/sim_cansock.c index b9c8d0f7139..d602c97f31c 100644 --- a/arch/sim/src/sim/sim_cansock.c +++ b/arch/sim/src/sim/sim_cansock.c @@ -134,13 +134,13 @@ static int sim_can_txavail(struct net_driver_s *dev) /* Ignore the notification if the interface is not yet up */ - net_lock(); + netdev_lock(dev); if (IFF_IS_UP(priv->dev.d_flags)) { devif_poll(&priv->dev, sim_can_txpoll); } - net_unlock(); + netdev_unlock(dev); return OK; } @@ -189,7 +189,7 @@ static void sim_can_work(void *arg) * in priv->dev.d_len */ - net_lock(); + netdev_lock(&priv->dev); priv->dev.d_len = ret; priv->dev.d_buf = (FAR uint8_t *)&hframe; @@ -198,7 +198,7 @@ static void sim_can_work(void *arg) NETDEV_RXPACKETS(&priv->dev); can_input(&priv->dev); - net_unlock(); + netdev_unlock(&priv->dev); } nodata: diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index becda0e1cef..ca5cafd93ec 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c @@ -1545,7 +1545,7 @@ static void enc_irqworker(FAR void *arg) /* Get exclusive access to both the network and the SPI bus. */ - net_lock(); + netdev_lock(&priv->dev); enc_lock(priv); /* Disable further interrupts by clearing the global interrupt enable bit. @@ -1739,7 +1739,7 @@ static void enc_irqworker(FAR void *arg) /* Release lock on the SPI bus and the network */ enc_unlock(priv); - net_unlock(); + netdev_unlock(&priv->dev); } /**************************************************************************** @@ -1812,7 +1812,7 @@ static void enc_toworker(FAR void *arg) /* Get exclusive access to the network */ - net_lock(); + netdev_lock(&priv->dev); /* Increment statistics and dump debug info */ @@ -1834,7 +1834,7 @@ static void enc_toworker(FAR void *arg) /* Release lock on the network */ - net_unlock(); + netdev_unlock(&priv->dev); } /**************************************************************************** diff --git a/drivers/net/encx24j600.c b/drivers/net/encx24j600.c index 6904ae6d798..e2f9852aeda 100644 --- a/drivers/net/encx24j600.c +++ b/drivers/net/encx24j600.c @@ -1735,7 +1735,7 @@ static void enc_irqworker(FAR void *arg) /* Get exclusive access to both the network and the SPI bus. */ - net_lock(); + netdev_lock(&priv->dev); enc_lock(priv); /* A good practice is for the host controller to clear the Global Interrupt @@ -1884,7 +1884,7 @@ static void enc_irqworker(FAR void *arg) /* Release lock on the SPI bus and the network */ enc_unlock(priv); - net_unlock(); + netdev_unlock(&priv->dev); } /**************************************************************************** @@ -1957,7 +1957,7 @@ static void enc_toworker(FAR void *arg) /* Get exclusive access to the network. */ - net_lock(); + netdev_lock(&priv->dev); /* Increment statistics and dump debug info */ @@ -1979,7 +1979,7 @@ static void enc_toworker(FAR void *arg) /* Release the network */ - net_unlock(); + netdev_unlock(&priv->dev); } /**************************************************************************** diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c index 0c0579146d7..2f8c14f2d8f 100644 --- a/drivers/net/ftmac100.c +++ b/drivers/net/ftmac100.c @@ -809,7 +809,7 @@ static void ftmac100_interrupt_work(FAR void *arg) /* Process pending Ethernet interrupts */ - net_lock(); + netdev_lock(&priv->ft_dev); status = priv->status; ninfo("status=%08x(%08x) BASE=%p ISR=%p PHYCR=%p\n", @@ -883,7 +883,7 @@ out: putreg32 (INT_MASK_ALL_ENABLED, &iobase->imr); ninfo("ISR-done\n"); - net_unlock(); + netdev_unlock(&priv->ft_dev); /* Re-enable Ethernet interrupts */ @@ -972,12 +972,12 @@ static void ftmac100_txtimeout_work(FAR void *arg) /* Process pending Ethernet interrupts */ - net_lock(); + netdev_lock(&priv->ft_dev); /* Then poll the network for new XMIT data */ devif_poll(&priv->ft_dev, ftmac100_txpoll); - net_unlock(); + netdev_unlock(&priv->ft_dev); } /**************************************************************************** @@ -1137,7 +1137,7 @@ static void ftmac100_txavail_work(FAR void *arg) /* Perform the poll */ - net_lock(); + netdev_lock(&priv->ft_dev); /* Ignore the notification if the interface is not yet up */ @@ -1152,7 +1152,7 @@ static void ftmac100_txavail_work(FAR void *arg) devif_poll(&priv->ft_dev, ftmac100_txpoll); } - net_unlock(); + netdev_unlock(&priv->ft_dev); } /**************************************************************************** diff --git a/drivers/net/lan91c111.c b/drivers/net/lan91c111.c index 87aa051b7fe..cbf20bedb32 100644 --- a/drivers/net/lan91c111.c +++ b/drivers/net/lan91c111.c @@ -812,7 +812,7 @@ static void lan91c111_interrupt_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(dev); /* Process pending Ethernet interrupts */ @@ -873,7 +873,7 @@ static void lan91c111_interrupt_work(FAR void *arg) } } - net_unlock(); + netdev_unlock(dev); /* Re-enable Ethernet interrupts */ @@ -949,7 +949,7 @@ static int lan91c111_ifup(FAR struct net_driver_s *dev) dev->d_ipv6addr[6], dev->d_ipv6addr[7]); #endif - net_lock(); + netdev_lock(dev); /* Initialize PHYs, Ethernet interface, and setup up Ethernet interrupts */ @@ -974,7 +974,7 @@ static int lan91c111_ifup(FAR struct net_driver_s *dev) copyto16(priv, ADDR0_REG, &dev->d_mac.ether, sizeof(dev->d_mac.ether)); - net_unlock(); + netdev_unlock(dev); /* Enable the Ethernet interrupt */ @@ -1056,7 +1056,7 @@ static void lan91c111_txavail_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(dev); /* Ignore the notification if the interface is not yet up */ @@ -1074,7 +1074,7 @@ static void lan91c111_txavail_work(FAR void *arg) } } - net_unlock(); + netdev_unlock(dev); } /**************************************************************************** @@ -1187,9 +1187,9 @@ static int lan91c111_addmac(FAR struct net_driver_s *dev, /* Add the MAC address to the hardware multicast routing table */ - net_lock(); + netdev_lock(dev); modifyreg16(priv, MCAST_REG1 + off, 0, 1 << bit); - net_unlock(); + netdev_unlock(dev); return OK; } @@ -1234,9 +1234,9 @@ static int lan91c111_rmmac(FAR struct net_driver_s *dev, /* Remove the MAC address from the hardware multicast routing table */ - net_lock(); + netdev_lock(dev); modifyreg16(priv, MCAST_REG1 + off, 1 << bit, 0); - net_unlock(); + netdev_unlock(dev); return OK; } @@ -1269,7 +1269,7 @@ static int lan91c111_ioctl(FAR struct net_driver_s *dev, int cmd, FAR struct mii_ioctl_data_s *req = (FAR void *)arg; int ret = OK; - net_lock(); + netdev_lock(dev); /* Decode and dispatch the driver-specific IOCTL command */ @@ -1292,7 +1292,7 @@ static int lan91c111_ioctl(FAR struct net_driver_s *dev, int cmd, ret = -ENOTTY; /* Special return value for this case */ } - net_unlock(); + netdev_unlock(dev); return ret; } #endif diff --git a/drivers/net/lan9250.c b/drivers/net/lan9250.c index c3f55078f42..723725ebddc 100644 --- a/drivers/net/lan9250.c +++ b/drivers/net/lan9250.c @@ -1525,7 +1525,7 @@ static void lan9250_txavail_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(dev); lan9250_lock_spi(priv); /* Ignore the notification if the interface is not yet up */ @@ -1544,7 +1544,7 @@ static void lan9250_txavail_work(FAR void *arg) /* Release lock on the SPI bus and the network */ lan9250_unlock_spi(priv); - net_unlock(); + netdev_unlock(dev); } /**************************************************************************** @@ -1798,7 +1798,7 @@ static void lan9250_int_worker(FAR void *arg) /* Get exclusive access to both the network and the SPI bus. */ - net_lock(); + netdev_lock(&priv->dev); lan9250_lock_spi(priv); /* There is no infinite loop check... if there are always pending @@ -1985,7 +1985,7 @@ static void lan9250_int_worker(FAR void *arg) /* Release lock on the SPI bus and the network */ lan9250_unlock_spi(priv); - net_unlock(); + netdev_unlock(&priv->dev); /* Enable ISR_GPIO interrupts after unlocking net so that application * could have chance to process Ethernet packet and free iob. @@ -2061,7 +2061,7 @@ static void lan9250_txtout_worker(FAR void *arg) /* Get exclusive access to the network */ - net_lock(); + netdev_lock(&priv->dev); /* Increment statistics and dump debug info */ @@ -2083,7 +2083,7 @@ static void lan9250_txtout_worker(FAR void *arg) /* Release lock on the network */ - net_unlock(); + netdev_unlock(&priv->dev); } /**************************************************************************** diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 1bff3fff64e..a234edcdb0f 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -194,7 +194,7 @@ static void lo_txavail_work(FAR void *arg) /* Ignore the notification if the interface is not yet up */ - net_lock(); + netdev_lock(&priv->lo_dev); if (priv->lo_bifup) { /* Reuse the devif_loopback() logic, Polling all pending events until @@ -204,7 +204,7 @@ static void lo_txavail_work(FAR void *arg) while (devif_poll(&priv->lo_dev, NULL)); } - net_unlock(); + netdev_unlock(&priv->lo_dev); } /**************************************************************************** diff --git a/drivers/net/skeleton.c b/drivers/net/skeleton.c index 07fde235cde..2f83a0e12ad 100644 --- a/drivers/net/skeleton.c +++ b/drivers/net/skeleton.c @@ -466,7 +466,7 @@ static void skel_interrupt_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(&priv->sk_dev); /* Process pending Ethernet interrupts */ @@ -484,7 +484,7 @@ static void skel_interrupt_work(FAR void *arg) */ skel_txdone(priv); - net_unlock(); + netdev_unlock(&priv->sk_dev); /* Re-enable Ethernet interrupts */ @@ -564,7 +564,7 @@ static void skel_txtimeout_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(&priv->sk_dev); /* Increment statistics and dump debug info */ @@ -575,7 +575,7 @@ static void skel_txtimeout_work(FAR void *arg) /* Then poll the network for new XMIT data */ devif_poll(&priv->sk_dev, skel_txpoll); - net_unlock(); + netdev_unlock(&priv->sk_dev); } /**************************************************************************** @@ -731,7 +731,7 @@ static void skel_txavail_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(&priv->sk_dev); /* Ignore the notification if the interface is not yet up */ @@ -744,7 +744,7 @@ static void skel_txavail_work(FAR void *arg) devif_poll(&priv->sk_dev, skel_txpoll); } - net_unlock(); + netdev_unlock(&priv->sk_dev); } /**************************************************************************** diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 7ca1dd118bc..7227a150760 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -750,7 +750,7 @@ static void slip_interrupt_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(&self->dev); /* Process pending Ethernet interrupts */ @@ -798,7 +798,7 @@ static void slip_interrupt_work(FAR void *arg) slip_txdone(self); } - net_unlock(); + netdev_unlock(&self->dev); } /**************************************************************************** @@ -899,7 +899,7 @@ static void slip_txavail_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(&self->dev); /* Ignore the notification if the interface is not yet up */ @@ -917,7 +917,7 @@ static void slip_txavail_work(FAR void *arg) } } - net_unlock(); + netdev_unlock(&self->dev); } /**************************************************************************** diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 14ab6dea5cf..5bc06f113bc 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -748,7 +748,7 @@ static void tun_txavail_work(FAR void *arg) return; } - net_lock(); + netdev_lock(&priv->dev); if (priv->bifup) { /* Poll the network for new XMIT data */ @@ -756,7 +756,7 @@ static void tun_txavail_work(FAR void *arg) devif_poll(&priv->dev, tun_txpoll); } - net_unlock(); + netdev_unlock(&priv->dev); nxmutex_unlock(&priv->lock); } @@ -1007,13 +1007,13 @@ static ssize_t tun_write(FAR struct file *filep, FAR const char *buffer, if (priv->write_d_len == 0) { - net_lock(); + netdev_lock(&priv->dev); netdev_iob_release(&priv->dev); ret = netdev_iob_prepare(&priv->dev, false, 0); priv->dev.d_buf = NULL; if (ret < 0) { - net_unlock(); + netdev_unlock(&priv->dev); break; } @@ -1021,14 +1021,14 @@ static ssize_t tun_write(FAR struct file *filep, FAR const char *buffer, buflen, -llhdrlen, false); if (ret < 0) { - net_unlock(); + netdev_unlock(&priv->dev); break; } priv->dev.d_len = buflen; tun_net_receive(priv); - net_unlock(); + netdev_unlock(&priv->dev); ret = buflen; break; @@ -1128,9 +1128,9 @@ static ssize_t tun_read(FAR struct file *filep, FAR char *buffer, priv->read_buf = NULL; priv->read_d_len = 0; - net_lock(); + netdev_lock(&priv->dev); tun_txdone(priv); - net_unlock(); + netdev_unlock(&priv->dev); break; } diff --git a/drivers/net/w5500.c b/drivers/net/w5500.c index a968a691a96..154a36c6ef8 100644 --- a/drivers/net/w5500.c +++ b/drivers/net/w5500.c @@ -1513,7 +1513,7 @@ static void w5500_interrupt_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(&self->w_dev); /* Process pending Ethernet interrupts. Read IR, MIR and SIR in one shot * to optimize latency, although MIR is not actually used. @@ -1592,7 +1592,7 @@ static void w5500_interrupt_work(FAR void *arg) } done: - net_unlock(); + netdev_unlock(&self->w_dev); /* Re-enable Ethernet interrupts */ @@ -1602,7 +1602,7 @@ done: error: w5500_fence(self); - net_unlock(); + netdev_unlock(&self->w_dev); } /**************************************************************************** @@ -1667,7 +1667,7 @@ static void w5500_txtimeout_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(&self->w_dev); /* Increment statistics and dump debug info */ @@ -1684,7 +1684,7 @@ static void w5500_txtimeout_work(FAR void *arg) devif_poll(&self->w_dev, w5500_txpoll); } - net_unlock(); + netdev_unlock(&self->w_dev); } /**************************************************************************** @@ -1848,7 +1848,7 @@ static void w5500_txavail_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(&priv->w_dev); /* Ignore the notification if the interface is not yet up */ @@ -1861,7 +1861,7 @@ static void w5500_txavail_work(FAR void *arg) devif_poll(&priv->w_dev, w5500_txpoll); } - net_unlock(); + netdev_unlock(&priv->w_dev); } /**************************************************************************** diff --git a/drivers/usbdev/cdcecm.c b/drivers/usbdev/cdcecm.c index 06a89ade2ef..3abdd5a37c4 100644 --- a/drivers/usbdev/cdcecm.c +++ b/drivers/usbdev/cdcecm.c @@ -530,7 +530,7 @@ static void cdcecm_interrupt_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(&self->dev); /* Check if we received an incoming packet, if so, call cdcecm_receive() */ @@ -558,7 +558,7 @@ static void cdcecm_interrupt_work(FAR void *arg) cdcecm_txdone(self); } - net_unlock(); + netdev_unlock(&self->dev); } /**************************************************************************** @@ -666,7 +666,7 @@ static void cdcecm_txavail_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(&self->dev); /* Ignore the notification if the interface is not yet up */ @@ -675,7 +675,7 @@ static void cdcecm_txavail_work(FAR void *arg) devif_poll(&self->dev, cdcecm_txpoll); } - net_unlock(); + netdev_unlock(&self->dev); } /**************************************************************************** diff --git a/drivers/usbdev/rndis.c b/drivers/usbdev/rndis.c index 2ca239f27d5..ab39b2ccff9 100644 --- a/drivers/usbdev/rndis.c +++ b/drivers/usbdev/rndis.c @@ -1022,7 +1022,7 @@ static void rndis_rxdispatch(FAR void *arg) FAR struct eth_hdr_s *hdr; irqstate_t flags; - net_lock(); + netdev_lock(&priv->netdev); flags = enter_critical_section(); rndis_giverxreq(priv); priv->netdev.d_len = priv->current_rx_datagram_size; @@ -1099,7 +1099,7 @@ static void rndis_rxdispatch(FAR void *arg) rndis_freenetreq(priv); } - net_unlock(); + netdev_unlock(&priv->netdev); } /**************************************************************************** @@ -1192,7 +1192,7 @@ static void rndis_txavail_work(FAR void *arg) { FAR struct rndis_dev_s *priv = (FAR struct rndis_dev_s *)arg; - net_lock(); + netdev_lock(&priv->netdev); if (rndis_allocnetreq(priv)) { @@ -1203,7 +1203,7 @@ static void rndis_txavail_work(FAR void *arg) } } - net_unlock(); + netdev_unlock(&priv->netdev); } /**************************************************************************** diff --git a/drivers/usbhost/usbhost_cdcmbim.c b/drivers/usbhost/usbhost_cdcmbim.c index e70551257e9..e989c10096a 100644 --- a/drivers/usbhost/usbhost_cdcmbim.c +++ b/drivers/usbhost/usbhost_cdcmbim.c @@ -2209,7 +2209,7 @@ static void cdcmbim_receive(FAR struct usbhost_cdcmbim_s *priv, { uinfo("received packet: %d len\n", len); - net_lock(); + netdev_lock(&priv->netdev); NETDEV_RXPACKETS(&priv->netdev); @@ -2249,7 +2249,7 @@ static void cdcmbim_receive(FAR struct usbhost_cdcmbim_s *priv, NETDEV_RXERRORS(dev); } - net_unlock(); + netdev_unlock(&priv->netdev); } /**************************************************************************** @@ -2405,7 +2405,7 @@ static void cdcmbim_txavail_work(FAR void *arg) { FAR struct usbhost_cdcmbim_s *priv = (FAR struct usbhost_cdcmbim_s *)arg; - net_lock(); + netdev_lock(&priv->netdev); priv->netdev.d_buf = (FAR uint8_t *)priv->txpktbuf; @@ -2414,7 +2414,7 @@ static void cdcmbim_txavail_work(FAR void *arg) devif_poll(&priv->netdev, cdcmbim_txpoll); } - net_unlock(); + netdev_unlock(&priv->netdev); } /**************************************************************************** diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c index 01f192e6c7c..f008cf2dea0 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c @@ -437,7 +437,7 @@ static void bcmf_tx_poll_work(FAR void *arg) { FAR struct bcmf_dev_s *priv = (FAR struct bcmf_dev_s *)arg; - net_lock(); + netdev_lock(&priv->bc_dev); /* Ignore the notification if the interface is not yet up */ @@ -462,7 +462,7 @@ static void bcmf_tx_poll_work(FAR void *arg) } } - net_unlock(); + netdev_unlock(&priv->bc_dev); } /**************************************************************************** @@ -492,7 +492,7 @@ static void bcmf_rxpoll_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(&priv->bc_dev); /* Tx work will hold the d_buf until there is data to send, * replace and cache the d_buf temporarily @@ -512,7 +512,7 @@ static void bcmf_rxpoll_work(FAR void *arg) #if 0 bcmf_txdone(priv); #endif - net_unlock(); + netdev_unlock(&priv->bc_dev); } /**************************************************************************** diff --git a/drivers/wireless/ieee802154/xbee/xbee_netdev.c b/drivers/wireless/ieee802154/xbee/xbee_netdev.c index 46ee9b69d99..6c7b4bec6a8 100644 --- a/drivers/wireless/ieee802154/xbee/xbee_netdev.c +++ b/drivers/wireless/ieee802154/xbee/xbee_netdev.c @@ -464,7 +464,7 @@ static int xbeenet_rxframe(FAR struct xbeenet_driver_s *priv, ind->frame = NULL; - net_lock(); + netdev_lock(&priv->xd_dev.r_dev); /* Transfer the frame to the network logic */ @@ -506,7 +506,7 @@ static int xbeenet_rxframe(FAR struct xbeenet_driver_s *priv, if (ret < 0) #endif { - net_unlock(); + netdev_unlock(&priv->xd_dev.r_dev); ind->frame = iob; return ret; } @@ -516,7 +516,7 @@ static int xbeenet_rxframe(FAR struct xbeenet_driver_s *priv, NETDEV_RXPACKETS(&priv->xd_dev.r_dev); NETDEV_RXIPV6(&priv->xd_dev.r_dev); - net_unlock(); + netdev_unlock(&priv->xd_dev.r_dev); /* sixlowpan_input() will free the IOB, but we must free the struct * ieee802154_primitive_s container here. @@ -752,7 +752,7 @@ static void xbeenet_txavail_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(&priv->xd_dev.r_dev); /* Ignore the notification if the interface is not yet up */ @@ -769,7 +769,7 @@ static void xbeenet_txavail_work(FAR void *arg) devif_poll(&priv->xd_dev.r_dev, xbeenet_txpoll_callback); } - net_unlock(); + netdev_unlock(&priv->xd_dev.r_dev); } /**************************************************************************** diff --git a/drivers/wireless/spirit/drivers/spirit_netdev.c b/drivers/wireless/spirit/drivers/spirit_netdev.c index 975024a6345..784dd089fe0 100644 --- a/drivers/wireless/spirit/drivers/spirit_netdev.c +++ b/drivers/wireless/spirit/drivers/spirit_netdev.c @@ -955,7 +955,7 @@ static void spirit_receive_work(FAR void *arg) wlinfo("Send frame %p to the network: Offset=%u Length=%u\n", iob, iob->io_offset, iob->io_len); - net_lock(); + netdev_lock(&priv->radio.r_dev); ret = sixlowpan_input(&priv->radio, iob, (FAR void *)pktmeta); if (ret < 0) { @@ -964,7 +964,7 @@ static void spirit_receive_work(FAR void *arg) NETDEV_ERRORS(&priv->radio.r_dev); } - net_unlock(); + netdev_unlock(&priv->radio.r_dev); /* sixlowpan_input() will free the IOB, but we must free the struct * pktradio_metadata_s container here. @@ -1567,7 +1567,7 @@ static void spirit_txtimeout_work(FAR void *arg) * worker thread has been configured. */ - net_lock(); + netdev_lock(&priv->radio.r_dev); /* Increment statistics and dump debug info */ @@ -1583,7 +1583,7 @@ static void spirit_txtimeout_work(FAR void *arg) */ work_queue(LPWORK, &priv->pollwork, spirit_txpoll_work, priv, 0); - net_unlock(); + netdev_unlock(&priv->radio.r_dev); } } @@ -1653,7 +1653,7 @@ static void spirit_txpoll_work(FAR void *arg) * thread has been configured. */ - net_lock(); + netdev_lock(&priv->radio.r_dev); #ifdef CONFIG_NET_6LOWPAN /* Make sure the our single packet buffer is attached */ @@ -1670,7 +1670,7 @@ static void spirit_txpoll_work(FAR void *arg) devif_poll(&priv->radio.r_dev, spirit_txpoll_callback); } - net_unlock(); + netdev_unlock(&priv->radio.r_dev); } /****************************************************************************
