backports: add netdev_upper_dev_link() extack argument
authorJohannes Berg <johannes.berg@intel.com>
Fri, 13 Oct 2017 08:48:42 +0000 (10:48 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 13 Oct 2017 13:29:30 +0000 (15:29 +0200)
But make it optional (using magic.h) to let this still work
on kernels that didn't change the argument.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
backport/backport-include/linux/netdevice.h

index 9c912285368e2477aa9c06c559771c2d2f868247..d92c95ad479349921ddab81aa7264722ce15043e 100644 (file)
@@ -3,6 +3,7 @@
 #include_next <linux/netdevice.h>
 #include <linux/netdev_features.h>
 #include <linux/version.h>
+#include <backport/magic.h>
 
 /*
  * This is declared implicitly in newer kernels by netdevice.h using
@@ -333,4 +334,18 @@ static inline void netif_trans_update(struct net_device *dev)
        (_dev)->needs_free_netdev = true;
 #endif
 
+#if LINUX_VERSION_IS_LESS(4,14,0)
+static inline int _bp_netdev_upper_dev_link(struct net_device *dev,
+                                           struct net_device *upper_dev)
+{
+       return netdev_upper_dev_link(dev, upper_dev);
+}
+#define netdev_upper_dev_link3(dev, upper, extack) \
+       netdev_upper_dev_link(dev, upper)
+#define netdev_upper_dev_link2(dev, upper) \
+       netdev_upper_dev_link(dev, upper)
+#define netdev_upper_dev_link(...) \
+       macro_dispatcher(netdev_upper_dev_link, __VA_ARGS__)(__VA_ARGS__)
+#endif
+
 #endif /* __BACKPORT_NETDEVICE_H */