summaryrefslogtreecommitdiff
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2024-03-28 10:27:50 +0300
committerDavid S. Miller <davem@davemloft.net>2024-04-03 11:59:38 +0300
commitb1f81b9a535b48b2c9ca460720a2bc73fd2001de (patch)
treef2a4ad10a7054e8ae7ef6ec4c2c3d2a16623b05e /include/linux/netdevice.h
parent464eb03c4a7cfb32cb3324249193cf6bb5b35152 (diff)
downloadlinux-b1f81b9a535b48b2c9ca460720a2bc73fd2001de.tar.xz
netdevice: add DEFINE_FREE() for dev_put
For short netdev holds within a function there are still a lot of users of dev_put() rather than netdev_put(). Add DEFINE_FREE() to allow making those safer. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7d12b5a9380f..0c198620ac93 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -4097,6 +4097,8 @@ static inline void dev_put(struct net_device *dev)
netdev_put(dev, NULL);
}
+DEFINE_FREE(dev_put, struct net_device *, if (_T) dev_put(_T))
+
static inline void netdev_ref_replace(struct net_device *odev,
struct net_device *ndev,
netdevice_tracker *tracker,