backports: dissolve compat-2.6.37.h
authorJohannes Berg <johannes.berg@intel.com>
Fri, 12 Apr 2013 10:20:45 +0000 (12:20 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 15 Apr 2013 09:32:47 +0000 (11:32 +0200)
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
14 files changed:
backport/backport-include/linux/compat-2.6.37.h [deleted file]
backport/backport-include/linux/in.h
backport/backport-include/linux/kernel.h
backport/backport-include/linux/leds.h
backport/backport-include/linux/mmc/sdio_ids.h [new file with mode: 0644]
backport/backport-include/linux/netdevice.h
backport/backport-include/linux/rculist.h
backport/backport-include/linux/rcupdate.h
backport/backport-include/linux/rtnetlink.h [new file with mode: 0644]
backport/backport-include/linux/skbuff.h
backport/backport-include/linux/vmalloc.h [new file with mode: 0644]
backport/backport-include/linux/workqueue.h
backport/backport-include/net/genetlink.h
backport/backport-include/pcmcia/ds.h

diff --git a/backport/backport-include/linux/compat-2.6.37.h b/backport/backport-include/linux/compat-2.6.37.h
deleted file mode 100644 (file)
index 317ae6f..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-#ifndef LINUX_26_37_COMPAT_H
-#define LINUX_26_37_COMPAT_H
-
-#include <linux/version.h>
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
-
-#include <linux/skbuff.h>
-#include <linux/leds.h>
-#include <linux/in.h>
-#include <linux/errno.h>
-#include <linux/netdevice.h>
-
-#ifdef CONFIG_RPS
-extern int netif_set_real_num_rx_queues(struct net_device *dev,
-                                       unsigned int rxq);
-#else
-static inline int netif_set_real_num_rx_queues(struct net_device *dev,
-                                              unsigned int rxq)
-{
-       return 0;
-}
-#endif
-
-static inline int proto_ports_offset(int proto)
-{
-       switch (proto) {
-       case IPPROTO_TCP:
-       case IPPROTO_UDP:
-       case IPPROTO_DCCP:
-       case IPPROTO_ESP:       /* SPI */
-       case IPPROTO_SCTP:
-       case IPPROTO_UDPLITE:
-               return 0;
-       case IPPROTO_AH:        /* SPI */
-               return 4;
-       default:
-               return -EINVAL;
-       }
-}
-
-#define SDIO_CLASS_BT_AMP      0x09    /* Type-A Bluetooth AMP interface */
-
-#define net_ns_type_operations LINUX_BACKPORT(net_ns_type_operations)
-extern struct kobj_ns_type_operations net_ns_type_operations;
-
-/* mask skb_checksum_none_assert as RHEL6 backports this */
-#define skb_checksum_none_assert(a) compat_skb_checksum_none_assert(a)
-
-/**
- * skb_checksum_none_assert - make sure skb ip_summed is CHECKSUM_NONE
- * @skb: skb to check
- *
- * fresh skbs have their ip_summed set to CHECKSUM_NONE.
- * Instead of forcing ip_summed to CHECKSUM_NONE, we can
- * use this helper, to document places where we make this assertion.
- */
-static inline void skb_checksum_none_assert(struct sk_buff *skb)
-{
-#ifdef DEBUG
-       BUG_ON(skb->ip_summed != CHECKSUM_NONE);
-#endif
-}
-
-#define pcmcia_enable_device(link)     pcmcia_request_configuration(link, &link->conf)
-
-#include <net/genetlink.h>
-
-struct compat_genl_info {
-       struct genl_info *info;
-
-       u32 snd_seq;
-       u32 snd_pid;
-       struct genlmsghdr *genlhdr;
-       struct nlattr **attrs;
-       void *user_ptr[2];
-};
-#define genl_info compat_genl_info
-
-struct compat_genl_ops {
-       struct genl_ops ops;
-
-       u8 cmd;
-       u8 internal_flags;
-       unsigned int flags;
-       const struct nla_policy *policy;
-
-       int (*doit)(struct sk_buff *skb, struct genl_info *info);
-       int (*dumpit)(struct sk_buff *skb, struct netlink_callback *cb);
-       int (*done)(struct netlink_callback *cb);
-};
-#define genl_ops compat_genl_ops
-
-struct compat_genl_family {
-       struct genl_family family;
-
-       struct list_head list;
-
-       unsigned int id, hdrsize, version, maxattr;
-       const char *name;
-       bool netnsok;
-
-       struct nlattr **attrbuf;
-
-       int (*pre_doit)(struct genl_ops *ops, struct sk_buff *skb,
-                       struct genl_info *info);
-
-       void (*post_doit)(struct genl_ops *ops, struct sk_buff *skb,
-                         struct genl_info *info);
-};
-
-#define genl_family compat_genl_family
-
-#define genl_register_family_with_ops compat_genl_register_family_with_ops
-
-int genl_register_family_with_ops(struct genl_family *family,
-                                 struct genl_ops *ops, size_t n_ops);
-
-#define genl_unregister_family compat_genl_unregister_family
-
-int genl_unregister_family(struct genl_family *family);
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
-#define genl_info_net(_info) genl_info_net((_info)->info)
-#endif
-
-#define genlmsg_reply(_msg, _info) genlmsg_reply(_msg, (_info)->info)
-#define genlmsg_put(_skb, _pid, _seq, _fam, _flags, _cmd) genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd)
-#define genl_register_mc_group(_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp)
-#define genl_unregister_mc_group(_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp)
-
-
-extern void led_blink_set(struct led_classdev *led_cdev,
-                         unsigned long *delay_on,
-                         unsigned long *delay_off);
-
-#define led_classdev_unregister compat_led_classdev_unregister
-extern void compat_led_classdev_unregister(struct led_classdev *led_cdev);
-
-#define led_brightness_set compat_led_brightness_set
-extern void compat_led_brightness_set(struct led_classdev *led_cdev,
-                                     enum led_brightness brightness);
-
-#define alloc_ordered_workqueue(name, flags) create_singlethread_workqueue(name)
-
-#define netdev_refcnt_read(a) atomic_read(&a->refcnt)
-
-#define vzalloc LINUX_BACKPORT(vzalloc)
-extern void *vzalloc(unsigned long size);
-
-#define rtnl_dereference(p)                                     \
-        rcu_dereference_protected(p, lockdep_rtnl_is_held())
-
-/**
- * RCU_INIT_POINTER() - initialize an RCU protected pointer
- *
- * Initialize an RCU-protected pointer in such a way to avoid RCU-lockdep
- * splats.
- */
-#define RCU_INIT_POINTER(p, v) \
-               p = (typeof(*v) __force __rcu *)(v)
-
-static inline bool skb_has_frag_list(const struct sk_buff *skb)
-{
-       return skb_shinfo(skb)->frag_list != NULL;
-}
-
-/**
- * backport:
- *
- * commit 67bdbffd696f29a0b68aa8daa285783a06651583
- * Author: Arnd Bergmann <arnd@arndb.de>
- * Date:   Thu Feb 25 16:55:13 2010 +0100
- *
- *     rculist: avoid __rcu annotations
- */
-#define hlist_first_rcu(head)  (*((struct hlist_node __rcu **)(&(head)->first)))
-#define hlist_next_rcu(node)   (*((struct hlist_node __rcu **)(&(node)->next)))
-
-#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */
-
-#endif /* LINUX_26_37_COMPAT_H */
index 5cca155d264007dc63daa1fafaff5f02e2090d1d..f019e0a0152a8ac695c6c68e9dff72afbf9a3cb9 100644 (file)
@@ -72,4 +72,23 @@ static inline bool ipv4_is_test_198(__be32 addr)
 }
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
+static inline int proto_ports_offset(int proto)
+{
+       switch (proto) {
+       case IPPROTO_TCP:
+       case IPPROTO_UDP:
+       case IPPROTO_DCCP:
+       case IPPROTO_ESP:       /* SPI */
+       case IPPROTO_SCTP:
+       case IPPROTO_UDPLITE:
+               return 0;
+       case IPPROTO_AH:        /* SPI */
+               return 4;
+       default:
+               return -EINVAL;
+       }
+}
+#endif
+
 #endif /* __BACKPORT_IN_H */
