Skip to contentSkip to conversation

backports: remove more old ifdef/compat code

PATCH Applied Johannes Berg 2 participants 2 messages Apr 28, 2014 – May 2, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backports: remove more old ifdef/compat code

From: Johannes Berg <[email protected]>

Since support for kernels < 3.0 was removed, there's now a bunch of dead code that can be removed - do it.

---
 backport/backport-include/linux/device.h          |  16 ----
 backport/backport-include/linux/mmc/host.h        |  11 ---
 backport/backport-include/linux/netdev_features.h |   4 -
 backport/backport-include/linux/netdevice.h       |  11 ---
 backport/backport-include/linux/pci.h             | 102 +---------------------
 backport/backport-include/linux/rcupdate.h        |   7 --
 backport/backport-include/net/netlink.h           |   4 -
 backport/compat/backport-3.10.c                   |   3 -
 backport/compat/backport-3.13.c                   |  79 -----------------
 backport/compat/backport-3.14.c                   |   2 -
 backport/compat/compat-3.3.c                      |  16 ----
 backport/compat/compat-3.8.c                      |  13 ---
 12 files changed, 1 insertion(+), 267 deletions(-)
 delete mode 100644 backport/backport-include/linux/mmc/host.h
backport/backport-include/linux/device.h +0 -16
index 3f57bd9affc7..04533bdd2673 100644
@@ -124,19 +124,11 @@ static void init_##_name##_attrs(void)				\
 }
 
 #ifndef __ATTRIBUTE_GROUPS
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
 #define __ATTRIBUTE_GROUPS(_name)				\
 static const struct attribute_group *_name##_groups[] = {	\
 	&_name##_group,						\
 	NULL,							\
 }
-#else
-#define __ATTRIBUTE_GROUPS(_name)				\
-static struct attribute_group *_name##_groups[] = {		\
-	&_name##_group,						\
-	NULL,							\
-}
-#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31)) */
 #endif /* __ATTRIBUTE_GROUPS */
 
 #undef ATTRIBUTE_GROUPS
@@ -147,14 +139,6 @@ static const struct attribute_group _name##_group = {		\
 static inline void init_##_name##_attrs(void) {}		\
 __ATTRIBUTE_GROUPS(_name)
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
-#define dev_get_platdata LINUX_BACKPORT(dev_get_platdata)
-static inline void *dev_get_platdata(const struct device *dev)
-{
-	return dev->platform_data;
-}
-#endif
-
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
 #define devm_kmalloc(dev, size, flags) devm_kzalloc(dev, size, flags) 
 #endif
backport/backport-include/linux/mmc/host.h deleted +0 -11
deleted file mode 100644
index 49ca5c212135..000000000000
@@ -1,11 +0,0 @@
-#ifndef __BACKPORT_MMC_HOST_H
-#define __BACKPORT_MMC_HOST_H
-#include <linux/version.h>
-#include_next <linux/mmc/host.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
-/* rename member in struct mmc_host */
-#define max_segs	max_hw_segs
-#endif
-
-#endif /* __BACKPORT_MMC_HOST_H */
backport/backport-include/linux/netdev_features.h +0 -4
index 76fb463963a9..350283d6abd4 100644
@@ -8,15 +8,11 @@
 #include <linux/types.h>
 
 /* added via 9356b8fc */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
 #define NETIF_F_HW_VLAN_CTAG_RX			NETIF_F_HW_VLAN_RX
 #define NETIF_F_HW_VLAN_CTAG_TX			NETIF_F_HW_VLAN_TX
-#endif
 
 /* added via d314774c */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
 #define NETIF_F_HW_VLAN_CTAG_FILTER		NETIF_F_HW_VLAN_FILTER
-#endif
 
 /* c8f44aff made this u32 but later a861a8b2 changed it to u64 both on v3.3 */
 typedef u32 netdev_features_t;
backport/backport-include/linux/netdevice.h +0 -11
index 04b310dbcffd..2abb47d747c8 100644
@@ -82,17 +82,6 @@ static inline void dev_consume_skb_any(struct sk_buff *skb)
 }
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) */
 
