From d7e56822d72bb69f07ad00b225e0971566783913 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 1 Apr 2015 00:26:56 +0200 Subject: [PATCH] dahdi-linux: backport changes needed for kernel 3.19 and 4.0 Signed-off-by: Daniel Golle --- ...ruct-file_f_dentry-macro-was-removed.patch | 35 ++++++++++++ ...-backport-fix-void-value-not-ignored.patch | 45 +++++++++++++++ .../006-backport-strnicmp-strncasecmp.patch | 56 +++++++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 libs/dahdi-linux/patches/004-backport-struct-file_f_dentry-macro-was-removed.patch create mode 100644 libs/dahdi-linux/patches/005-backport-fix-void-value-not-ignored.patch create mode 100644 libs/dahdi-linux/patches/006-backport-strnicmp-strncasecmp.patch diff --git a/libs/dahdi-linux/patches/004-backport-struct-file_f_dentry-macro-was-removed.patch b/libs/dahdi-linux/patches/004-backport-struct-file_f_dentry-macro-was-removed.patch new file mode 100644 index 0000000..7a52418 --- /dev/null +++ b/libs/dahdi-linux/patches/004-backport-struct-file_f_dentry-macro-was-removed.patch @@ -0,0 +1,35 @@ +From 4d86a8f3f690ee9bb9429e17cc03856c6c2dc760 Mon Sep 17 00:00:00 2001 +From: Shaun Ruffell +Date: Mon, 22 Dec 2014 11:21:28 -0600 +Subject: [PATCH] dahdi: struct file.f_dentry macro was removed in kernel 3.19 + +This is necessary to build against kernel version 3.19 since commit +(78d28e651f97866d608d9b41 "kill f_dentry macro") [1] + +[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=78d28e651 + +Signed-off-by: Shaun Ruffell +Signed-off-by: Russ Meyerriecks +--- + drivers/dahdi/dahdi-base.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c +index 0892734..f2caad0 100644 +--- a/drivers/dahdi/dahdi-base.c ++++ b/drivers/dahdi/dahdi-base.c +@@ -98,7 +98,11 @@ + #define chan_to_netdev(h) ((h)->hdlcnetdev->netdev) + + /* macro-oni for determining a unit (channel) number */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) + #define UNIT(file) MINOR(file->f_dentry->d_inode->i_rdev) ++#else ++#define UNIT(file) MINOR(file->f_path.dentry->d_inode->i_rdev) ++#endif + + EXPORT_SYMBOL(dahdi_transcode_fops); + EXPORT_SYMBOL(dahdi_init_tone_state); +-- +2.3.4 + diff --git a/libs/dahdi-linux/patches/005-backport-fix-void-value-not-ignored.patch b/libs/dahdi-linux/patches/005-backport-fix-void-value-not-ignored.patch new file mode 100644 index 0000000..c4c317a --- /dev/null +++ b/libs/dahdi-linux/patches/005-backport-fix-void-value-not-ignored.patch @@ -0,0 +1,45 @@ +From 1cc0ad510acd404e63923ed3062b9302d53580da Mon Sep 17 00:00:00 2001 +From: Shaun Ruffell +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_ 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 +Acked-by: Tzafrir Cohen +--- + 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 */ +-- +2.3.4 + diff --git a/libs/dahdi-linux/patches/006-backport-strnicmp-strncasecmp.patch b/libs/dahdi-linux/patches/006-backport-strnicmp-strncasecmp.patch new file mode 100644 index 0000000..56acebc --- /dev/null +++ b/libs/dahdi-linux/patches/006-backport-strnicmp-strncasecmp.patch @@ -0,0 +1,56 @@ +From 1559db9d1ae03780788788c07334ca54cdd1253a Mon Sep 17 00:00:00 2001 +From: Shaun Ruffell +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 +Acked-by: Tzafrir Cohen +--- + 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 +-- +2.3.4 + -- 2.30.2