index c41ea1b3451961f8b3f8bac86e86d2b9fe0586b1..5fdcdc027caf1d209843b287540f9499fbaa3d77 100644 (file)
@@ -2,6 +2,11 @@
 #define __BACKPORT_KERNEL_H
 #include_next <linux/kernel.h>
 #include <linux/version.h>
+/*
+ * some older kernels don't have this and thus don't
+ * include it from kernel.h like new kernels
+ */
+#include <linux/printk.h>
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25))
 /**
index 17fc89e56f50db516b5b181b4a0354672ba7ad13..a758c8ea6c9c9fb9841f1d385f2af349f20556f1 100644 (file)
 #define led_set_brightness(_dev, _switch) led_brightness_set(_dev, _switch)
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
+extern void led_blink_set(struct led_classdev *led_cdev,
+                         unsigned long *delay_on,
+                         unsigned long *delay_off);
+
+#define led_classdev_unregister compat_led_classdev_unregister
+extern void compat_led_classdev_unregister(struct led_classdev *led_cdev);
+
+#define led_brightness_set compat_led_brightness_set
+extern void compat_led_brightness_set(struct led_classdev *led_cdev,
+                                     enum led_brightness brightness);
+#endif
+
 #endif /* __BACKPORT_LINUX_LEDS_H */
