2012-02-25 04:19:34

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 0/4] compat: fix compiling against all kernels

From: Luis R. Rodriguez <[email protected]>

I was tired of seeing ckmake fail against different kernels, this
series of patches fixes compilation against all supported kernels.
The modpost one was tricky.

Luis R. Rodriguez (4):
compat: fix compilation warning for compat_firmware_class on 2.6.26
compat: clean ckmake log of color output
compat: avoid NOSTDINC_FLAGS during modpost
compat: fix compat_firmware class for all kernels

Makefile | 27 ++++++++++++++++-----------
bin/ckmake | 3 +++
compat/compat_firmware_class.c | 6 +++---
scripts/skip-colors | 2 ++
4 files changed, 24 insertions(+), 14 deletions(-)
create mode 100755 scripts/skip-colors

--
1.7.4.15.g7811d



2012-02-25 04:19:44

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 3/4] compat: avoid NOSTDINC_FLAGS during modpost

From: Luis R. Rodriguez <[email protected]>

modpost, the second part of module building, does not
use NOSTDINC_FLAGS and friends so all the hackery we did
to use it to prefer our header files and include compat-2.6.h
will not work during modpost for older kernels. We don't really
need all that stuff during modpost even for newer kernels so
just avoid it all together.

Signed-off-by: Luis R. Rodriguez <[email protected]>
---
Makefile | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index fdcff5c..d96d098 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,22 @@ export COMPAT_BASE_TREE := "linux-next.git"
# working with.
export COMPAT_BASE_TREE_VERSION := "next-20100517"
export COMPAT_VERSION := $(shell git describe)
+
+else
+# By stuffing this hear we avoid using
+# this hackery on modpost, the 2nd section of module building.
+#
+# This hack lets us put our include path first than the kernel's
+# when building our compat modules. Your own makefile would look
+# the same.
+NOSTDINC_FLAGS := -I$(M)/include/ \
+ -include $(M)/include/linux/compat-2.6.h \
+ $(CFLAGS) \
+ -DCOMPAT_BASE_TREE="\"$(COMPAT_BASE_TREE)\"" \
+ -DCOMPAT_BASE_TREE_VERSION="\"$(COMPAT_BASE_TREE_VERSION)\"" \
+ -DCOMPAT_PROJECT="\"Generic kernel\"" \
+ -DCOMPAT_VERSION="\"$(COMPAT_VERSION)\""
+
endif

# to check config and compat autoconf
@@ -31,17 +47,6 @@ export MAKE

obj-y += compat/

-# This hack lets us put our include path first than the kernel's
-# when building our compat modules. Your own makefile would look
-# the same.
-NOSTDINC_FLAGS := -I$(M)/include/ \
- -include $(M)/include/linux/compat-2.6.h \
- $(CFLAGS) \
- -DCOMPAT_BASE_TREE="\"$(COMPAT_BASE_TREE)\"" \
- -DCOMPAT_BASE_TREE_VERSION="\"$(COMPAT_BASE_TREE_VERSION)\"" \
- -DCOMPAT_PROJECT="\"Generic kernel\"" \
- -DCOMPAT_VERSION="\"$(COMPAT_VERSION)\""
-
all: $(COMPAT_CONFIG)

modules: $(COMPAT_CONFIG) $(COMPAT_AUTOCONF)
--
1.7.4.15.g7811d


2012-02-25 04:19:48

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 4/4] compat: fix compat_firmware class for all kernels

From: Luis R. Rodriguez <[email protected]>

Instead of ifdef checks on the to_dev() just simply rename it
to avoid clashes. This fixes compiling against all supported
kernels on compat.

mcgrof@tux ~/compat (git::master)$ ckmake
Trying kernel 3.3.0-030300rc2-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-8-generic [OK]
Trying kernel 2.6.38-13-generic [OK]
Trying kernel 2.6.38-12-generic [OK]
Trying kernel 2.6.38-11-generic [OK]
Trying kernel 2.6.38-10-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-22-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: Luis R. Rodriguez <[email protected]>
---
compat/compat_firmware_class.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/compat/compat_firmware_class.c b/compat/compat_firmware_class.c
index b085677..eb97dfc 100644
--- a/compat/compat_firmware_class.c
+++ b/compat/compat_firmware_class.c
@@ -21,10 +21,7 @@
#include <linux/firmware.h>
#include <linux/slab.h>

