From 2aa558c49a12c0820fd7b6cc55bf90b320ef3551 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Thu, 1 Oct 2020 17:02:47 +0200 Subject: target: remove obsolete kernel version switches for 4.19 This removes unneeded kernel version switches from the targets after kernel 4.19 has been dropped. Signed-off-by: Adrian Schmutzler --- .../linux/generic/files/drivers/net/phy/adm6996.c | 5 -- .../linux/generic/files/drivers/net/phy/ar8216.c | 20 +------ .../generic/files/drivers/net/phy/b53/b53_mdio.c | 9 ---- .../linux/generic/files/drivers/net/phy/mvswitch.c | 5 -- .../linux/generic/files/drivers/net/phy/psb6970.c | 4 -- .../linux/generic/files/drivers/net/phy/swconfig.c | 61 ---------------------- .../generic/files/drivers/net/phy/swconfig_leds.c | 12 ----- .../drivers/platform/mikrotik/rb_softconfig.c | 2 +- 8 files changed, 2 insertions(+), 116 deletions(-) (limited to 'target/linux/generic') diff --git a/target/linux/generic/files/drivers/net/phy/adm6996.c b/target/linux/generic/files/drivers/net/phy/adm6996.c index cce95f563b..66013f273d 100644 --- a/target/linux/generic/files/drivers/net/phy/adm6996.c +++ b/target/linux/generic/files/drivers/net/phy/adm6996.c @@ -1048,14 +1048,9 @@ 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" diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c index 18a455b21a..0b0348bfdf 100644 --- a/target/linux/generic/files/drivers/net/phy/ar8216.c +++ b/target/linux/generic/files/drivers/net/phy/ar8216.c @@ -2496,10 +2496,7 @@ ar8xxx_phy_read_status(struct phy_device *phydev) struct switch_port_link link; /* check for switch port link changes */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0) - if (phydev->state == PHY_CHANGELINK) -#endif - ar8xxx_check_link_states(priv); + ar8xxx_check_link_states(priv); if (phydev->mdio.addr != 0) return genphy_read_status(phydev); @@ -2639,22 +2636,12 @@ found: priv->use_count++; if (phydev->mdio.addr == 0) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) linkmode_zero(phydev->supported); if (ar8xxx_has_gige(priv)) linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, phydev->supported); else linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, phydev->supported); linkmode_copy(phydev->advertising, phydev->supported); -#else - if (ar8xxx_has_gige(priv)) { - phydev->supported = SUPPORTED_1000baseT_Full; - phydev->advertising = ADVERTISED_1000baseT_Full; - } else { - phydev->supported = SUPPORTED_100baseT_Full; - phydev->advertising = ADVERTISED_100baseT_Full; - } -#endif if (priv->chip->config_at_probe) { priv->phy = phydev; @@ -2665,14 +2652,9 @@ found: } } else { if (ar8xxx_has_gige(priv)) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) linkmode_zero(phydev->supported); linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, phydev->supported); linkmode_copy(phydev->advertising, phydev->supported); -#else - phydev->supported |= SUPPORTED_1000baseT_Full; - phydev->advertising |= ADVERTISED_1000baseT_Full; -#endif } if (priv->chip->phy_rgmii_set) priv->chip->phy_rgmii_set(priv, phydev); diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c index 5675232bef..afe2187cd6 100644 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c @@ -294,7 +294,6 @@ static int b53_phy_probe(struct phy_device *phydev) if (ret) return ret; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) linkmode_zero(phydev->supported); if (is5325(dev) || is5365(dev)) linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, phydev->supported); @@ -302,14 +301,6 @@ static int b53_phy_probe(struct phy_device *phydev) linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, phydev->supported); linkmode_copy(phydev->advertising, phydev->supported); -#else - if (is5325(dev) || is5365(dev)) - phydev->supported = SUPPORTED_100baseT_Full; - else - phydev->supported = SUPPORTED_1000baseT_Full; - - phydev->advertising = phydev->supported; -#endif ret = b53_switch_register(dev); if (ret) { diff --git a/target/linux/generic/files/drivers/net/phy/mvswitch.c b/target/linux/generic/files/drivers/net/phy/mvswitch.c index 50a73e2f33..bd3b9e1ad1 100644 --- a/target/linux/generic/files/drivers/net/phy/mvswitch.c +++ b/target/linux/generic/files/drivers/net/phy/mvswitch.c @@ -208,14 +208,9 @@ mvswitch_config_init(struct phy_device *pdev) return -EINVAL; printk("%s: Marvell 88E6060 PHY driver attached.\n", dev->name); -#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 dev->phy_ptr = priv; pdev->irq = PHY_POLL; #ifdef HEADER_MODE diff --git a/target/linux/generic/files/drivers/net/phy/psb6970.c b/target/linux/generic/files/drivers/net/phy/psb6970.c index 97fb62ace2..6cee75734b 100644 --- a/target/linux/generic/files/drivers/net/phy/psb6970.c +++ b/target/linux/generic/files/drivers/net/phy/psb6970.c @@ -326,13 +326,9 @@ 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; diff --git a/target/linux/generic/files/drivers/net/phy/swconfig.c b/target/linux/generic/files/drivers/net/phy/swconfig.c index 38fdab2d5c..a734e57608 100644 --- a/target/linux/generic/files/drivers/net/phy/swconfig.c +++ b/target/linux/generic/files/drivers/net/phy/swconfig.c @@ -591,13 +591,8 @@ swconfig_parse_ports(struct sk_buff *msg, struct nlattr *head, port = &val->value.ports[val->len]; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) if (nla_parse_nested_deprecated(tb, SWITCH_PORT_ATTR_MAX, nla, port_policy, NULL)) -#else - if (nla_parse_nested(tb, SWITCH_PORT_ATTR_MAX, nla, - port_policy, NULL)) -#endif return -EINVAL; if (!tb[SWITCH_PORT_ID]) @@ -618,11 +613,7 @@ swconfig_parse_link(struct sk_buff *msg, struct nlattr *nla, { struct nlattr *tb[SWITCH_LINK_ATTR_MAX + 1]; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) if (nla_parse_nested_deprecated(tb, SWITCH_LINK_ATTR_MAX, nla, link_policy, NULL)) -#else - if (nla_parse_nested(tb, SWITCH_LINK_ATTR_MAX, nla, link_policy, NULL)) -#endif return -EINVAL; link->duplex = !!tb[SWITCH_LINK_FLAG_DUPLEX]; @@ -1000,106 +991,56 @@ swconfig_done(struct netlink_callback *cb) static struct genl_ops swconfig_ops[] = { { .cmd = SWITCH_CMD_LIST_GLOBAL, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, -#endif .doit = swconfig_list_attrs, -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) - .policy = switch_policy, -#endif }, { .cmd = SWITCH_CMD_LIST_VLAN, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, -#endif .doit = swconfig_list_attrs, -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) - .policy = switch_policy, -#endif }, { .cmd = SWITCH_CMD_LIST_PORT, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, -#endif .doit = swconfig_list_attrs, -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) - .policy = switch_policy, -#endif }, { .cmd = SWITCH_CMD_GET_GLOBAL, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, -#endif .doit = swconfig_get_attr, -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) - .policy = switch_policy, -#endif }, { .cmd = SWITCH_CMD_GET_VLAN, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, -#endif .doit = swconfig_get_attr, -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) - .policy = switch_policy, -#endif }, { .cmd = SWITCH_CMD_GET_PORT, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, -#endif .doit = swconfig_get_attr, -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) - .policy = switch_policy, -#endif }, { .cmd = SWITCH_CMD_SET_GLOBAL, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, -#endif .flags = GENL_ADMIN_PERM, .doit = swconfig_set_attr, -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) - .policy = switch_policy, -#endif }, { .cmd = SWITCH_CMD_SET_VLAN, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, -#endif .flags = GENL_ADMIN_PERM, .doit = swconfig_set_attr, -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) - .policy = switch_policy, -#endif }, { .cmd = SWITCH_CMD_SET_PORT, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, -#endif .flags = GENL_ADMIN_PERM, .doit = swconfig_set_attr, -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) - .policy = switch_policy, -#endif }, { .cmd = SWITCH_CMD_GET_SWITCH, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0) .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, -#endif .dumpit = swconfig_dump_switches, -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) - .policy = switch_policy, -#endif .done = swconfig_done, } }; @@ -1109,9 +1050,7 @@ static struct genl_family switch_fam = { .hdrsize = 0, .version = 1, .maxattr = SWITCH_ATTR_MAX, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0) .policy = switch_policy, -#endif .module = THIS_MODULE, .ops = swconfig_ops, .n_ops = ARRAY_SIZE(swconfig_ops), diff --git a/target/linux/generic/files/drivers/net/phy/swconfig_leds.c b/target/linux/generic/files/drivers/net/phy/swconfig_leds.c index e982cb7b58..df53e5cd4a 100644 --- a/target/linux/generic/files/drivers/net/phy/swconfig_leds.c +++ b/target/linux/generic/files/drivers/net/phy/swconfig_leds.c @@ -321,14 +321,6 @@ err_free: return err; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,19,0) -static void -swconfig_trig_activate_void(struct led_classdev *led_cdev) -{ - swconfig_trig_activate(led_cdev); -} -#endif - static void swconfig_trig_deactivate(struct led_classdev *led_cdev) { @@ -523,11 +515,7 @@ swconfig_create_led_trigger(struct switch_dev *swdev) sw_trig->swdev = swdev; sw_trig->trig.name = swdev->devname; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,19,0) - sw_trig->trig.activate = swconfig_trig_activate_void; -#else sw_trig->trig.activate = swconfig_trig_activate; -#endif sw_trig->trig.deactivate = swconfig_trig_deactivate; INIT_DELAYED_WORK(&sw_trig->sw_led_work, swconfig_led_work_func); diff --git a/target/linux/generic/files/drivers/platform/mikrotik/rb_softconfig.c b/target/linux/generic/files/drivers/platform/mikrotik/rb_softconfig.c index 51a178ec7c..54e263df8c 100644 --- a/target/linux/generic/files/drivers/platform/mikrotik/rb_softconfig.c +++ b/target/linux/generic/files/drivers/platform/mikrotik/rb_softconfig.c @@ -64,7 +64,7 @@ * Also make the driver act read-only if 4K_SECTORS are not enabled, since they * are require to handle partial erasing of the small soft_config partition. */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)) && defined(CONFIG_MTD_SPI_NOR_USE_4K_SECTORS) +#if defined(CONFIG_MTD_SPI_NOR_USE_4K_SECTORS) #define RB_SC_HAS_WRITE_SUPPORT true #define RB_SC_WMODE S_IWUSR #define RB_SC_RMODE S_IRUSR -- cgit v1.2.3