diff --git a/backport/backport-include/linux/mmc/sdio_ids.h b/backport/backport-include/linux/mmc/sdio_ids.h
new file mode 100644 (file)
index 0000000..3223fca
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __BACKPORT_MMC_SDIO_IDS_H
+#define __BACKPORT_MMC_SDIO_IDS_H
+#include <linux/version.h>
+#include_next <linux/mmc/sdio_ids.h>
+
+#ifndef SDIO_CLASS_BT_AMP
+#define SDIO_CLASS_BT_AMP      0x09    /* Type-A Bluetooth AMP interface */
+#endif
+
+#endif /* __BACKPORT_MMC_SDIO_IDS_H */
index 4f13782707bbb21416741c0739bb4e8b3460a966..72cd5041fb981d7ecf8ba140a756718223a9adca 100644 (file)
@@ -93,4 +93,22 @@ static inline int register_netdevice_name(struct net_device *dev)
                        max_t(unsigned int, txqs, rxqs))
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
+#define netdev_refcnt_read(a) atomic_read(&a->refcnt)
+
+#define net_ns_type_operations LINUX_BACKPORT(net_ns_type_operations)
+extern struct kobj_ns_type_operations net_ns_type_operations;
+
+#ifdef CONFIG_RPS
+extern int netif_set_real_num_rx_queues(struct net_device *dev,
+                                       unsigned int rxq);
+#else
+static inline int netif_set_real_num_rx_queues(struct net_device *dev,
+                                              unsigned int rxq)
+{
+       return 0;
+}
+#endif
+#endif /* < 2.6.37 */
+
 #endif /* __BACKPORT_NETDEVICE_H */
index 0f5eaf1f85d937a2bdf2cee7951ffbbefa7b0a87..38afa4b8b4b5851bf08bf480fa621c3d48f9417b 100644 (file)
        macro_dispatcher(hlist_for_each_entry_rcu, __VA_ARGS__)(__VA_ARGS__)
 #endif /* < 3.9 */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
+/**
+ * backport:
+ *
+ * commit 67bdbffd696f29a0b68aa8daa285783a06651583
+ * Author: Arnd Bergmann <arnd@arndb.de>
+ * Date:   Thu Feb 25 16:55:13 2010 +0100
+ *
+ *     rculist: avoid __rcu annotations
+ */
+#define hlist_first_rcu(head)  (*((struct hlist_node __rcu **)(&(head)->first)))
+#define hlist_next_rcu(node)   (*((struct hlist_node __rcu **)(&(node)->next)))
+
+#endif /* < 2.6.37 */
+
 #endif /* __BACKPORT_RCULIST_H */
index 9bfa93983f20ce229150887ed16896cbae2968cd..5770b11dbc2a0fb74484c3c7d075bab8a0f9d094 100644 (file)
@@ -21,4 +21,9 @@
        } while (0)
 #endif
 
+#ifndef RCU_INIT_POINTER
+#define RCU_INIT_POINTER(p, v) \
+               p = (typeof(*v) __force __rcu *)(v)
+#endif
+
 #endif /* __BACKPORT_LINUX_RCUPDATE_H */
diff --git a/backport/backport-include/linux/rtnetlink.h b/backport/backport-include/linux/rtnetlink.h
new file mode 100644 (file)
index 0000000..b765cc8
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __BACKPORT_LINUX_RTNETLINK_H
+#define __BACKPORT_LINUX_RTNETLINK_H
+#include_next <linux/rtnetlink.h>
+
+#ifndef rtnl_dereference
+#define rtnl_dereference(p)                                     \
+        rcu_dereference_protected(p, lockdep_rtnl_is_held())
+#endif
+
+#endif /* __BACKPORT_LINUX_RTNETLINK_H */
index 2ad361265bbc630d32ecdb0771676aa2eaec9d22..52f134536b9a7e867e1d7960fb52b59249805402 100644 (file)
@@ -75,4 +75,20 @@ static inline int skb_checksum_start_offset(const struct sk_buff *skb)
 }
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
+static inline bool skb_has_frag_list(const struct sk_buff *skb)
+{
+       return skb_shinfo(skb)->frag_list != NULL;
+}
+
+#define skb_checksum_none_assert LINUX_BACKPORT(skb_checksum_none_assert)
+
+static inline void skb_checksum_none_assert(struct sk_buff *skb)
+{
+#ifdef DEBUG
+       BUG_ON(skb->ip_summed != CHECKSUM_NONE);
+#endif
+}
+#endif /* < 2.6.37 */
+
 #endif /* __BACKPORT_SKBUFF_H */