-#ifdef to_dev
-#undef to_dev
-#define to_dev(obj) container_of(obj, struct device, kobj)
-#endif
+#define compat_firmware_to_dev(obj) container_of(obj, struct device, kobj)

MODULE_AUTHOR("Manuel Estrada Sainz");
MODULE_DESCRIPTION("Multi purpose firmware loading support");
@@ -327,7 +324,7 @@ static ssize_t firmware_data_read(struct kobject *kobj,
char *buffer, loff_t offset, size_t count)
#endif
{
- struct device *dev = to_dev(kobj);
+ struct device *dev = compat_firmware_to_dev(kobj);
struct firmware_priv *fw_priv = to_firmware_priv(dev);
struct firmware *fw;
ssize_t ret_count;
@@ -426,7 +423,7 @@ static ssize_t firmware_data_write(struct kobject *kobj,
char *buffer, loff_t offset, size_t count)
#endif
{
- struct device *dev = to_dev(kobj);
+ struct device *dev = compat_firmware_to_dev(kobj);
struct firmware_priv *fw_priv = to_firmware_priv(dev);
struct firmware *fw;
ssize_t retval;
--
1.7.4.15.g7811d


2012-02-25 04:19:38

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 1/4] compat: fix compilation warning for compat_firmware_class on 2.6.26

From: Luis R. Rodriguez <[email protected]>

This fixes this compilation issue:

CC [M] /home/mcgrof/compat/compat/compat_firmware_class.o
/home/mcgrof/compat/compat/compat_firmware_class.c:24:0: warning: "to_dev" redefined
include/linux/input.h:1218:0: note: this is the location of the previous definition
/home/mcgrof/compat/compat/compat_firmware_class.c:24:0: warning: "to_dev" redefined
include/linux/input.h:1218:0: note: this is the location of the previous definition

Signed-off-by: Luis R. Rodriguez <[email protected]>
---
compat/compat_firmware_class.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/compat/compat_firmware_class.c b/compat/compat_firmware_class.c
index 4eb5ba7..b085677 100644
--- a/compat/compat_firmware_class.c
+++ b/compat/compat_firmware_class.c
@@ -21,7 +21,10 @@
#include <linux/firmware.h>
#include <linux/slab.h>

+#ifdef to_dev
+#undef to_dev
#define to_dev(obj) container_of(obj, struct device, kobj)
+#endif

MODULE_AUTHOR("Manuel Estrada Sainz");
MODULE_DESCRIPTION("Multi purpose firmware loading support");
--
1.7.4.15.g7811d


2012-02-25 04:19:41

by Luis R. Rodriguez

[permalink] [raw]
Subject: [PATCH 2/4] compat: clean ckmake log of color output

From: Luis R. Rodriguez <[email protected]>

Signed-off-by: Luis R. Rodriguez <[email protected]>
---
bin/ckmake | 3 +++
scripts/skip-colors | 2 ++
2 files changed, 5 insertions(+), 0 deletions(-)
create mode 100755 scripts/skip-colors

diff --git a/bin/ckmake b/bin/ckmake
index 4d45fb9..ccb291b 100755
--- a/bin/ckmake
+++ b/bin/ckmake
@@ -63,3 +63,6 @@ for i in $KLIBS; do

nice make clean KLIB=$DIR KLIB_BUILD=$DIR 2>&1 >> $LOG
done
+
+cat $LOG | ./scripts/skip-colors > $LOG.tmp
+mv $LOG.tmp $LOG
diff --git a/scripts/skip-colors b/scripts/skip-colors
new file mode 100755
index 0000000..121626f
--- /dev/null
+++ b/scripts/skip-colors
@@ -0,0 +1,2 @@
+#!/bin/bash
+perl -pe 's|(\e)\[(\d+)(;*)(\d*)(\w)||g'
--
1.7.4.15.g7811d