batman-adv: update to version 2021.4
[feed/routing.git] / batman-adv / src / compat-hacks.h
index f949f4e198e711385637228780db26329ab1b86d..ddd86710c38b0d3a6b85783739fb327e474548ab 100644 (file)
@@ -92,6 +92,35 @@ br_multicast_has_router_adjacent(struct net_device *dev, int proto)
 
 #endif /* LINUX_VERSION_IS_LESS(5, 14, 0) */
 
+#if LINUX_VERSION_IS_LESS(5, 15, 0)
+
+static inline void batadv_dev_put(struct net_device *dev)
+{
+       if (!dev)
+               return;
+
+       dev_put(dev);
+}
+#define dev_put batadv_dev_put
+
+static inline void batadv_dev_hold(struct net_device *dev)
+{
+       if (!dev)
+               return;
+
+       dev_hold(dev);
+}
+#define dev_hold batadv_dev_hold
+
+static inline void batadv_eth_hw_addr_set(struct net_device *dev,
+                                         const u8 *addr)
+{
+       ether_addr_copy(dev->dev_addr, addr);
+}
+#define eth_hw_addr_set batadv_eth_hw_addr_set
+
+#endif /* LINUX_VERSION_IS_LESS(5, 15, 0) */
+
 /* <DECLARE_EWMA> */
 
 #include <linux/version.h>