2012-08-09 04:41:20

by Andy Gospodarek

[permalink] [raw]
Subject: [PATCH v2] compat: support RHEL6.3 as a build target

This patch allows me to compile and load the latest compat modules on
RHEL6.3. Users of compat on RHEL6 should note that you should set
CONFIG_COMPAT_KFIFO=n as those bits are not needed at all.

These changes seem to pass built-in tests on my system:

# ./bin/ckmake
Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

Signed-off-by: Andy Gospodarek <[email protected]>
---
compat/compat-2.6.38.c | 8 ++++----
compat/compat-3.1.c | 22 +++++++++++-----------
include/linux/compat-2.6.33.h | 6 ++++++
include/linux/compat-2.6.34.h | 6 ++++++
include/linux/compat-2.6.35.h | 5 +++++
include/linux/compat-2.6.36.h | 2 ++
include/linux/compat-2.6.38.h | 6 ++++++
include/linux/compat-3.1.h | 12 ++++++++++++
include/linux/compat-3.2.h | 9 +++++++++
include/linux/compat-3.3.h | 2 ++
10 files changed, 63 insertions(+), 15 deletions(-)

diff --git a/compat/compat-2.6.38.c b/compat/compat-2.6.38.c
index 0074ac6..b546194 100644
--- a/compat/compat-2.6.38.c
+++ b/compat/compat-2.6.38.c
@@ -22,14 +22,14 @@
*
* Initialize the EWMA parameters for a given struct ewma @avg.
*/
-void ewma_init(struct ewma *avg, unsigned long factor, unsigned long weight)
+void compat_ewma_init(struct ewma *avg, unsigned long factor, unsigned long weight)
{
WARN_ON(weight <= 1 || factor == 0);
avg->internal = 0;
avg->weight = weight;
avg->factor = factor;
}
-EXPORT_SYMBOL_GPL(ewma_init);
+EXPORT_SYMBOL_GPL(compat_ewma_init);