-/* d1c76af9e */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
-enum { /* backport: provide the enum name already */
-	GRO_MERGED,
-	GRO_MERGED_FREE,
-	GRO_HELD,
-	GRO_NORMAL,
-	GRO_DROP,
-};
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) */
-
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,8)
 #define netdev_set_default_ethtool_ops LINUX_BACKPORT(netdev_set_default_ethtool_ops)
 extern void netdev_set_default_ethtool_ops(struct net_device *dev,
backport/backport-include/linux/pci.h +1 -101

120 lines not on this page · raw message

backport/backport-include/linux/rcupdate.h +0 -7
index d6d9262bb64d..230d12f8c9cd 100644
@@ -41,11 +41,4 @@
 #define rcu_dereference_raw(p)	rcu_dereference(p)
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
-static inline int rcu_read_lock_held(void)
-{
-	return 1;
-}
-#endif
-
 #endif /* __BACKPORT_LINUX_RCUPDATE_H */
backport/backport-include/net/netlink.h +0 -4
index 4f8308adbada..9324d02d2c86 100644
@@ -87,11 +87,7 @@ static inline s8 nla_get_s8(const struct nlattr *nla)
  * @nla: s64 netlink attribute
  */
 #define nla_get_s64 LINUX_BACKPORT(nla_get_s64)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
 static inline s64 nla_get_s64(const struct nlattr *nla)
-#else
-static inline s64 nla_get_s64(struct nlattr *nla)
-#endif
 {
 	s64 tmp;
 
backport/compat/backport-3.10.c +0 -3
index c7a1c182a9d1..9bcb8059506a 100644
@@ -96,7 +96,6 @@ unsigned int get_random_int(void)
 }
 EXPORT_SYMBOL_GPL(get_random_int);
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
 #ifdef CONFIG_TTY
 /**
  * tty_port_tty_wakeup - helper to wake up a tty
@@ -174,8 +173,6 @@ int pci_vfs_assigned(struct pci_dev *dev)
 EXPORT_SYMBOL_GPL(pci_vfs_assigned);
 #endif /* CONFIG_PCI_IOV */
 
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) */
-
 #ifdef CONFIG_OF
 /**
  * of_find_property_value_of_size
backport/compat/backport-3.13.c +0 -79

110 lines not on this page · raw message

backport/compat/backport-3.14.c +0 -2
index bce50dc55d52..aeb300454215 100644
@@ -11,7 +11,6 @@
 #include <linux/kernel.h>
 #include <linux/pci.h>
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
 #ifdef CONFIG_PCI_MSI
 /**
  * pci_enable_msi_range - configure device's MSI capability structure
@@ -48,7 +47,6 @@ int pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec)
 }
 EXPORT_SYMBOL(pci_enable_msi_range);
 #endif
-#endif
 
 #ifdef CONFIG_PCI_MSI
 /**
backport/compat/compat-3.3.c +0 -16
index 75bd5e530e1e..7ddc2bd277de 100644
@@ -23,12 +23,8 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
 	new->transport_header	= old->transport_header;
 	new->network_header	= old->network_header;
 	new->mac_header		= old->mac_header;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
 	skb_dst_copy(new, old);
 	new->rxhash		= old->rxhash;
-#else
-	skb_dst_set(new, dst_clone(skb_dst(old)));
-#endif
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
 	new->ooo_okay		= old->ooo_okay;
 #endif
@@ -50,9 +46,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
 #endif
 	new->protocol		= old->protocol;
 	new->mark		= old->mark;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
 	new->skb_iif		= old->skb_iif;
-#endif
 	__nf_copy(new, old);
 #if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE)
 	new->nf_trace		= old->nf_trace;
@@ -63,9 +57,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
 	new->tc_verd		= old->tc_verd;
 #endif
 #endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
 	new->vlan_tci		= old->vlan_tci;
-#endif
 
 	skb_copy_secmark(new, old);
 }
@@ -198,15 +190,7 @@ backport_alloc_workqueue(const char *fmt, unsigned int flags,
 	vsnprintf(n->name, sizeof(n->name), fmt, args);
 	va_end(args);
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)
-	wq = __create_workqueue_key(n->name, max_active == 1, 0,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)
-				    0,
-#endif
-				    key, lock_name);
-#else
 	wq = __alloc_workqueue_key(n->name, flags, max_active, key, lock_name);
-#endif
 	if (!wq) {
 		kfree(n);
 		return NULL;
backport/compat/compat-3.8.c +0 -13
index 49dc44bd4664..a318c15bd775 100644
@@ -333,37 +333,24 @@ bool hid_ignore(struct hid_device *hdev)
 			return true;
 		break;
 	case USB_VENDOR_ID_JESS:
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
 		if (hdev->product == USB_DEVICE_ID_JESS_YUREX &&
 				hdev->type == HID_TYPE_USBNONE)
 			return true;
-#else
-		if (hdev->product == USB_DEVICE_ID_JESS_YUREX)
-			return true;
-#endif
 		break;
 	case USB_VENDOR_ID_DWAV:
 		/* These are handled by usbtouchscreen. hdev->type is probably
 		 * HID_TYPE_USBNONE, but we say !HID_TYPE_USBMOUSE to match
 		 * usbtouchscreen. */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
 		if ((hdev->product == USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER ||
 		     hdev->product == USB_DEVICE_ID_DWAV_TOUCHCONTROLLER) &&
 		    hdev->type != HID_TYPE_USBMOUSE)
 			return true;
-#else
-		if (hdev->product == USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER ||
-		     hdev->product == USB_DEVICE_ID_DWAV_TOUCHCONTROLLER)
-			return true;
-#endif
 		break;
 	}
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
 	if (hdev->type == HID_TYPE_USBMOUSE &&
 			hid_match_id(hdev, hid_mouse_ignore_list))
 		return true;
-#endif
 
 	return !!hid_match_id(hdev, hid_ignore_list);
 }
Signature · 1 line
1.9.0