[openwrt/openwrt] ramips: drop kernel version switches

LEDE Commits lede-commits at lists.infradead.org
Fri Oct 9 16:49:50 EDT 2020


adrian pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/f5cf408b766a9237e501fd4534cf87c3f38ec6fa

commit f5cf408b766a9237e501fd4534cf87c3f38ec6fa
Author: Adrian Schmutzler <freifunk at adrianschmutzler.de>
AuthorDate: Fri Oct 9 22:24:04 2020 +0200

    ramips: drop kernel version switches
    
    The ramips target only supports 5.4, so drop all kernel version
    switches for older kernels there.
    
    Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 .../ramips/files/drivers/net/ethernet/ralink/mdio.c  | 11 -----------
 .../files/drivers/net/ethernet/ralink/mtk_eth_soc.c  | 20 --------------------
 target/linux/ramips/modules.mk                       |  6 ++----
 3 files changed, 2 insertions(+), 35 deletions(-)

diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c
index 74babc59a0..33f973bed3 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mdio.c
@@ -88,13 +88,8 @@ int fe_connect_phy_node(struct fe_priv *priv, struct device_node *phy_node, int
 		return -ENODEV;
 	}
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
-	phydev->supported &= PHY_GBIT_FEATURES;
-	phydev->advertising = phydev->supported;
-#else
 	phy_set_max_speed(phydev, SPEED_1000);
 	linkmode_copy(phydev->advertising, phydev->supported);
-#endif
 	phydev->no_auto_carrier_off = 1;
 
 	dev_info(priv->dev,
@@ -116,17 +111,11 @@ static void phy_init(struct fe_priv *priv, struct phy_device *phy)
 	phy->speed = 0;
 	phy->duplex = 0;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
-	phy->supported &= IS_ENABLED(CONFIG_NET_RALINK_MDIO_MT7620) ?
-			PHY_GBIT_FEATURES : PHY_BASIC_FEATURES;
-	phy->advertising = phy->supported | ADVERTISED_Autoneg;
-#else
 	phy_set_max_speed(phy, IS_ENABLED(CONFIG_NET_RALINK_MDIO_MT7620) ?
 				       SPEED_1000 :
 				       SPEED_100);
 	linkmode_copy(phy->advertising, phy->supported);
 	linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phy->advertising);
-#endif
 
 	phy_start_aneg(phy);
 }
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c
index 62c186dbd6..f8301ad3ca 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c
@@ -715,19 +715,11 @@ next_frag:
 	/* TX SG offload */
 	nr_frags = skb_shinfo(skb)->nr_frags;
 	for (i = 0; i < nr_frags; i++) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
-		struct skb_frag_struct *frag;
-#else
 		skb_frag_t *frag;
-#endif
 
 		frag = &skb_shinfo(skb)->frags[i];
 		if (fe_tx_dma_map_page(ring, &st, skb_frag_page(frag),
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
-				       frag->page_offset, skb_frag_size(frag)))
-#else
 				       skb_frag_off(frag), skb_frag_size(frag)))
-#endif
 			goto err_dma;
 	}
 
@@ -762,11 +754,7 @@ next_frag:
 			netif_wake_queue(dev);
 	}
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
-	if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) || !head->xmit_more)
-#else
 	if (netif_xmit_stopped(netdev_get_tx_queue(dev, 0)) || !netdev_xmit_more())
-#endif
 		fe_reg_w32(ring->tx_next_idx, FE_REG_TX_CTX_IDX0);
 
 	return 0;
@@ -825,22 +813,14 @@ static inline int fe_cal_txd_req(struct sk_buff *skb)
 {
 	struct sk_buff *head = skb;
 	int i, nfrags = 0;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
-	struct skb_frag_struct *frag;
-#else
 	skb_frag_t *frag;
-#endif
 
 next_frag:
 	nfrags++;
 	if (skb_is_gso(skb)) {
 		for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
 			frag = &skb_shinfo(skb)->frags[i];
-#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
-			nfrags += DIV_ROUND_UP(frag->size, TX_DMA_BUF_LEN);
-#else
 			nfrags += DIV_ROUND_UP(skb_frag_size(frag), TX_DMA_BUF_LEN);
-#endif
 		}
 	} else {
 		nfrags += skb_shinfo(skb)->nr_frags;
diff --git a/target/linux/ramips/modules.mk b/target/linux/ramips/modules.mk
index 6fd3b51c45..ae5e6822de 100644
--- a/target/linux/ramips/modules.mk
+++ b/target/linux/ramips/modules.mk
@@ -84,8 +84,7 @@ define KernelPackage/dma-ralink
 	CONFIG_DMA_RALINK
   FILES:= \
 	$(LINUX_DIR)/drivers/dma/virt-dma.ko \
-	$(LINUX_DIR)/drivers/dma/ralink-gdma.ko at lt5.4 \
-	$(LINUX_DIR)/drivers/staging/ralink-gdma/ralink-gdma.ko at ge5.4
+	$(LINUX_DIR)/drivers/staging/ralink-gdma/ralink-gdma.ko
   AUTOLOAD:=$(call AutoLoad,52,ralink-gdma)
 endef
 
@@ -105,8 +104,7 @@ define KernelPackage/hsdma-mtk
 	CONFIG_MTK_HSDMA
   FILES:= \
 	$(LINUX_DIR)/drivers/dma/virt-dma.ko \
-	$(LINUX_DIR)/drivers/dma/mtk-hsdma.ko at lt5.4 \
-	$(LINUX_DIR)/drivers/staging/mt7621-dma/mtk-hsdma.ko at ge5.4
+	$(LINUX_DIR)/drivers/staging/mt7621-dma/mtk-hsdma.ko
   AUTOLOAD:=$(call AutoLoad,53,mtk-hsdma)
 endef
 



More information about the lede-commits mailing list