提交 15333061 编写于 作者: S Stephen Hemminger 提交者: David S. Miller

[NET]: dev_put/dev_hold cleanup

Get rid of the old __dev_put macro that is just a hold over from pre 2.6
kernel.  And turn dev_hold into an inline instead of a macro.
Signed-off-by: NStephen Hemminger <shemminger@osdl.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2d0817d1
...@@ -920,7 +920,7 @@ e1000_remove(struct pci_dev *pdev) ...@@ -920,7 +920,7 @@ e1000_remove(struct pci_dev *pdev)
unregister_netdev(netdev); unregister_netdev(netdev);
#ifdef CONFIG_E1000_NAPI #ifdef CONFIG_E1000_NAPI
for (i = 0; i < adapter->num_rx_queues; i++) for (i = 0; i < adapter->num_rx_queues; i++)
__dev_put(&adapter->polling_netdev[i]); dev_put(&adapter->polling_netdev[i]);
#endif #endif
if (!e1000_check_phy_reset_block(&adapter->hw)) if (!e1000_check_phy_reset_block(&adapter->hw))
......
...@@ -712,8 +712,10 @@ static inline void dev_put(struct net_device *dev) ...@@ -712,8 +712,10 @@ static inline void dev_put(struct net_device *dev)
atomic_dec(&dev->refcnt); atomic_dec(&dev->refcnt);
} }
#define __dev_put(dev) atomic_dec(&(dev)->refcnt) static inline void dev_hold(struct net_device *dev)
#define dev_hold(dev) atomic_inc(&(dev)->refcnt) {
atomic_inc(&dev->refcnt);
}
/* Carrier loss detection, dial on demand. The functions netif_carrier_on /* Carrier loss detection, dial on demand. The functions netif_carrier_on
* and _off may be called from IRQ context, but it is caller * and _off may be called from IRQ context, but it is caller
......
...@@ -1382,7 +1382,7 @@ static struct in_device * ip_mc_find_dev(struct ip_mreqn *imr) ...@@ -1382,7 +1382,7 @@ static struct in_device * ip_mc_find_dev(struct ip_mreqn *imr)
dev = ip_dev_find(imr->imr_address.s_addr); dev = ip_dev_find(imr->imr_address.s_addr);
if (!dev) if (!dev)
return NULL; return NULL;
__dev_put(dev); dev_put(dev);
} }
if (!dev && !ip_route_output_key(&rt, &fl)) { if (!dev && !ip_route_output_key(&rt, &fl)) {
......
...@@ -415,10 +415,10 @@ static int vif_add(struct vifctl *vifc, int mrtsock) ...@@ -415,10 +415,10 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
return -ENOBUFS; return -ENOBUFS;
break; break;
case 0: case 0:
dev=ip_dev_find(vifc->vifc_lcl_addr.s_addr); dev = ip_dev_find(vifc->vifc_lcl_addr.s_addr);
if (!dev) if (!dev)
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
__dev_put(dev); dev_put(dev);
break; break;
default: default:
return -EINVAL; return -EINVAL;
......
...@@ -234,7 +234,7 @@ static void dev_watchdog_down(struct net_device *dev) ...@@ -234,7 +234,7 @@ static void dev_watchdog_down(struct net_device *dev)
{ {
spin_lock_bh(&dev->xmit_lock); spin_lock_bh(&dev->xmit_lock);
if (del_timer(&dev->watchdog_timer)) if (del_timer(&dev->watchdog_timer))
__dev_put(dev); dev_put(dev);
spin_unlock_bh(&dev->xmit_lock); spin_unlock_bh(&dev->xmit_lock);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册