Skip to contentSkip to conversation

compat: support building on RHEL 6 kernels

PATCH New John W. Linville 1 participant 1 message Nov 12, 2010 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 compat: support building on RHEL 6 kernels

RHEL kernels in general (and RHEL 6 kernels in particular) often contain features backported from later upstream kernels. This means that the normal KERNEL_VERSION checks are not always correct for RHEL kernels. This patch augments a number of such tests to be compatible with building compat-wireless on RHEL 6 kernels.

---
This patch contains the general compat portions...

compat/compat_firmware_class.c renamed from compat/compat_firmware_class.c.orig +12 -0
diff -up compat-wireless-2.6.36-4/compat/compat_firmware_class.c.orig compat-wireless-2.6.36-4/compat/compat_firmware_class.c
@@ -314,9 +314,15 @@ static ssize_t firmware_loading_store(st
 
 static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store);
 
+#if !defined(RHEL_MAJOR) || (RHEL_MAJOR != 6)
 static ssize_t firmware_data_read(struct kobject *kobj,
 				  struct bin_attribute *bin_attr,
 				  char *buffer, loff_t offset, size_t count)
+#else
+static ssize_t firmware_data_read(struct file *filp, struct kobject *kobj,
+				  struct bin_attribute *bin_attr,
+				  char *buffer, loff_t offset, size_t count)
+#endif
 {
 	struct device *dev = to_dev(kobj);
 	struct firmware_priv *fw_priv = to_firmware_priv(dev);
@@ -407,9 +413,15 @@ static int fw_realloc_buffer(struct firm
  *	Data written to the 'data' attribute will be later handed to
  *	the driver as a firmware image.
  **/
+#if !defined(RHEL_MAJOR) || (RHEL_MAJOR != 6)
 static ssize_t firmware_data_write(struct kobject *kobj,
 				   struct bin_attribute *bin_attr,
 				   char *buffer, loff_t offset, size_t count)
+#else
+static ssize_t firmware_data_write(struct file *filp, struct kobject *kobj,
+				   struct bin_attribute *bin_attr,
+				   char *buffer, loff_t offset, size_t count)
+#endif
 {
 	struct device *dev = to_dev(kobj);
 	struct firmware_priv *fw_priv = to_firmware_priv(dev);
include/linux/compat-2.6.33.h renamed from include/linux/compat-2.6.33.h.orig +4 -0
diff -up compat-wireless-2.6.36-4/include/linux/compat-2.6.33.h.orig compat-wireless-2.6.36-4/include/linux/compat-2.6.33.h
@@ -47,7 +47,9 @@ static inline void compat_release_firmwa
 }
 #endif
 
+#if (!defined(RHEL_MAJOR) || (RHEL_MAJOR != 6))
 #define KEY_RFKILL		247	/* Key that controls all radios */
+#endif
 
 #define IFF_DONT_BRIDGE 0x800		/* disallow bridging this ether dev */
 /* source: include/linux/if.h */
@@ -55,6 +57,7 @@ static inline void compat_release_firmwa
 /* this will never happen on older kernels */
 #define NETDEV_POST_INIT 0xffff
 
+#if (!defined(RHEL_MAJOR) || (RHEL_MAJOR != 6))
 static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
                 unsigned int length)
 {
@@ -64,6 +67,7 @@ static inline struct sk_buff *netdev_all
 		skb_reserve(skb, NET_IP_ALIGN);
 	return skb;
 }
+#endif
 
 #if defined(CONFIG_PCCARD) || defined(CONFIG_PCCARD_MODULE)
 
include/linux/compat-2.6.34.h renamed from include/linux/compat-2.6.34.h.orig +2 -0
diff -up compat-wireless-2.6.36-4/include/linux/compat-2.6.34.h.orig compat-wireless-2.6.36-4/include/linux/compat-2.6.34.h
@@ -19,12 +19,14 @@
 
 /* netdev_printk helpers, similar to dev_printk */
 
+#if (!defined(RHEL_MAJOR) || (RHEL_MAJOR != 6))
 static inline const char *netdev_name(const struct net_device *dev)
 {
 	if (dev->reg_state != NETREG_REGISTERED)
 		return "(unregistered net_device)";
 	return dev->name;
 }
+#endif
 
 #define netdev_printk(level, netdev, format, args...)		\
 	dev_printk(level, (netdev)->dev.parent,			\
Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.