generic: make all phy drivers kernel 5.0 compatible
[openwrt/staging/dedeckeh.git] / target / linux / generic / files / drivers / net / phy / psb6970.c
index c1a381c0528d94b0b2b385c0152734af49f3c98c..97fb62ace2ab575a0fa9767a33e60404117c52aa 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/netdevice.h>
 #include <linux/switch.h>
 #include <linux/phy.h>
+#include <linux/version.h>
 
 #define PSB6970_MAX_VLANS              16
 #define PSB6970_NUM_PORTS              7
@@ -325,7 +326,13 @@ static int psb6970_config_init(struct phy_device *pdev)
                return 0;
        }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
+       linkmode_zero(pdev->supported);
+       linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, pdev->supported);
+       linkmode_copy(pdev->advertising, pdev->supported);
+#else
        pdev->supported = pdev->advertising = SUPPORTED_100baseT_Full;
+#endif
 
        mutex_init(&priv->reg_mutex);
        priv->read = psb6970_mii_read;