/**
* ewma_add() - Exponentially weighted moving average (EWMA)
@@ -38,7 +38,7 @@ EXPORT_SYMBOL_GPL(ewma_init);
*
* Add a sample to the average.
*/
-struct ewma *ewma_add(struct ewma *avg, unsigned long val)
+struct ewma *compat_ewma_add(struct ewma *avg, unsigned long val)
{
avg->internal = avg->internal ?
(((avg->internal * (avg->weight - 1)) +
@@ -46,5 +46,5 @@ struct ewma *ewma_add(struct ewma *avg, unsigned long val)
(val * avg->factor);
return avg;
}
-EXPORT_SYMBOL_GPL(ewma_add);
+EXPORT_SYMBOL_GPL(compat_ewma_add);

diff --git a/compat/compat-3.1.c b/compat/compat-3.1.c
index e81a3e7..03735f6 100644
--- a/compat/compat-3.1.c
+++ b/compat/compat-3.1.c
@@ -19,7 +19,7 @@
* cpufreq: expose a cpufreq_quick_get_max routine
*/

-unsigned int cpufreq_quick_get_max(unsigned int cpu)
+unsigned int compat_cpufreq_quick_get_max(unsigned int cpu)
{
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
unsigned int ret_freq = 0;
@@ -31,10 +31,10 @@ unsigned int cpufreq_quick_get_max(unsigned int cpu)

return ret_freq;
}
-EXPORT_SYMBOL(cpufreq_quick_get_max);
+EXPORT_SYMBOL(compat_cpufreq_quick_get_max);


-static DEFINE_SPINLOCK(simple_ida_lock);
+static DEFINE_SPINLOCK(compat_simple_ida_lock);

/**
* ida_simple_get - get a new id.
@@ -48,7 +48,7 @@ static DEFINE_SPINLOCK(simple_ida_lock);
*
* Use ida_simple_remove() to get rid of an id.
*/
-int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
+int compat_ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
gfp_t gfp_mask)
{
int ret, id;
@@ -69,7 +69,7 @@ again:
if (!ida_pre_get(ida, gfp_mask))
return -ENOMEM;

- spin_lock_irqsave(&simple_ida_lock, flags);
+ spin_lock_irqsave(&compat_simple_ida_lock, flags);
ret = ida_get_new_above(ida, start, &id);
if (!ret) {
if (id > max) {
@@ -79,29 +79,29 @@ again:
ret = id;
}
}
- spin_unlock_irqrestore(&simple_ida_lock, flags);
+ spin_unlock_irqrestore(&compat_simple_ida_lock, flags);

if (unlikely(ret == -EAGAIN))
goto again;

return ret;
}
-EXPORT_SYMBOL(ida_simple_get);
+EXPORT_SYMBOL(compat_ida_simple_get);

/**
* ida_simple_remove - remove an allocated id.
* @ida: the (initialized) ida.
* @id: the id returned by ida_simple_get.
*/
-void ida_simple_remove(struct ida *ida, unsigned int id)
+void compat_ida_simple_remove(struct ida *ida, unsigned int id)
{
unsigned long flags;

BUG_ON((int)id < 0);
- spin_lock_irqsave(&simple_ida_lock, flags);
+ spin_lock_irqsave(&compat_simple_ida_lock, flags);
ida_remove(ida, id);
- spin_unlock_irqrestore(&simple_ida_lock, flags);
+ spin_unlock_irqrestore(&compat_simple_ida_lock, flags);
}
-EXPORT_SYMBOL(ida_simple_remove);
+EXPORT_SYMBOL(compat_ida_simple_remove);
/* source lib/idr.c */

diff --git a/include/linux/compat-2.6.33.h b/include/linux/compat-2.6.33.h
index 0c71af9..dcdf765 100644
--- a/include/linux/compat-2.6.33.h
+++ b/include/linux/compat-2.6.33.h
@@ -55,11 +55,17 @@ static inline void compat_release_firmware(const struct firmware *fw)
#define KEY_RFKILL 247 /* Key that controls all radios */
#endif

+/* mask IFF_DONT_BRIDGE as RHEL6 backports this */
+#if !defined(IFF_DONT_BRIDGE)
#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
/* source: include/linux/if.h */
+#endif

+/* mask NETDEV_POST_INIT as RHEL6 backports this */
/* this will never happen on older kernels */
+#if !defined(NETDEV_POST_INIT)
#define NETDEV_POST_INIT 0xffff
+#endif

/* mask netdev_alloc_skb_ip_align as debian squeeze also backports this */
#define netdev_alloc_skb_ip_align(a, b) compat_netdev_alloc_skb_ip_align(a, b)
diff --git a/include/linux/compat-2.6.34.h b/include/linux/compat-2.6.34.h
index b8b48c0..6597ec1 100644
--- a/include/linux/compat-2.6.34.h
+++ b/include/linux/compat-2.6.34.h
@@ -30,8 +30,11 @@ void init_compat_mmc_pm_flags(void);
#define netdev_mc_count(dev) ((dev)->mc_count)
#define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0)

+/* mask netdev_for_each_mc_addr as RHEL6 backports this */
+#if !defined(netdev_for_each_mc_addr)
#define netdev_for_each_mc_addr(mclist, dev) \
for (mclist = dev->mc_list; mclist; mclist = mclist->next)
+#endif
/* source: include/linux/netdevice.h */


@@ -235,6 +238,8 @@ do { \
#define sysfs_attr_init(attr) do {} while(0)
#endif

+/* mask sysfs_bin_attr_init as RHEL6 backports this */
+#if !defined(sysfs_bin_attr_init)
/**
* sysfs_bin_attr_init - initialize a dynamically allocated bin_attribute
* @attr: struct bin_attribute to initialize
@@ -246,6 +251,7 @@ do { \
* added to sysfs if you don't have this.
*/
#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr)
+#endif

#define usb_alloc_coherent(dev, size, mem_flags, dma) usb_buffer_alloc(dev, size, mem_flags, dma)
#define usb_free_coherent(dev, size, addr, dma) usb_buffer_free(dev, size, addr, dma)
diff --git a/include/linux/compat-2.6.35.h b/include/linux/compat-2.6.35.h
index 5814123..d184f00 100644
--- a/include/linux/compat-2.6.35.h
+++ b/include/linux/compat-2.6.35.h
@@ -19,6 +19,8 @@

#define netdev_hw_addr dev_mc_list

+/* mask irq_set_affinity_hint as RHEL6 backports this */
+#define irq_set_affinity_hint(a,b) compat_irq_set_affinity_hint(a,b)
/*
* We cannot backport this guy as the IRQ data structure
* was modified in the kernel itself to support this. We
@@ -46,6 +48,9 @@ extern loff_t noop_llseek(struct file *file, loff_t offset, int origin);

#define pm_qos_request(_qos) pm_qos_requirement(_qos)

+/* mask usb_pipe_endpoint as RHEL6 backports this */
+#define usb_pipe_endpoint(a,b) compat_usb_pipe_endpoint(a,b)
+
static inline struct usb_host_endpoint *
usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe)
{
diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
index 56d5961..09e4b6f 100644
--- a/include/linux/compat-2.6.36.h
+++ b/include/linux/compat-2.6.36.h
@@ -98,6 +98,8 @@ struct pm_qos_request_list {
* Dummy printk for disabled debugging statements to use whilst maintaining
* gcc's format and side-effect checking.
*/
+/* mask no_printk as RHEL6 backports this */
+#define no_printk(...) compat_no_printk(...)
static inline __attribute__ ((format (printf, 1, 2)))
int no_printk(const char *s, ...) { return 0; }

diff --git a/include/linux/compat-2.6.38.h b/include/linux/compat-2.6.38.h
index 0a86468..1d72523 100644
--- a/include/linux/compat-2.6.38.h
+++ b/include/linux/compat-2.6.38.h
@@ -55,9 +55,15 @@ struct ewma {
unsigned long weight;
};

+/* mask ewma_init as RHEL6 backports this */
+#define ewma_init(a,b,c) compat_ewma_init(a,b,c)
+
extern void ewma_init(struct ewma *avg, unsigned long factor,
unsigned long weight);

+/* mask ewma_add as RHEL6 backports this */
+#define ewma_add(a,b) compat_ewma_add(a,b)
+
extern struct ewma *ewma_add(struct ewma *avg, unsigned long val);

/**
diff --git a/include/linux/compat-3.1.h b/include/linux/compat-3.1.h
index bf8a4ef..dfd87a3 100644
--- a/include/linux/compat-3.1.h
+++ b/include/linux/compat-3.1.h
@@ -30,6 +30,8 @@ static inline bool ip_is_fragment(const struct iphdr *iph)
return (iph->frag_off & htons(IP_MF | IP_OFFSET)) != 0;
}

+/* mask __netdev_alloc_skb_ip_align as RHEL6 backports this */
+#define __netdev_alloc_skb_ip_align(a,b,c) compat__netdev_alloc_skb_ip_align(a,b,c)
static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
unsigned int length, gfp_t gfp)
{
@@ -98,10 +100,20 @@ static inline void security_sk_clone(const struct sock *sk, struct sock *newsk)
#include <asm-generic/atomic64.h>
#endif

+/* mask ida_simple_get as RHEL6 backports this */
+#define ida_simple_get(a,b,c,d) compat_ida_simple_get(a,b,c,d)
+
int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
gfp_t gfp_mask);
+
+/* mask ida_simple_remove as RHEL6 backports this */
+#define ida_simple_remove(a,b) compat_ida_simple_remove(a,b)
+
void ida_simple_remove(struct ida *ida, unsigned int id);

+/* mask cpufreq_quick_get_max as RHEL6 backports this */
+#define cpufreq_quick_get_max(a) compat_cpufreq_quick_get_max(a)
+
unsigned int cpufreq_quick_get_max(unsigned int cpu);
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) */

diff --git a/include/linux/compat-3.2.h b/include/linux/compat-3.2.h
index ef27566..cde86b5 100644
--- a/include/linux/compat-3.2.h
+++ b/include/linux/compat-3.2.h
@@ -14,6 +14,9 @@

#define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0)

+/* mask skb_frag_page as RHEL6 backports this */
+#define skb_frag_page(a) compat_skb_frag_page(a)
+
/**
* skb_frag_page - retrieve the page refered to by a paged fragment
* @frag: the paged fragment
@@ -25,6 +28,9 @@ static inline struct page *skb_frag_page(const skb_frag_t *frag)
return frag->page;
}

+/* mask skb_frag_dma_map as RHEL6 backports this */
+#define skb_frag_dma_map(a,b,c,d,e) compat_skb_frag_dma_map(a,b,c,d,e)
+
/**
* skb_frag_dma_map - maps a paged fragment via the DMA API
* @device: the device to map the fragment to
@@ -47,6 +53,9 @@ static inline dma_addr_t skb_frag_dma_map(struct device *dev,

#define ETH_P_TDLS 0x890D /* TDLS */

+/* mask skb_frag_size as RHEL6 backports this */
+#define skb_frag_size(a) compat_skb_frag_size(a)
+
static inline unsigned int skb_frag_size(const skb_frag_t *frag)
{
return frag->size;
diff --git a/include/linux/compat-3.3.h b/include/linux/compat-3.3.h
index 620e661..caefdf2 100644
--- a/include/linux/compat-3.3.h
+++ b/include/linux/compat-3.3.h
@@ -10,6 +10,8 @@
#include <linux/skbuff.h>
#include <net/sch_generic.h>

+/* mask qdisc_cb_private_validate as RHEL6 backports this */
+#define qdisc_cb_private_validate(a,b) compat_qdisc_cb_private_validate(a,b)
#if !((LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,9) && LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,23) && LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)))
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37))
static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz)
--
1.7.1



