telephony/libs/dahdi-linux/patches/006-backport-strnicmp-strncasecmp.patch
Daniel Golle d7e56822d7 dahdi-linux: backport changes needed for kernel 3.19 and 4.0
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2015-04-01 00:26:56 +02:00

56 lines
1.9 KiB
Diff

From 1559db9d1ae03780788788c07334ca54cdd1253a Mon Sep 17 00:00:00 2001
From: Shaun Ruffell <sruffell@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@digium.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@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
--
2.3.4