2011-11-17 22:22:16

by John W. Linville

[permalink] [raw]
Subject: [PATCH v2 1/4] compat: use separate CONFIG_COMPAT_KFIFO option for building kfifo.o

Signed-off-by: John W. Linville <[email protected]>
---
compat/Makefile | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/compat/Makefile b/compat/Makefile
index 2fb1893..fc43ba1 100644
--- a/compat/Makefile
+++ b/compat/Makefile
@@ -24,9 +24,9 @@ compat-$(CONFIG_COMPAT_KERNEL_2_6_29) += compat-2.6.29.o
compat-$(CONFIG_COMPAT_KERNEL_2_6_32) += compat-2.6.32.o
compat-$(CONFIG_COMPAT_KERNEL_2_6_33) += compat-2.6.33.o
compat-$(CONFIG_COMPAT_KERNEL_2_6_35) += compat-2.6.35.o
-compat-$(CONFIG_COMPAT_KERNEL_2_6_36) += \
- compat-2.6.36.o \
- kfifo.o
+compat-$(CONFIG_COMPAT_KERNEL_2_6_36) += compat-2.6.36.o
+
+compat-$(CONFIG_COMPAT_KFIFO) += kfifo.o

compat-$(CONFIG_COMPAT_KERNEL_2_6_37) += compat-2.6.37.o
compat-$(CONFIG_COMPAT_KERNEL_2_6_38) += compat-2.6.38.o
--
1.7.4.4



2011-11-17 23:31:43

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] compat: support RHEL6 as a build target

On Thu, Nov 17, 2011 at 2:20 PM, John W. Linville
<[email protected]> wrote:
> This patch enables compatibility with RHEL6 as a build target, mostly
> with simple tricks similar to what was added for compatibility with
> Debian Squeeze.
>
> Signed-off-by: John W. Linville <[email protected]>

Thanks for the very sexy respin! I've applied all of them on both
compat-wireless.git and compat.git.

Luis

2011-11-17 22:22:16

by John W. Linville

[permalink] [raw]
Subject: [PATCH v2 4/4] compat: support RHEL6 as a build target

This patch enables compatibility with RHEL6 as a build target, mostly
with simple tricks similar to what was added for compatibility with
Debian Squeeze.

Signed-off-by: John W. Linville <[email protected]>
---
compat/compat-2.6.35.c | 4 ++--
compat/compat-2.6.37.c | 4 ++--
include/linux/compat-2.6.33.h | 7 +++++++
include/linux/compat-2.6.34.h | 19 +++++++++++++++++++
include/linux/compat-2.6.35.h | 3 +++
include/linux/compat-2.6.36.h | 3 +++
include/linux/compat-2.6.37.h | 6 ++++++
7 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/compat/compat-2.6.35.c b/compat/compat-2.6.35.c
index 44a15d6..7a31a54 100644
--- a/compat/compat-2.6.35.c
+++ b/compat/compat-2.6.35.c
@@ -18,7 +18,7 @@
* hex_to_bin() converts one hex digit to its actual value or -1 in case of bad
* input.
*/
-int hex_to_bin(char ch)
+int compat_hex_to_bin(char ch)
{
if ((ch >= '0') && (ch <= '9'))
return ch - '0';
@@ -27,7 +27,7 @@ int hex_to_bin(char ch)
return ch - 'a' + 10;
return -1;
}
-EXPORT_SYMBOL(hex_to_bin);
+EXPORT_SYMBOL(compat_hex_to_bin);

/**
* noop_llseek - No Operation Performed llseek implementation
diff --git a/compat/compat-2.6.37.c b/compat/compat-2.6.37.c
index 257880e..d7259bb 100644
--- a/compat/compat-2.6.37.c
+++ b/compat/compat-2.6.37.c
@@ -345,7 +345,7 @@ EXPORT_SYMBOL(compat_led_classdev_unregister);
* For tight control over page level allocator and protection flags
* use __vmalloc() instead.
*/
-void *vzalloc(unsigned long size)
+void *compat_vzalloc(unsigned long size)
{
void *buf;
buf = vmalloc(size);
@@ -353,6 +353,6 @@ void *vzalloc(unsigned long size)
memset(buf, 0, size);
return buf;
}
-EXPORT_SYMBOL(vzalloc);
+EXPORT_SYMBOL(compat_vzalloc);

#endif
diff --git a/include/linux/compat-2.6.33.h b/include/linux/compat-2.6.33.h
index e9e888a..c900a6f 100644
--- a/include/linux/compat-2.6.33.h
+++ b/include/linux/compat-2.6.33.h
@@ -13,6 +13,7 @@
#include <pcmcia/ds.h>
#endif
#include <linux/firmware.h>
+#include <linux/input.h>

#if defined(CONFIG_COMPAT_FIRMWARE_CLASS)
#define release_firmware compat_release_firmware
@@ -49,7 +50,10 @@ static inline void compat_release_firmware(const struct firmware *fw)
}
#endif

+/* mask KEY_RFKILL as RHEL6 backports this */
+#if !defined(KEY_RFKILL)
#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 */
@@ -131,6 +135,9 @@ static inline int pci_pcie_cap(struct pci_dev *dev)
return pci_find_capability(dev, PCI_CAP_ID_EXP);
}

+/* mask pci_is_pcie as RHEL6 backports this */
+#define pci_is_pcie(a) compat_pci_is_pcie(a)
+
/**
* pci_is_pcie - check if the PCI device is PCI Express capable
* @dev: PCI device
diff --git a/include/linux/compat-2.6.34.h b/include/linux/compat-2.6.34.h
index 562ccf7..a9c9dd1 100644
--- a/include/linux/compat-2.6.34.h
+++ b/include/linux/compat-2.6.34.h
@@ -46,6 +46,9 @@
#define netdev_info(dev, format, args...) \
netdev_printk(KERN_INFO, dev, format, ##args)

+/* mask netdev_dbg as RHEL6 backports this */
+#if !defined(netdev_dbg)
+
#if defined(DEBUG)
#define netdev_dbg(__dev, format, args...) \
netdev_printk(KERN_DEBUG, __dev, format, ##args)
@@ -64,6 +67,11 @@ do { \
})
#endif