2012-08-10 19:51:54

by Andy Gospodarek

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

On Fri, Aug 10, 2012 at 3:50 PM, Luis R. Rodriguez <[email protected]> wrote:
> On Fri, Aug 10, 2012 at 11:28 AM, Andy Gospodarek <[email protected]> wrote:
>> Did you try the patch I posted last night that has the updated define
>> for no_printk()? I saw the same error until I applied that patch.
>
> Andy, can you post a new patch on a new thread that is rebased on top
> of the latest compat.git master and without putting stuff above the
> patch ?
>
> Luis

Yes I can. You caught me at just the right time as my test build of
compat-wireless-3.5-3 just finished.

2012-08-10 19:50:26

by Luis R. Rodriguez

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

On Fri, Aug 10, 2012 at 11:28 AM, Andy Gospodarek <[email protected]> wrote:
> Did you try the patch I posted last night that has the updated define
> for no_printk()? I saw the same error until I applied that patch.

Andy, can you post a new patch on a new thread that is rebased on top
of the latest compat.git master and without putting stuff above the
patch ?

Luis

2012-08-10 01:27:46

by Luis R. Rodriguez

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

On Thu, Aug 9, 2012 at 6:26 AM, Zefir Kurtisi <[email protected]> wrote:
> @@ -101,7 +101,7 @@ struct pm_qos_request_list {
> /* mask no_printk as RHEL6 backports this */
> #define no_printk(...) compat_no_printk(...)
> static inline __attribute__ ((format (printf, 1, 2)))
> -int no_printk(const char *s, ...) { return 0; }
> +int compat_no_printk(const char *s, ...) { return 0; }

I merged this in. Andy can you review your other changes as Zefir points out?

mcgrof@frijol ~/compat (git::master)$ gcc --version
gcc (Debian 4.7.1-2) 4.7.1
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I suppose we should get ckmake to spit out the version of gcc onto the report.

Luis

2012-08-09 13:26:14

by Zefir Kurtisi

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

On 08/09/2012 06:40 AM, Andy Gospodarek wrote:
> This patch allows me to compile and load the latest compat modules on
> RHEL6.3. Users of compat on RHEL6 should note that you should set
> CONFIG_COMPAT_KFIFO=n as those bits are not needed at all.
>
> [...]
>
> diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
> index 56d5961..09e4b6f 100644
> --- a/include/linux/compat-2.6.36.h
> +++ b/include/linux/compat-2.6.36.h
> @@ -98,6 +98,8 @@ struct pm_qos_request_list {
> * Dummy printk for disabled debugging statements to use whilst maintaining
> * gcc's format and side-effect checking.
> */
> +/* mask no_printk as RHEL6 backports this */
> +#define no_printk(...) compat_no_printk(...)
> static inline __attribute__ ((format (printf, 1, 2)))
> int no_printk(const char *s, ...) { return 0; }
>
> [...]

This at least breaks compilation on 2.6.35-22 with gcc throwing a
compat-2.6.36.h:104: error: ISO C requires a named argument before ‘...’

It looks like no_printk() needs to be renamed to compat_no_printk()
to make it work as intended.

This is a systematic mistake at several sections of this patch, where
the original function needs to be prefixed by 'compat_' to match the
related macro.


---
diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
index 8b02260..b6757c3 100644
--- a/include/linux/compat-2.6.36.h
+++ b/include/linux/compat-2.6.36.h
@@ -101,7 +101,7 @@ struct pm_qos_request_list {
/* mask no_printk as RHEL6 backports this */
#define no_printk(...) compat_no_printk(...)
static inline __attribute__ ((format (printf, 1, 2)))
-int no_printk(const char *s, ...) { return 0; }
+int compat_no_printk(const char *s, ...) { return 0; }

#ifndef alloc_workqueue
#define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active, 0)

2012-08-10 18:28:11

by Andy Gospodarek

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

On Fri, Aug 10, 2012 at 1:18 PM, Hauke Mehrtens <[email protected]> wrote:
> On 08/09/2012 03:26 PM, Zefir Kurtisi wrote:
>> On 08/09/2012 06:40 AM, Andy Gospodarek wrote:
>>> This patch allows me to compile and load the latest compat modules on
>>> RHEL6.3. Users of compat on RHEL6 should note that you should set
>>> CONFIG_COMPAT_KFIFO=n as those bits are not needed at all.
>>>
>>> [...]
>>>
>>> diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
>>> index 56d5961..09e4b6f 100644
>>> --- a/include/linux/compat-2.6.36.h
>>> +++ b/include/linux/compat-2.6.36.h
>>> @@ -98,6 +98,8 @@ struct pm_qos_request_list {
>>> * Dummy printk for disabled debugging statements to use whilst maintaining
>>> * gcc's format and side-effect checking.
>>> */
>>> +/* mask no_printk as RHEL6 backports this */
>>> +#define no_printk(...) compat_no_printk(...)
>>> static inline __attribute__ ((format (printf, 1, 2)))
>>> int no_printk(const char *s, ...) { return 0; }
>>>
>>> [...]
>>
>> This at least breaks compilation on 2.6.35-22 with gcc throwing a
>> compat-2.6.36.h:104: error: ISO C requires a named argument before ?...?
>>
>> It looks like no_printk() needs to be renamed to compat_no_printk()
>> to make it work as intended.
>>
>> This is a systematic mistake at several sections of this patch, where
>> the original function needs to be prefixed by 'compat_' to match the
>> related macro.
>>
>>
>> ---
>> diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
>> index 8b02260..b6757c3 100644
>> --- a/include/linux/compat-2.6.36.h
>> +++ b/include/linux/compat-2.6.36.h
>> @@ -101,7 +101,7 @@ struct pm_qos_request_list {
>> /* mask no_printk as RHEL6 backports this */
>> #define no_printk(...) compat_no_printk(...)
>> static inline __attribute__ ((format (printf, 1, 2)))
>> -int no_printk(const char *s, ...) { return 0; }
>> +int compat_no_printk(const char *s, ...) { return 0; }
>>
>> #ifndef alloc_workqueue
>> #define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active, 0)
>
> With this patch applied it works better, but I still get this error in
> drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c.
>
> brcmfmac has this line:
>
> #define brcmf_dbg(level, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
>
> so brcmf_dbg gets no_printk and not compat_no_printk.
>
> Why isn't "ifndef CONFIG_COMPAT_RHEL_6_3" put around the declaration of
> no_printk()?
>
> Hauke

Did you try the patch I posted last night that has the updated define
for no_printk()? I saw the same error until I applied that patch.

2012-08-10 06:05:34

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: [Lf_driver_backport] [PATCH v2] compat: support RHEL6.3 as a build target

On Thu, Aug 9, 2012 at 8:13 PM, Andy Gospodarek <[email protected]> wrote:
> On Thu, Aug 09, 2012 at 06:27:25PM -0700, Luis R. Rodriguez wrote:
>> On Thu, Aug 9, 2012 at 6:26 AM, Zefir Kurtisi <[email protected]> wrote:
>> > @@ -101,7 +101,7 @@ struct pm_qos_request_list {
>> > /* mask no_printk as RHEL6 backports this */
>> > #define no_printk(...) compat_no_printk(...)
>> > static inline __attribute__ ((format (printf, 1, 2)))
>> > -int no_printk(const char *s, ...) { return 0; }
>> > +int compat_no_printk(const char *s, ...) { return 0; }
>>
>> I merged this in. Andy can you review your other changes as Zefir points out?
>>
>> mcgrof@frijol ~/compat (git::master)$ gcc --version
>> gcc (Debian 4.7.1-2) 4.7.1
>> Copyright (C) 2012 Free Software Foundation, Inc.
>> This is free software; see the source for copying conditions. There is NO
>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>>
>> I suppose we should get ckmake to spit out the version of gcc onto the report.
>>
>> Luis
>
> I did some more testing and I'm not sure I agree that the patch above is
> the proper way to do this. My impression was that what I did was
> correct as the only function definitions that need to be renamed with
> the 'compat_' string in front were those that were exported. This is
> what was done in both John Linville's initial patch for RHEL support and
> the patch from Hauke Mehrtens for Debian Squeeze support. I feel like
> this is the proper patch to fixup my original error:
>
> Subject: [PATCH] compat: fixup error in no_printk definition
>
> What initially looked like a valid definition for the #define for
> no_printk was not. This corrects the problem.
>
> Signed-off-by: Andy Gospodarek <[email protected]>
> ---
> include/linux/compat-2.6.36.h | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
> index 09e4b6f..cd5e37c 100644
> --- a/include/linux/compat-2.6.36.h
> +++ b/include/linux/compat-2.6.36.h
> @@ -99,7 +99,7 @@ struct pm_qos_request_list {
> * gcc's format and side-effect checking.
> */
> /* mask no_printk as RHEL6 backports this */
> -#define no_printk(...) compat_no_printk(...)
> +#define no_printk(a, ...) compat_no_printk(a, ##__VA_ARGS__)
> static inline __attribute__ ((format (printf, 1, 2)))
> int no_printk(const char *s, ...) { return 0; }

Thanks, can you git fetch ; git rebase and send a new patch?

Luis

2012-08-10 03:14:24

by Andy Gospodarek

[permalink] [raw]
Subject: Re: [Lf_driver_backport] [PATCH v2] compat: support RHEL6.3 as a build target

On Thu, Aug 09, 2012 at 06:27:25PM -0700, Luis R. Rodriguez wrote:
> On Thu, Aug 9, 2012 at 6:26 AM, Zefir Kurtisi <[email protected]> wrote:
> > @@ -101,7 +101,7 @@ struct pm_qos_request_list {
> > /* mask no_printk as RHEL6 backports this */
> > #define no_printk(...) compat_no_printk(...)
> > static inline __attribute__ ((format (printf, 1, 2)))
> > -int no_printk(const char *s, ...) { return 0; }
> > +int compat_no_printk(const char *s, ...) { return 0; }
>
> I merged this in. Andy can you review your other changes as Zefir points out?
>
> mcgrof@frijol ~/compat (git::master)$ gcc --version
> gcc (Debian 4.7.1-2) 4.7.1
> Copyright (C) 2012 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
> I suppose we should get ckmake to spit out the version of gcc onto the report.
>
> Luis

I did some more testing and I'm not sure I agree that the patch above is
the proper way to do this. My impression was that what I did was
correct as the only function definitions that need to be renamed with
the 'compat_' string in front were those that were exported. This is
what was done in both John Linville's initial patch for RHEL support and
the patch from Hauke Mehrtens for Debian Squeeze support. I feel like
this is the proper patch to fixup my original error:

Subject: [PATCH] compat: fixup error in no_printk definition

What initially looked like a valid definition for the #define for
no_printk was not. This corrects the problem.

Signed-off-by: Andy Gospodarek <[email protected]>
---
include/linux/compat-2.6.36.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
index 09e4b6f..cd5e37c 100644
--- a/include/linux/compat-2.6.36.h
+++ b/include/linux/compat-2.6.36.h
@@ -99,7 +99,7 @@ struct pm_qos_request_list {
* gcc's format and side-effect checking.
*/
/* mask no_printk as RHEL6 backports this */
-#define no_printk(...) compat_no_printk(...)
+#define no_printk(a, ...) compat_no_printk(a, ##__VA_ARGS__)
static inline __attribute__ ((format (printf, 1, 2)))
int no_printk(const char *s, ...) { return 0; }



2012-08-09 04:46:17

by Luis R. Rodriguez

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

On Wed, Aug 8, 2012 at 9:40 PM, Andy Gospodarek <[email protected]> wrote:
> This patch allows me to compile and load the latest compat modules on
> RHEL6.3. Users of compat on RHEL6 should note that you should set
> CONFIG_COMPAT_KFIFO=n as those bits are not needed at all.
>
> These changes seem to pass built-in tests on my system:
>
> # ./bin/ckmake

No need to run as root, in fact I encourage both
bin/get-compat-kernels and bin/ckmake to be run as a regular user.

Thanks! Applied and pushed!

Luis

2012-08-10 17:19:33

by Hauke Mehrtens

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

On 08/09/2012 06:40 AM, Andy Gospodarek wrote:
> This patch allows me to compile and load the latest compat modules on
> RHEL6.3. Users of compat on RHEL6 should note that you should set
> CONFIG_COMPAT_KFIFO=n as those bits are not needed at all.
>
To disable CONFIG_COMPAT_KFIFO you should prepare a patch for
compat-wireless and make use of CONFIG_COMPAT_RHEL_6_3.

Hauke


2012-08-10 17:18:27

by Hauke Mehrtens

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

On 08/09/2012 03:26 PM, Zefir Kurtisi wrote:
> On 08/09/2012 06:40 AM, Andy Gospodarek wrote:
>> This patch allows me to compile and load the latest compat modules on
>> RHEL6.3. Users of compat on RHEL6 should note that you should set
>> CONFIG_COMPAT_KFIFO=n as those bits are not needed at all.
>>
>> [...]
>>
>> diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
>> index 56d5961..09e4b6f 100644
>> --- a/include/linux/compat-2.6.36.h
>> +++ b/include/linux/compat-2.6.36.h
>> @@ -98,6 +98,8 @@ struct pm_qos_request_list {
>> * Dummy printk for disabled debugging statements to use whilst maintaining
>> * gcc's format and side-effect checking.
>> */
>> +/* mask no_printk as RHEL6 backports this */
>> +#define no_printk(...) compat_no_printk(...)
>> static inline __attribute__ ((format (printf, 1, 2)))
>> int no_printk(const char *s, ...) { return 0; }
>>
>> [...]
>
> This at least breaks compilation on 2.6.35-22 with gcc throwing a
> compat-2.6.36.h:104: error: ISO C requires a named argument before ‘...’
>
> It looks like no_printk() needs to be renamed to compat_no_printk()
> to make it work as intended.
>
> This is a systematic mistake at several sections of this patch, where
> the original function needs to be prefixed by 'compat_' to match the
> related macro.
>
>
> ---
> diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
> index 8b02260..b6757c3 100644
> --- a/include/linux/compat-2.6.36.h
> +++ b/include/linux/compat-2.6.36.h
> @@ -101,7 +101,7 @@ struct pm_qos_request_list {
> /* mask no_printk as RHEL6 backports this */
> #define no_printk(...) compat_no_printk(...)
> static inline __attribute__ ((format (printf, 1, 2)))
> -int no_printk(const char *s, ...) { return 0; }
> +int compat_no_printk(const char *s, ...) { return 0; }
>
> #ifndef alloc_workqueue
> #define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active, 0)

With this patch applied it works better, but I still get this error in
drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c.

brcmfmac has this line:

#define brcmf_dbg(level, fmt, ...) no_printk(fmt, ##__VA_ARGS__)

so brcmf_dbg gets no_printk and not compat_no_printk.

Why isn't "ifndef CONFIG_COMPAT_RHEL_6_3" put around the declaration of
no_printk()?

Hauke

2012-08-10 02:27:31

by Andy Gospodarek

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

On Thu, Aug 9, 2012 at 9:27 PM, Luis R. Rodriguez <[email protected]> wrote:
> On Thu, Aug 9, 2012 at 6:26 AM, Zefir Kurtisi <[email protected]> wrote:
>> @@ -101,7 +101,7 @@ struct pm_qos_request_list {
>> /* mask no_printk as RHEL6 backports this */
>> #define no_printk(...) compat_no_printk(...)
>> static inline __attribute__ ((format (printf, 1, 2)))
>> -int no_printk(const char *s, ...) { return 0; }
>> +int compat_no_printk(const char *s, ...) { return 0; }
>
> I merged this in. Andy can you review your other changes as Zefir points out?

Yes, I will check it out tomorrow.

> mcgrof@frijol ~/compat (git::master)$ gcc --version
> gcc (Debian 4.7.1-2) 4.7.1
> Copyright (C) 2012 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
> I suppose we should get ckmake to spit out the version of gcc onto the report.
>
> Luis

2012-08-10 23:48:57

by Hauke Mehrtens

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

On 08/10/2012 09:51 PM, Andy Gospodarek wrote:
> On Fri, Aug 10, 2012 at 3:50 PM, Luis R. Rodriguez <[email protected]> wrote:
>> On Fri, Aug 10, 2012 at 11:28 AM, Andy Gospodarek <[email protected]> wrote:
>>> Did you try the patch I posted last night that has the updated define
>>> for no_printk()? I saw the same error until I applied that patch.
>>
>> Andy, can you post a new patch on a new thread that is rebased on top
>> of the latest compat.git master and without putting stuff above the
>> patch ?
>>
>> Luis
>
> Yes I can. You caught me at just the right time as my test build of
> compat-wireless-3.5-3 just finished.

I just tried "[PATCH] compat: fixup error in no_printk definition" and
now this error does not occur in my tests any more.

Thanks for the patch.

Hauke