network/ndiswrapper-kernel: Fixed building with linux-4.1.

Signed-off-by: David Spencer <baildon.research@googlemail.com>
This commit is contained in:
David Spencer 2015-09-18 00:44:16 +01:00 committed by Willy Sudiarto Raharjo
parent b7d8410d0d
commit 72cdf56749
3 changed files with 98 additions and 0 deletions

View File

@ -0,0 +1,53 @@
Description: Kernel 3.14 changes
This is a diff consisting of upstream revisions 3199, 3201, 3203.
* Use prandom_seed() instead of net_srandom() on Linux 3.8+
net_srandom() is going away.
* Avoid preempt_enable_no_resched(), it's no longer available for modules
Use preempt_enable() instead. This makes nt_spin_unlock_irqrestore()
fully complementary to nt_spin_lock_irqsave().
* Define reinit_completion() based on the kernel version
Checking for INIT_COMPLETION was a temporary hack needed before Linux
3.13-rc1 was released.
The last patch might not be really related to kernel 3.14, but is included
as well.
Origin: upstream, http://sourceforge.net/p/ndiswrapper/code/
--- a/driver/crt.c
+++ b/driver/crt.c
@@ -467,7 +467,7 @@ noregparm int WIN_FUNC(_win_memcmp,3)
noregparm void WIN_FUNC(_win_srand,1)
(UINT seed)
{
- net_srandom(seed);
+ prandom_seed((__force u32)(seed));
}
noregparm int WIN_FUNC(rand,0)
--- a/driver/ntoskernel.h
+++ b/driver/ntoskernel.h
@@ -347,7 +347,7 @@ static inline void netif_poll_disable(st
#define netdev_notifier_info_to_dev(x) ((struct net_device *)(x))
#endif
-#ifdef INIT_COMPLETION
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
static inline void reinit_completion(struct completion *x)
{
INIT_COMPLETION(*x);
@@ -797,9 +797,8 @@ do { \
#define nt_spin_unlock_irqrestore(lock, flags) \
do { \
nt_spin_unlock(lock); \
- preempt_enable_no_resched(); \
+ preempt_enable(); \
local_irq_restore(flags); \
- preempt_check_resched(); \
} while (0)
static inline ULONG SPAN_PAGES(void *ptr, SIZE_T length)

View File

@ -0,0 +1,41 @@
From: Julian Andres Klode <jak@debian.org>
Date: Tue, 12 May 2015 17:11:11 +0200
Subject: Support kernel 4.0
---
driver/ndis.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/driver/ndis.c b/driver/ndis.c
index 9ace34b..fafd2e7 100644
--- a/driver/ndis.c
+++ b/driver/ndis.c
@@ -25,6 +25,10 @@
#define MAX_ALLOCATED_NDIS_PACKETS TX_RING_SIZE
#define MAX_ALLOCATED_NDIS_BUFFERS TX_RING_SIZE
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
+#define strncasecmp strnicmp
+#endif
+
static struct work_struct ndis_work;
static struct nt_list ndis_work_list;
static spinlock_t ndis_work_list_lock;
@@ -438,7 +442,7 @@ static int read_setting(struct nt_list *setting_list, char *keyname, int length,
struct wrap_device_setting *setting;
mutex_lock(&loader_mutex);
nt_list_for_each_entry(setting, setting_list, list) {
- if (strnicmp(keyname, setting->name, length) == 0) {
+ if (strncasecmp(keyname, setting->name, length) == 0) {
TRACE2("setting %s='%s'", keyname, setting->value);
mutex_unlock(&loader_mutex);
*param = ndis_encode_setting(setting, type);
@@ -502,7 +506,7 @@ wstdcall void WIN_FUNC(NdisWriteConfiguration,4)
mutex_lock(&loader_mutex);
nt_list_for_each_entry(setting, &nmb->wnd->wd->settings, list) {
- if (strnicmp(keyname, setting->name, ansi.length) == 0) {
+ if (strncasecmp(keyname, setting->name, ansi.length) == 0) {
mutex_unlock(&loader_mutex);
if (ndis_decode_setting(setting, param))
*status = NDIS_STATUS_FAILURE;

View File

@ -78,6 +78,10 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Fixes for recent kernels (thanks to Arch)
patch -p1 < $CWD/kernel-3.14.patch
patch -p1 < $CWD/kernel-4.0.patch
EXTRA_CFLAGS="$SLKCFLAGS" \
make -C driver KVERS=$KERNEL V=1
make install -C driver KVERS=$KERNEL DESTDIR=$PKG