+#endif
+
+/* mask netdev_vdbg as RHEL6 backports this */
+#if !defined(netdev_dbg)
+
#if defined(VERBOSE_DEBUG)
#define netdev_vdbg netdev_dbg
#else
@@ -76,6 +84,8 @@ do { \
})
#endif

+#endif
+
/*
* netdev_WARN() acts like dev_printk(), but with the key difference
* of using a WARN/WARN_ON to get the message out, including the
@@ -107,6 +117,9 @@ do { \
#define netif_info(priv, type, dev, fmt, args...) \
netif_printk(priv, type, KERN_INFO, (dev), fmt, ##args)

+/* mask netif_dbg as RHEL6 backports this */
+#if !defined(netif_dbg)
+
#if defined(DEBUG)
#define netif_dbg(priv, type, dev, format, args...) \
netif_printk(priv, type, KERN_DEBUG, dev, format, ##args)
@@ -127,6 +140,11 @@ do { \
})
#endif

+#endif
+
+/* mask netif_vdbg as RHEL6 backports this */
+#if !defined(netif_vdbg)
+
#if defined(VERBOSE_DEBUG)
#define netif_vdbg netdev_dbg
#else
@@ -137,6 +155,7 @@ do { \
0; \
})
#endif
+#endif
/* source: include/linux/netdevice.h */


diff --git a/include/linux/compat-2.6.35.h b/include/linux/compat-2.6.35.h
index 857a521..5e43002 100644
--- a/include/linux/compat-2.6.35.h
+++ b/include/linux/compat-2.6.35.h
@@ -26,6 +26,9 @@ static inline wait_queue_head_t *sk_sleep(struct sock *sk)

#define sdio_writeb_readb(func, write_byte, addr, err_ret) sdio_readb(func, addr, err_ret)

+/* mask hex_to_bin as RHEL6 backports this */
+#define hex_to_bin(a) compat_hex_to_bin(a)
+
int hex_to_bin(char ch);

extern loff_t noop_llseek(struct file *file, loff_t offset, int origin);
diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
index 29ade27..b5d9975 100644
--- a/include/linux/compat-2.6.36.h
+++ b/include/linux/compat-2.6.36.h
@@ -14,6 +14,9 @@
#define kparam_block_sysfs_write(a)
#define kparam_unblock_sysfs_write(a)

+/* mask va_format as RHEL6 backports this */
+#define va_format compat_va_format
+
struct va_format {
const char *fmt;
va_list *va;
diff --git a/include/linux/compat-2.6.37.h b/include/linux/compat-2.6.37.h
index d375746..c19e781 100644
--- a/include/linux/compat-2.6.37.h
+++ b/include/linux/compat-2.6.37.h
@@ -12,6 +12,9 @@

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
@@ -110,6 +113,9 @@ extern void compat_led_brightness_set(struct led_classdev *led_cdev,

#define netdev_refcnt_read(a) atomic_read(&a->refcnt)

+/* mask vzalloc as RHEL6 backports this */
+#define vzalloc(a) compat_vzalloc(a)
+
extern void *vzalloc(unsigned long size);

#define rtnl_dereference(p) \
--
1.7.4.4


2011-11-17 22:22:15

by John W. Linville

[permalink] [raw]
Subject: [PATCH v2 3/4] compat: check CONFIG_COMPAT_FIRMWARE_CLASS in compat-2.6.33.h

If a pre-2.6.33 kernel has backported suitable firmware loader
functionality, then it doesn't need the compat_firmware_class. In that
case, compat-2.6.33 should not redefine the *_firmware function names.

Signed-off-by: John W. Linville <[email protected]>
---
include/linux/compat-2.6.33.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/compat-2.6.33.h b/include/linux/compat-2.6.33.h
index 539b469..e9e888a 100644
--- a/include/linux/compat-2.6.33.h
+++ b/include/linux/compat-2.6.33.h
@@ -14,9 +14,11 @@
#endif
#include <linux/firmware.h>

+#if defined(CONFIG_COMPAT_FIRMWARE_CLASS)
#define release_firmware compat_release_firmware
#define request_firmware compat_request_firmware
#define request_firmware_nowait compat_request_firmware_nowait
+#endif

#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
int compat_request_firmware(const struct firmware **fw, const char *name,
--
1.7.4.4


2011-11-17 22:22:16

by John W. Linville

[permalink] [raw]
Subject: [PATCH v2 2/4] compat: add CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP

Some kernels have versions of (struct bin_attribute)->{read,write}
that require a struct file * as their first argument. This change
accommodates them in the firmware loader class.

Signed-off-by: John W. Linville <[email protected]>
---
compat/compat_firmware_class.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/compat/compat_firmware_class.c b/compat/compat_firmware_class.c
index 79cd543..4eb5ba7 100644
--- a/compat/compat_firmware_class.c
+++ b/compat/compat_firmware_class.c
@@ -314,9 +314,15 @@ static ssize_t firmware_loading_store(struct device *dev,

static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store);

+#if defined(CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP)
+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)
+#else
static ssize_t firmware_data_read(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 firmware_priv *fw_priv, int min_size)
* Data written to the 'data' attribute will be later handed to
* the driver as a firmware image.
**/
+#if defined(CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP)
+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)
+#else
static ssize_t firmware_data_write(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);
--
1.7.4.4