[openwrt/openwrt] ramips: remove unnecessary macros for previous kernel versions

LEDE Commits lede-commits at lists.infradead.org
Fri May 3 15:02:55 PDT 2024


dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/263fde5ab87bc3f299e4bd2d33a22e0fe55f9545

commit 263fde5ab87bc3f299e4bd2d33a22e0fe55f9545
Author: Mieczyslaw Nalewaj <namiltd at yahoo.com>
AuthorDate: Fri May 3 19:35:11 2024 +0200

    ramips: remove unnecessary macros for previous kernel versions
    
    Remove unnecessary 'if' macros for previous kernel versions.
    After removing kernel 6.1 the kernel is always >= 6.6 so the conditions
    are unnecessary.
    
    Signed-off-by: Mieczyslaw Nalewaj <namiltd at yahoo.com>
    [removed some more and also no longer include version.h]
    Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 .../linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c   |  8 --------
 .../ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c     |  8 --------
 .../ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h     |  1 -
 target/linux/ramips/files/drivers/pinctrl/pinctrl-aw9523.c     | 10 ----------
 4 files changed, 27 deletions(-)

diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c
index ca3b6fb302..5d4cebb089 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/ethtool.c
@@ -199,20 +199,12 @@ static void fe_get_ethtool_stats(struct net_device *dev,
 	do {
 		data_src = &hwstats->tx_bytes;
 		data_dst = data;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
 		start = u64_stats_fetch_begin(&hwstats->syncp);
-#else
-		start = u64_stats_fetch_begin_irq(&hwstats->syncp);
-#endif
 
 		for (i = 0; i < ARRAY_SIZE(fe_gdma_str); i++)
 			*data_dst++ = *data_src++;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
 	} while (u64_stats_fetch_retry(&hwstats->syncp, start));
-#else
-	} while (u64_stats_fetch_retry_irq(&hwstats->syncp, start));
-#endif
 }
 
 static struct ethtool_ops fe_ethtool_ops = {
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 4365e398d3..c8afa4e3bb 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
@@ -487,11 +487,7 @@ static void fe_get_stats64(struct net_device *dev,
 	}
 
 	do {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
 		start = u64_stats_fetch_begin(&hwstats->syncp);
-#else
-		start = u64_stats_fetch_begin_irq(&hwstats->syncp);
-#endif
 		storage->rx_packets = hwstats->rx_packets;
 		storage->tx_packets = hwstats->tx_packets;
 		storage->rx_bytes = hwstats->rx_bytes;
@@ -503,11 +499,7 @@ static void fe_get_stats64(struct net_device *dev,
 		storage->rx_crc_errors = hwstats->rx_fcs_errors;
 		storage->rx_errors = hwstats->rx_checksum_errors;
 		storage->tx_aborted_errors = hwstats->tx_skip;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
 	} while (u64_stats_fetch_retry(&hwstats->syncp, start));
-#else
-	} while (u64_stats_fetch_retry_irq(&hwstats->syncp, start));
-#endif
 
 	storage->tx_errors = priv->netdev->stats.tx_errors;
 	storage->rx_dropped = priv->netdev->stats.rx_dropped;
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h
index 364dd54a58..151caae1dc 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h
@@ -21,7 +21,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/phy.h>
 #include <linux/ethtool.h>
-#include <linux/version.h>
 
 enum fe_reg {
 	FE_REG_PDMA_GLO_CFG = 0,
diff --git a/target/linux/ramips/files/drivers/pinctrl/pinctrl-aw9523.c b/target/linux/ramips/files/drivers/pinctrl/pinctrl-aw9523.c
index a429bb82a3..8b642e28b1 100644
--- a/target/linux/ramips/files/drivers/pinctrl/pinctrl-aw9523.c
+++ b/target/linux/ramips/files/drivers/pinctrl/pinctrl-aw9523.c
@@ -16,7 +16,6 @@
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
-#include <linux/version.h>
 #include <linux/gpio/consumer.h>
 #include <linux/gpio/driver.h>
 #include <linux/pinctrl/pinconf.h>
@@ -810,11 +809,7 @@ static int aw9523_init_gpiochip(struct aw9523 *awi, unsigned int npins)
 	gpiochip->set_multiple = aw9523_gpio_set_multiple;
 	gpiochip->set_config = gpiochip_generic_config;
 	gpiochip->parent = dev;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
 	gpiochip->fwnode = dev->fwnode;
-#else
-	gpiochip->of_node = dev->of_node;
-#endif
 	gpiochip->owner = THIS_MODULE;
 	gpiochip->can_sleep = true;
 
@@ -988,12 +983,7 @@ static int aw9523_hw_init(struct aw9523 *awi)
 	return regmap_reinit_cache(awi->regmap, &aw9523_regmap);
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0)
 static int aw9523_probe(struct i2c_client *client)
-#else
-static int aw9523_probe(struct i2c_client *client,
-			const struct i2c_device_id *id)
-#endif
 {
 	struct device *dev = &client->dev;
 	struct pinctrl_desc *pdesc;




More information about the lede-commits mailing list