generic: make all phy drivers kernel 5.0 compatible
[openwrt/staging/dedeckeh.git] / target / linux / generic / files / drivers / net / phy / adm6996.c
index 42928bab075dd04607e8699135d7a04126d486fd..cce95f563b47a5f355524c34250e14ee0075e8fd 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/ethtool.h>
 #include <linux/phy.h>
 #include <linux/switch.h>
+#include <linux/version.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -1047,8 +1048,14 @@ static int adm6996_config_init(struct phy_device *pdev)
        struct adm6996_priv *priv;
        int ret;
 
+#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 = ADVERTISED_100baseT_Full;
        pdev->advertising = ADVERTISED_100baseT_Full;
+#endif
 
        if (pdev->mdio.addr != 0) {
                pr_info ("%s: PHY overlaps ADM6996, providing fixed PHY 0x%x.\n"