diff mbox series

[OpenWrt-Devel,2/4] generic: drop outdated kernel version switches in local drivers

Message ID 20200513130721.49794-2-freifunk@adrianschmutzler.de
State Accepted
Delegated to: Adrian Schmutzler
Headers show
Series [OpenWrt-Devel,1/4] kernel: drop outdated kernel version switches for local code | expand

Commit Message

Adrian Schmutzler May 13, 2020, 1:07 p.m. UTC
This drops the obsolete version switches for non-supported kernels
from local drivers in generic target.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
 .../drivers/mtd/mtdsplit/mtdsplit_uimage.c    | 20 -------------------
 .../files/drivers/net/phy/b53/b53_priv.h      |  7 +------
 .../generic/files/drivers/net/phy/rtl8306.c   |  3 ---
 .../files/drivers/net/phy/rtl8366_smi.c       |  8 --------
 .../generic/files/drivers/net/phy/swconfig.c  | 16 ++-------------
 5 files changed, 3 insertions(+), 51 deletions(-)
diff mbox series

Patch

diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c
index a6e50b5113..525ad8218b 100644
--- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c
+++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c
@@ -245,19 +245,15 @@  mtdsplit_uimage_parse_generic(struct mtd_info *master,
 				      uimage_verify_default);
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
 static const struct of_device_id mtdsplit_uimage_of_match_table[] = {
 	{ .compatible = "denx,uimage" },
 	{},
 };
-#endif
 
 static struct mtd_part_parser uimage_generic_parser = {
 	.owner = THIS_MODULE,
 	.name = "uimage-fw",
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
 	.of_match_table = mtdsplit_uimage_of_match_table,
-#endif
 	.parse_fn = mtdsplit_uimage_parse_generic,
 	.type = MTD_PARSER_TYPE_FIRMWARE,
 };
@@ -312,19 +308,15 @@  mtdsplit_uimage_parse_netgear(struct mtd_info *master,
 				      uimage_verify_wndr3700);
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
 static const struct of_device_id mtdsplit_uimage_netgear_of_match_table[] = {
 	{ .compatible = "netgear,uimage" },
 	{},
 };
-#endif
 
 static struct mtd_part_parser uimage_netgear_parser = {
 	.owner = THIS_MODULE,
 	.name = "netgear-fw",
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
 	.of_match_table = mtdsplit_uimage_netgear_of_match_table,
-#endif
 	.parse_fn = mtdsplit_uimage_parse_netgear,
 	.type = MTD_PARSER_TYPE_FIRMWARE,
 };
@@ -364,19 +356,15 @@  mtdsplit_uimage_parse_edimax(struct mtd_info *master,
 				       uimage_find_edimax);
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
 static const struct of_device_id mtdsplit_uimage_edimax_of_match_table[] = {
 	{ .compatible = "edimax,uimage" },
 	{},
 };
-#endif
 
 static struct mtd_part_parser uimage_edimax_parser = {
 	.owner = THIS_MODULE,
 	.name = "edimax-fw",
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
 	.of_match_table = mtdsplit_uimage_edimax_of_match_table,
-#endif
 	.parse_fn = mtdsplit_uimage_parse_edimax,
 	.type = MTD_PARSER_TYPE_FIRMWARE,
 };
@@ -407,19 +395,15 @@  mtdsplit_uimage_parse_fonfxc(struct mtd_info *master,
 				       uimage_find_fonfxc);
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
 static const struct of_device_id mtdsplit_uimage_fonfxc_of_match_table[] = {
 	{ .compatible = "fonfxc,uimage" },
 	{},
 };
-#endif
 
 static struct mtd_part_parser uimage_fonfxc_parser = {
 	.owner = THIS_MODULE,
 	.name = "fonfxc-fw",
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
 	.of_match_table = mtdsplit_uimage_fonfxc_of_match_table,
-#endif
 	.parse_fn = mtdsplit_uimage_parse_fonfxc,
 };
 
@@ -464,19 +448,15 @@  mtdsplit_uimage_parse_okli(struct mtd_info *master,
 				      uimage_verify_okli);
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
 static const struct of_device_id mtdsplit_uimage_okli_of_match_table[] = {
 	{ .compatible = "openwrt,okli" },
 	{},
 };
