diff options
author | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2020-10-01 17:02:47 +0200 |
---|---|---|
committer | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2020-10-30 19:45:24 +0100 |
commit | 2aa558c49a12c0820fd7b6cc55bf90b320ef3551 (patch) | |
tree | 79a69a219977db143ed868ea1032cae70250b6e8 | |
parent | ac5671f46cb4a300e2a8ae00db70c248828367f5 (diff) | |
download | upstream-2aa558c49a12c0820fd7b6cc55bf90b320ef3551.tar.gz upstream-2aa558c49a12c0820fd7b6cc55bf90b320ef3551.tar.bz2 upstream-2aa558c49a12c0820fd7b6cc55bf90b320ef3551.zip |
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 <freifunk@adrianschmutzler.de>
10 files changed, 2 insertions, 272 deletions
diff --git a/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c b/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c index b35343c8d9..5f0026b475 100644 --- a/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c +++ b/target/linux/ath79/files/drivers/mtd/nand/raw/ar934x_nand.c @@ -631,19 +631,11 @@ static void ar934x_nfc_read_status(struct ar934x_nfc *nfc) nfc->buf[0] = status; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) -static void ar934x_nfc_cmdfunc(struct mtd_info *mtd, unsigned int command, - int column, int page_addr) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); - struct nand_chip *nand = &nfc->nand_chip; -#else static void ar934x_nfc_cmdfunc(struct nand_chip *nand, unsigned int command, int column, int page_addr) { struct mtd_info *mtd = nand_to_mtd(nand); struct ar934x_nfc *nfc = nand->priv; -#endif nfc->read_id = false; if (command != NAND_CMD_PAGEPROG) @@ -748,28 +740,16 @@ static void ar934x_nfc_cmdfunc(struct nand_chip *nand, unsigned int command, } } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) -static int ar934x_nfc_dev_ready(struct mtd_info *mtd) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); -#else static int ar934x_nfc_dev_ready(struct nand_chip *chip) { struct ar934x_nfc *nfc = chip->priv; -#endif return __ar934x_nfc_dev_ready(nfc); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) -static u8 ar934x_nfc_read_byte(struct mtd_info *mtd) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); -#else static u8 ar934x_nfc_read_byte(struct nand_chip *chip) { struct ar934x_nfc *nfc = chip->priv; -#endif u8 data; WARN_ON(nfc->buf_index >= nfc->buf_size); @@ -784,15 +764,9 @@ static u8 ar934x_nfc_read_byte(struct nand_chip *chip) return data; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) -static void ar934x_nfc_write_buf(struct mtd_info *mtd, const u8 *buf, int len) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); -#else static void ar934x_nfc_write_buf(struct nand_chip *chip, const u8 *buf, int len) { struct ar934x_nfc *nfc = chip->priv; -#endif int i; WARN_ON(nfc->buf_index + len > nfc->buf_size); @@ -810,15 +784,9 @@ static void ar934x_nfc_write_buf(struct nand_chip *chip, const u8 *buf, int len) } } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) -static void ar934x_nfc_read_buf(struct mtd_info *mtd, u8 *buf, int len) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); -#else static void ar934x_nfc_read_buf(struct nand_chip *chip, u8 *buf, int len) { struct ar934x_nfc *nfc = chip->priv; -#endif int buf_index; int i; @@ -853,18 +821,11 @@ static inline void ar934x_nfc_disable_hwecc(struct ar934x_nfc *nfc) nfc->ctrl_reg |= AR934X_NFC_CTRL_CUSTOM_SIZE_EN; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) -static int ar934x_nfc_read_oob(struct mtd_info *mtd, struct nand_chip *chip, - int page) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); -#else static int ar934x_nfc_read_oob(struct nand_chip *chip, int page) { struct ar934x_nfc *nfc = chip->priv; struct mtd_info *mtd = ar934x_nfc_to_mtd(nfc); -#endif int err; nfc_dbg(nfc, "read_oob: page:%d\n", page); @@ -879,18 +840,11 @@ static int ar934x_nfc_read_oob(struct nand_chip *chip, return 0; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) -static int ar934x_nfc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, - int page) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); -#else static int ar934x_nfc_write_oob(struct nand_chip *chip, int page) { struct ar934x_nfc *nfc = chip->priv; struct mtd_info *mtd = ar934x_nfc_to_mtd(nfc); -#endif nfc_dbg(nfc, "write_oob: page:%d\n", page); memcpy(nfc->buf, chip->oob_poi, mtd->oobsize); @@ -899,20 +853,12 @@ static int ar934x_nfc_write_oob(struct nand_chip *chip, page, mtd->oobsize); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) -static int ar934x_nfc_read_page_raw(struct mtd_info *mtd, - struct nand_chip *chip, u8 *buf, - int oob_required, int page) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); -#else static int ar934x_nfc_read_page_raw( struct nand_chip *chip, u8 *buf, int oob_required, int page) { struct ar934x_nfc *nfc = chip->priv; struct mtd_info *mtd = ar934x_nfc_to_mtd(nfc); -#endif int len; int err; @@ -934,18 +880,11 @@ static int ar934x_nfc_read_page_raw( return 0; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) -static int ar934x_nfc_read_page(struct mtd_info *mtd, struct nand_chip *chip, - u8 *buf, int oob_required, int page) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); -#else static int ar934x_nfc_read_page(struct nand_chip *chip, u8 *buf, int oob_required, int page) { struct ar934x_nfc *nfc = chip->priv; struct mtd_info *mtd = ar934x_nfc_to_mtd(nfc); -#endif u32 ecc_ctrl; int max_bitflips = 0; bool ecc_failed; @@ -1014,20 +953,12 @@ static int ar934x_nfc_read_page(struct nand_chip *chip, return max_bitflips; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) -static int ar934x_nfc_write_page_raw(struct mtd_info *mtd, - struct nand_chip *chip, const u8 *buf, - int oob_required, int page) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); -#else static int ar934x_nfc_write_page_raw( struct nand_chip *chip, const u8 *buf, int oob_required, int page) { struct ar934x_nfc *nfc = chip->priv; struct mtd_info *mtd = ar934x_nfc_to_mtd(nfc); -#endif int len; nfc_dbg(nfc, "write_page_raw: page:%d oob:%d\n", page, oob_required); @@ -1043,18 +974,11 @@ static int ar934x_nfc_write_page_raw( return ar934x_nfc_send_write(nfc, NAND_CMD_PAGEPROG, 0, page, len); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) -static int ar934x_nfc_write_page(struct mtd_info *mtd, struct nand_chip *chip, - const u8 *buf, int oob_required, int page) -{ - struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); -#else static int ar934x_nfc_write_page(struct nand_chip *chip, const u8 *buf, int oob_required, int page) { struct ar934x_nfc *nfc = chip->priv; struct mtd_info *mtd = ar934x_nfc_to_mtd(nfc); -#endif int err; nfc_dbg(nfc, "write_page: page:%d oob:%d\n", page, oob_required); @@ -1062,11 +986,7 @@ static int ar934x_nfc_write_page(struct nand_chip *chip, /* write OOB first */ if (oob_required && !is_all_ff(chip->oob_poi, mtd->oobsize)) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) - err = ar934x_nfc_write_oob(mtd, chip, page); -#else err = ar934x_nfc_write_oob(chip, page); -#endif if (err) return err; } @@ -1176,11 +1096,7 @@ static int ar934x_nfc_init_tail(struct mtd_info *mtd) { struct ar934x_nfc *nfc = mtd_to_ar934x_nfc(mtd); struct nand_chip *chip = &nfc->nand_chip; -#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0) - u64 chipsize = chip->chipsize; -#else u64 chipsize = nanddev_target_size(&chip->base); -#endif u32 ctrl; u32 t; int err; @@ -1427,13 +1343,8 @@ static int ar934x_nfc_attach_chip(struct nand_chip *nand) static u64 ar934x_nfc_dma_mask = DMA_BIT_MASK(32); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) -static void ar934x_nfc_cmd_ctrl(struct mtd_info *mtd, int dat, - unsigned int ctrl) -#else static void ar934x_nfc_cmd_ctrl(struct nand_chip *chip, int dat, unsigned int ctrl) -#endif { WARN_ON(dat != NAND_CMD_NONE); } @@ -1504,15 +1415,6 @@ static int ar934x_nfc_probe(struct platform_device *pdev) nand_set_controller_data(nand, nfc); nand_set_flash_node(nand, pdev->dev.of_node); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) - nand->chip_delay = 25; - nand->dev_ready = ar934x_nfc_dev_ready; - nand->cmdfunc = ar934x_nfc_cmdfunc; - nand->cmd_ctrl = ar934x_nfc_cmd_ctrl; /* dummy */ - nand->read_byte = ar934x_nfc_read_byte; - nand->write_buf = ar934x_nfc_write_buf; - nand->read_buf = ar934x_nfc_read_buf; -#else nand->legacy.chip_delay = 25; nand->legacy.dev_ready = ar934x_nfc_dev_ready; nand->legacy.cmdfunc = ar934x_nfc_cmdfunc; @@ -1520,7 +1422,6 @@ static int ar934x_nfc_probe(struct platform_device *pdev) nand->legacy.read_byte = ar934x_nfc_read_byte; nand->legacy.write_buf = ar934x_nfc_write_buf; nand->legacy.read_buf = ar934x_nfc_read_buf; -#endif nand->ecc.mode = NAND_ECC_HW; /* default */ nand->priv = nfc; platform_set_drvdata(pdev, nfc); @@ -1535,16 +1436,8 @@ static int ar934x_nfc_probe(struct platform_device *pdev) goto err_free_buf; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 130) - nand->dummy_controller.ops = &ar934x_nfc_controller_ops; - ret = nand_scan(mtd, 1); -#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) - nand->dummy_controller.ops = &ar934x_nfc_controller_ops; - ret = nand_scan(nand, 1); -#else nand->legacy.dummy_controller.ops = &ar934x_nfc_controller_ops; ret = nand_scan(nand, 1); -#endif if (ret) { dev_err(&pdev->dev, "nand_scan failed, err:%d\n", ret); goto err_free_buf; @@ -1566,9 +1459,6 @@ err_free_buf: static int ar934x_nfc_remove(struct platform_device *pdev) { struct ar934x_nfc *nfc; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) - struct mtd_info *mtd; -#endif nfc = platform_get_drvdata(pdev); if (nfc) { diff --git a/target/linux/ath79/files/drivers/mtd/nand/raw/nand_rb4xx.c b/target/linux/ath79/files/drivers/mtd/nand/raw/nand_rb4xx.c index 382af09978..50bd69f6a4 100644 --- a/target/linux/ath79/files/drivers/mtd/nand/raw/nand_rb4xx.c +++ b/target/linux/ath79/files/drivers/mtd/nand/raw/nand_rb4xx.c @@ -81,15 +81,9 @@ static const struct mtd_ooblayout_ops rb4xx_nand_ecclayout_ops = { .free = rb4xx_ooblayout_free, }; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0) -static uint8_t rb4xx_nand_read_byte(struct mtd_info *mtd) -{ - struct rb4xx_nand *nand = mtd->priv; -#else static u8 rb4xx_nand_read_byte(struct nand_chip *chip) { struct rb4xx_nand *nand = chip->priv; -#endif struct rb4xx_cpld *cpld = nand->cpld; u8 data; int ret; @@ -101,45 +95,26 @@ static u8 rb4xx_nand_read_byte(struct nand_chip *chip) return data; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0) -static void rb4xx_nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, - int len) -{ - struct rb4xx_nand *nand = mtd->priv; -#else static void rb4xx_nand_write_buf(struct nand_chip *chip, const u8 *buf, int len) { struct rb4xx_nand *nand = chip->priv; -#endif struct rb4xx_cpld *cpld = nand->cpld; cpld->write_nand(cpld, buf, len); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0) -static void rb4xx_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) -{ - struct rb4xx_nand *nand = mtd->priv; -#else static void rb4xx_nand_read_buf(struct nand_chip *chip, u8 *buf, int len) { struct rb4xx_nand *nand = chip->priv; -#endif struct rb4xx_cpld *cpld = nand->cpld; cpld->read_nand(cpld, buf, len); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0) -static void rb4xx_nand_cmd_ctrl(struct mtd_info *mtd, int dat, unsigned int ctrl) -{ - struct rb4xx_nand *nand = mtd->priv; -#else static void rb4xx_nand_cmd_ctrl(struct nand_chip *chip, int dat, unsigned int ctrl) { struct rb4xx_nand *nand = chip->priv; -#endif struct rb4xx_cpld *cpld = nand->cpld; u8 data = dat; @@ -153,15 +128,9 @@ static void rb4xx_nand_cmd_ctrl(struct nand_chip *chip, int dat, cpld->write_nand(cpld, &data, 1); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0) -static int rb4xx_nand_dev_ready(struct mtd_info *mtd) -{ - struct rb4xx_nand *nand = mtd->priv; -#else static int rb4xx_nand_dev_ready(struct nand_chip *chip) { struct rb4xx_nand *nand = chip->priv; -#endif return gpiod_get_value_cansleep(nand->rdy); } @@ -224,20 +193,6 @@ static int rb4xx_nand_probe(struct platform_device *pdev) nand->chip.options = NAND_NO_SUBPAGE_WRITE; nand->chip.priv = nand; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0) - nand->chip.read_byte = rb4xx_nand_read_byte; - nand->chip.write_buf = rb4xx_nand_write_buf; - nand->chip.read_buf = rb4xx_nand_read_buf; - nand->chip.cmd_ctrl = rb4xx_nand_cmd_ctrl; - nand->chip.dev_ready = rb4xx_nand_dev_ready; - nand->chip.chip_delay = 25; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,19,130) - ret = nand_scan(mtd, 1); -#else - ret = nand_scan(&nand->chip, 1); -#endif -#else nand->chip.legacy.read_byte = rb4xx_nand_read_byte; nand->chip.legacy.write_buf = rb4xx_nand_write_buf; nand->chip.legacy.read_buf = rb4xx_nand_read_buf; @@ -246,7 +201,6 @@ static int rb4xx_nand_probe(struct platform_device *pdev) nand->chip.legacy.chip_delay = 25; ret = nand_scan(&nand->chip, 1); -#endif if (ret) return -ENXIO; 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 |