[packages/dahdi-linux] - fix building with linux 4.0 - rel 5

baggins baggins at pld-linux.org
Sun Apr 19 12:59:54 CEST 2015


commit 611d74bdefd70d9f51772ec89ae8346da8089025
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sun Apr 19 12:59:34 2015 +0200

    - fix building with linux 4.0
    - rel 5

 dahdi-linux.spec        |  6 +++++-
 ignore-void-value.patch | 42 +++++++++++++++++++++++++++++++++++++++
 strnicmp.patch          | 53 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 100 insertions(+), 1 deletion(-)
---
diff --git a/dahdi-linux.spec b/dahdi-linux.spec
index b1a0b50..2db8fef 100644
--- a/dahdi-linux.spec
+++ b/dahdi-linux.spec
@@ -35,7 +35,7 @@ exit 1
 %define		_enable_debug_packages	0
 %endif
 
-%define		rel	4
+%define		rel	5
 %define		pname	dahdi-linux
 %define		FIRMWARE_URL http://downloads.digium.com/pub/telephony/firmware/releases
 Summary:	DAHDI telephony device support
@@ -57,6 +57,8 @@ Source6:	%{FIRMWARE_URL}/dahdi-fw-tc400m-MR6.12.tar.gz
 # Source6-md5:	2ea860bb8a9d8ede2858b9557b74ee3c
 Source7:	%{FIRMWARE_URL}/dahdi-fw-hx8-2.06.tar.gz
 # Source7-md5:	a7f3886942bb3e9fed349a41b3390c9f
+Patch0:		ignore-void-value.patch
+Patch1:		strnicmp.patch
 URL:		http://www.asterisk.org/
 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}}
 BuildRequires:	perl-base
@@ -156,6 +158,8 @@ cd ../..\
 
 %prep
 %setup -q -n %{pname}-%{version}
+%patch0 -p1
+%patch1 -p1
 
 for a in %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7}; do
 	ln -s $a drivers/dahdi/firmware
diff --git a/ignore-void-value.patch b/ignore-void-value.patch
new file mode 100644
index 0000000..dda4309
--- /dev/null
+++ b/ignore-void-value.patch
@@ -0,0 +1,42 @@
+From 1cc0ad510acd404e63923ed3062b9302d53580da Mon Sep 17 00:00:00 2001
+From: Shaun Ruffell <sruffell at digium.com>
+Date: Mon, 2 Mar 2015 09:00:13 -0600
+Subject: [PATCH] dahdi: Fix "void value not ignored..." error when compiling
+ against kernel 4.0.
+
+With commit (d1f1052c52 "device: Change dev_<level> logging functions to return
+void") [1] in kernel version 4.0, DAHDI would fail to compile with the following
+error:
+
+  .../drivers/dahdi/dahdi-base.c:7150:2: error: void value not ignored as it ought to be
+    dahdi_dev_dbg(ASSIGN, span_device(span),
+    ^
+
+Now ignore the dev_printk return value.
+
+[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d1f1052c5204524
+
+Signed-off-by: Shaun Ruffell <sruffell at digium.com>
+Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
+---
+ include/dahdi/kernel.h | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
+index 365801d..54c415e 100644
+--- a/include/dahdi/kernel.h
++++ b/include/dahdi/kernel.h
+@@ -1665,9 +1665,11 @@ struct mutex {
+ 				chan_printk(DEBUG, "-" #bits, chan, \
+ 					"%s: " fmt, __func__, ## __VA_ARGS__)))
+ #define dahdi_dev_dbg(bits, dev, fmt, ...)         \
+-			((void)((debug & (DAHDI_DBG_ ## bits)) && \
++		do { if (debug & (DAHDI_DBG_ ## bits)) { \
+ 			dev_printk(KERN_DEBUG, dev, \
+-			"DBG-%s(%s): " fmt, #bits, __func__, ## __VA_ARGS__)))
++			"DBG-%s(%s): " fmt, #bits, __func__, ## __VA_ARGS__); \
++		} } while (0)
++
+ #endif /* DAHDI_PRINK_MACROS_USE_debug */
+ 
+ #endif /* _DAHDI_KERNEL_H */
diff --git a/strnicmp.patch b/strnicmp.patch
new file mode 100644
index 0000000..9646008
--- /dev/null
+++ b/strnicmp.patch
@@ -0,0 +1,53 @@
+From 1559db9d1ae03780788788c07334ca54cdd1253a Mon Sep 17 00:00:00 2001
+From: Shaun Ruffell <sruffell at digium.com>
+Date: Mon, 2 Mar 2015 09:00:14 -0600
+Subject: [PATCH] dahdi: strnicmp() -> strncasecmp()
+
+With commit (af3cd13501 "lib/string.c: remove strnicmp()") [1] dahdi can no
+longer call strnicmp directly. strncasecmp was added into lib/string.c in kernel
+version 2.6.22 so we'll map calls to strncasecmp to strnicmp for any kernel
+before that.
+
+This is necessary to compile against kernels >= 4.0.
+
+[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=af3cd13501
+
+Signed-off-by: Shaun Ruffell <sruffell at digium.com>
+Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
+---
+ drivers/dahdi/xpp/card_pri.c | 6 +++---
+ include/dahdi/kernel.h       | 2 ++
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/dahdi/xpp/card_pri.c b/drivers/dahdi/xpp/card_pri.c
+index 29b457b..edc8bd2 100644
+--- a/drivers/dahdi/xpp/card_pri.c
++++ b/drivers/dahdi/xpp/card_pri.c
+@@ -2399,11 +2399,11 @@ static DEVICE_ATTR_WRITER(pri_protocol_store, dev, buf, count)
+ 			buf, i);
+ 		return -EINVAL;
+ 	}
+-	if (strnicmp(buf, "E1", 2) == 0)
++	if (strncasecmp(buf, "E1", 2) == 0)
+ 		new_protocol = PRI_PROTO_E1;
+-	else if (strnicmp(buf, "T1", 2) == 0)
++	else if (strncasecmp(buf, "T1", 2) == 0)
+ 		new_protocol = PRI_PROTO_T1;
+-	else if (strnicmp(buf, "J1", 2) == 0)
++	else if (strncasecmp(buf, "J1", 2) == 0)
+ 		new_protocol = PRI_PROTO_J1;
+ 	else {
+ 		XPD_NOTICE(xpd,
+diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
+index 54c415e..90d48a3 100644
+--- a/include/dahdi/kernel.h
++++ b/include/dahdi/kernel.h
+@@ -1502,6 +1502,8 @@ void dahdi_pci_disable_link_state(struct pci_dev *pdev, int state);
+ #define list_first_entry(ptr, type, member) \
+ 	list_entry((ptr)->next, type, member)
+ 
++#define strncasecmp strnicmp
++
+ #ifndef __packed
+ #define __packed  __attribute__((packed))
+ #endif 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/dahdi-linux.git/commitdiff/611d74bdefd70d9f51772ec89ae8346da8089025



More information about the pld-cvs-commit mailing list