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>
This commit is contained in:
Shaun Ruffell 2015-03-02 09:00:14 -06:00 committed by Tzafrir Cohen
parent 1cc0ad510a
commit 1559db9d1a
2 changed files with 5 additions and 3 deletions

View File

@ -2399,11 +2399,11 @@ static DEVICE_ATTR_WRITER(pri_protocol_store, dev, buf, count)
buf, i); buf, i);
return -EINVAL; return -EINVAL;
} }
if (strnicmp(buf, "E1", 2) == 0) if (strncasecmp(buf, "E1", 2) == 0)
new_protocol = PRI_PROTO_E1; new_protocol = PRI_PROTO_E1;
else if (strnicmp(buf, "T1", 2) == 0) else if (strncasecmp(buf, "T1", 2) == 0)
new_protocol = PRI_PROTO_T1; new_protocol = PRI_PROTO_T1;
else if (strnicmp(buf, "J1", 2) == 0) else if (strncasecmp(buf, "J1", 2) == 0)
new_protocol = PRI_PROTO_J1; new_protocol = PRI_PROTO_J1;
else { else {
XPD_NOTICE(xpd, XPD_NOTICE(xpd,

View File

@ -1502,6 +1502,8 @@ void dahdi_pci_disable_link_state(struct pci_dev *pdev, int state);
#define list_first_entry(ptr, type, member) \ #define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member) list_entry((ptr)->next, type, member)
#define strncasecmp strnicmp
#ifndef __packed #ifndef __packed
#define __packed __attribute__((packed)) #define __packed __attribute__((packed))
#endif #endif