diff --git a/backport/backport-include/linux/vmalloc.h b/backport/backport-include/linux/vmalloc.h
new file mode 100644 (file)
index 0000000..c47536f
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef __BACKPORT_LINUX_VMALLOC_H
+#define __BACKPORT_LINUX_VMALLOC_H
+#include_next <linux/vmalloc.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
+#define vzalloc LINUX_BACKPORT(vzalloc)
+extern void *vzalloc(unsigned long size);
+#endif
+
+#endif /* __BACKPORT_LINUX_VMALLOC_H */
index f908afbdaec65a16b44edd3d2a37ec2f1219d666..cc50966e47ed7ab4b3167aceb32f416ecb58dec6 100644 (file)
@@ -14,4 +14,8 @@ bool mod_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork,
 #define create_freezable_workqueue create_freezeable_workqueue
 #endif
 
+#ifndef alloc_ordered_workqueue
+#define alloc_ordered_workqueue(name, flags) create_singlethread_workqueue(name)
+#endif
+
 #endif /* __BACKPORT_LINUX_WORKQUEUE_H */
index 630ef898b5de50a16b301c9314180482ece41471..0e10936bc05e4b59b428ebf99daa882730749380 100644 (file)
 #define genl_dump_check_consistent(cb, user_hdr, family)
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
+struct compat_genl_info {
+       struct genl_info *info;
+
+       u32 snd_seq;
+       u32 snd_pid;
+       struct genlmsghdr *genlhdr;
+       struct nlattr **attrs;
+       void *user_ptr[2];
+};
+#define genl_info compat_genl_info
+
+struct compat_genl_ops {
+       struct genl_ops ops;
+
+       u8 cmd;
+       u8 internal_flags;
+       unsigned int flags;
+       const struct nla_policy *policy;
+
+       int (*doit)(struct sk_buff *skb, struct genl_info *info);
+       int (*dumpit)(struct sk_buff *skb, struct netlink_callback *cb);
+       int (*done)(struct netlink_callback *cb);
+};
+#define genl_ops compat_genl_ops
+
+struct compat_genl_family {
+       struct genl_family family;
+
+       struct list_head list;
+
+       unsigned int id, hdrsize, version, maxattr;
+       const char *name;
+       bool netnsok;
+
+       struct nlattr **attrbuf;
+
+       int (*pre_doit)(struct genl_ops *ops, struct sk_buff *skb,
+                       struct genl_info *info);
+
+       void (*post_doit)(struct genl_ops *ops, struct sk_buff *skb,
+                         struct genl_info *info);
+};
+
+#define genl_family compat_genl_family
+
+#define genl_register_family_with_ops compat_genl_register_family_with_ops
+
+int genl_register_family_with_ops(struct genl_family *family,
+                                 struct genl_ops *ops, size_t n_ops);
+
+#define genl_unregister_family compat_genl_unregister_family
+
+int genl_unregister_family(struct genl_family *family);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
+#define genl_info_net(_info) genl_info_net((_info)->info)
+#endif
+
+#define genlmsg_reply(_msg, _info) genlmsg_reply(_msg, (_info)->info)
+#define genlmsg_put(_skb, _pid, _seq, _fam, _flags, _cmd) genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd)
+#define genl_register_mc_group(_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp)
+#define genl_unregister_mc_group(_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp)
+#endif /* < 2.6.37 */
+
 #endif /* __BACKPORT_NET_GENETLINK_H */
index 45ab33a659fbbe3c1ea9e405cf6ca457d214c840..02f851f441529557dabf08672434194c7a9b8bf1 100644 (file)
@@ -26,4 +26,8 @@
                        pcmcia_unregister_driver)
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
+#define pcmcia_enable_device(link)     pcmcia_request_configuration(link, &link->conf)
+#endif
+
 #endif /* __BACKPORT_PCMCIA_DS_H */