-#endif
 
 static struct mtd_part_parser uimage_okli_parser = {
 	.owner = THIS_MODULE,
 	.name = "okli-fw",
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
 	.of_match_table = mtdsplit_uimage_okli_of_match_table,
-#endif
 	.parse_fn = mtdsplit_uimage_parse_okli,
 };
 
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
index a9296c9421..37c17aeb25 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
@@ -314,9 +314,8 @@  static inline int b53_write64(struct b53_device *dev, u8 page, u8 reg,
 #endif
 
 #include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
 #include <linux/bcm47xx_nvram.h>
-#endif
+
 static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
 {
 #ifdef CONFIG_BCM47XX
@@ -331,11 +330,7 @@  static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
 	}
 #endif
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
 	return bcm47xx_nvram_gpio_pin("robo_reset");
-#else
-	return -ENOENT;
-#endif
 }
 
 #endif
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8306.c b/target/linux/generic/files/drivers/net/phy/rtl8306.c
index 6d09c1063c..31bc7589c4 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8306.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8306.c
@@ -1033,9 +1033,6 @@  rtl8306_read_status(struct phy_device *pdev)
 
 static struct phy_driver rtl8306_driver = {
 	.name		= "Realtek RTL8306S",
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,13,0))
-	.flags		= PHY_HAS_MAGICANEG,
-#endif
 	.phy_id		= RTL8306_MAGIC,
 	.phy_id_mask	= 0xffffffff,
 	.features	= PHY_BASIC_FEATURES,
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
index 2c4d53fc67..e8375e5147 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
@@ -1035,14 +1035,6 @@  static int rtl8366_smi_mii_init(struct rtl8366_smi *smi)
 		 dev_name(smi->parent));
 	smi->mii_bus->parent = smi->parent;
 	smi->mii_bus->phy_mask = ~(0x1f);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0)
-	{
-		int i;
-		smi->mii_bus->irq = smi->mii_irq;
-		for (i = 0; i < PHY_MAX_ADDR; i++)
-			smi->mii_irq[i] = PHY_POLL;
-	}
-#endif
 
 #ifdef CONFIG_OF
 	if (np)
diff --git a/target/linux/generic/files/drivers/net/phy/swconfig.c b/target/linux/generic/files/drivers/net/phy/swconfig.c
index e7da45d0f7..38fdab2d5c 100644
--- a/target/linux/generic/files/drivers/net/phy/swconfig.c
+++ b/target/linux/generic/files/drivers/net/phy/swconfig.c
@@ -594,12 +594,9 @@  swconfig_parse_ports(struct sk_buff *msg, struct nlattr *head,
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
 		if (nla_parse_nested_deprecated(tb, SWITCH_PORT_ATTR_MAX, nla,
 				port_policy, NULL))
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
-		if (nla_parse_nested(tb, SWITCH_PORT_ATTR_MAX, nla,
-				port_policy, NULL))
 #else
 		if (nla_parse_nested(tb, SWITCH_PORT_ATTR_MAX, nla,
-				port_policy))
+				port_policy, NULL))
 #endif
 			return -EINVAL;
 
@@ -623,10 +620,8 @@  swconfig_parse_link(struct sk_buff *msg, struct nlattr *nla,
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0)
 	if (nla_parse_nested_deprecated(tb, SWITCH_LINK_ATTR_MAX, nla, link_policy, NULL))
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
-	if (nla_parse_nested(tb, SWITCH_LINK_ATTR_MAX, nla, link_policy, NULL))
 #else
-	if (nla_parse_nested(tb, SWITCH_LINK_ATTR_MAX, nla, link_policy))
+	if (nla_parse_nested(tb, SWITCH_LINK_ATTR_MAX, nla, link_policy, NULL))
 #endif
 		return -EINVAL;
 
@@ -1110,9 +1105,6 @@  static struct genl_ops swconfig_ops[] = {
 };
 
 static struct genl_family switch_fam = {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
-	.id = GENL_ID_GENERATE,
-#endif
 	.name = "switch",
 	.hdrsize = 0,
 	.version = 1,
@@ -1298,11 +1290,7 @@  swconfig_init(void)
 {
 	INIT_LIST_HEAD(&swdevs);
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
-	return genl_register_family_with_ops(&switch_fam, swconfig_ops);
-#else
 	return genl_register_family(&switch_fam);
-#endif
 }
 
 static void __exit