Gentoo Archives: gentoo-commits

From: Pacho Ramos <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-wireless/ndiswrapper/, net-wireless/ndiswrapper/files/
Date: Sat, 20 Oct 2018 12:17:21
Message-Id: 1540037811.02614d472a3d5def51b601f40abd8de5dee03e11.pacho@gentoo
1 commit: 02614d472a3d5def51b601f40abd8de5dee03e11
2 Author: Pacho Ramos <pacho <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 20 12:13:22 2018 +0000
4 Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 20 12:16:51 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=02614d47
7
8 net-wireless/ndiswrapper: Fix compilation with newer kernels
9
10 Closes: https://bugs.gentoo.org/646372
11 Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>
12 Package-Manager: Portage-2.3.51, Repoman-2.3.11
13
14 .../files/ndiswrapper-1.61-kernel-4.15.patch | 199 +++++++++++++++++++++
15 net-wireless/ndiswrapper/ndiswrapper-1.61.ebuild | 5 +-
16 2 files changed, 202 insertions(+), 2 deletions(-)
17
18 diff --git a/net-wireless/ndiswrapper/files/ndiswrapper-1.61-kernel-4.15.patch b/net-wireless/ndiswrapper/files/ndiswrapper-1.61-kernel-4.15.patch
19 new file mode 100644
20 index 00000000000..8e87ece0364
21 --- /dev/null
22 +++ b/net-wireless/ndiswrapper/files/ndiswrapper-1.61-kernel-4.15.patch
23 @@ -0,0 +1,199 @@
24 +From: Seth Forshee <seth.forshee@×××××××××.com>
25 +Date: Wed, 13 Dec 2017 15:53:31 -0600
26 +Subject: [PATCH] Build fixes for Linux 4.15
27 +
28 +Fixes two build issues for 4.15:
29 +
30 + - init_timer() was eliminated in 4.15, and all callers were
31 + converted to using timer_setup(). The callback prototype has
32 + also changed to pass a timer_list argument instead of callback
33 + data, and from_timer() must be used to get to the object in
34 + which the timer is embedded.
35 +
36 + - usb_get_status() was changed to take an additional argument,
37 + and usb_get_std_status() was added as a wrapper for callers to
38 + use as a replacment. Call the wrapper in 4.15 and later.
39 +
40 +LP: #1737749
41 +---
42 + driver/ntoskernel.c | 19 ++++++++++++++++++-
43 + driver/usb.c | 10 ++++++++--
44 + driver/wrapndis.c | 28 ++++++++++++++++++++++++++++
45 + 3 files changed, 54 insertions(+), 3 deletions(-)
46 +
47 +diff --git a/driver/ntoskernel.c b/driver/ntoskernel.c
48 +index 4fe0dc1..156c688 100644
49 +--- a/driver/ntoskernel.c
50 ++++ b/driver/ntoskernel.c
51 +@@ -77,7 +77,6 @@ u64 wrap_ticks_to_boot;
52 + #if defined(CONFIG_X86_64)
53 + static struct timer_list shared_data_timer;
54 + struct kuser_shared_data kuser_shared_data;
55 +-static void update_user_shared_data_proc(unsigned long data);
56 + #endif
57 +
58 + WIN_SYMBOL_MAP("KeTickCount", &jiffies)
59 +@@ -91,7 +90,11 @@ DEFINE_PER_CPU(struct irql_info, irql_info);
60 + #endif
61 +
62 + #if defined(CONFIG_X86_64)
63 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
64 + static void update_user_shared_data_proc(unsigned long data)
65 ++#else
66 ++static void update_user_shared_data_proc(struct timer_list *t)
67 ++#endif
68 + {
69 + /* timer is supposed to be scheduled every 10ms, but bigger
70 + * intervals seem to work (tried up to 50ms) */
71 +@@ -407,9 +410,15 @@ static void initialize_object(struct dispatcher_header *dh, enum dh_type type,
72 + InitializeListHead(&dh->wait_blocks);
73 + }
74 +
75 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
76 + static void timer_proc(unsigned long data)
77 + {
78 + struct wrap_timer *wrap_timer = (struct wrap_timer *)data;
79 ++#else
80 ++static void timer_proc(struct timer_list *t)
81 ++{
82 ++ struct wrap_timer *wrap_timer = from_timer(wrap_timer, t, timer);
83 ++#endif
84 + struct nt_timer *nt_timer;
85 + struct kdpc *kdpc;
86 +
87 +@@ -452,9 +461,13 @@ void wrap_init_timer(struct nt_timer *nt_timer, enum timer_type type,
88 + return;
89 + }
90 +
91 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
92 + init_timer(&wrap_timer->timer);
93 + wrap_timer->timer.data = (unsigned long)wrap_timer;
94 + wrap_timer->timer.function = timer_proc;
95 ++#else
96 ++ timer_setup(&wrap_timer->timer, timer_proc, 0);
97 ++#endif
98 + wrap_timer->nt_timer = nt_timer;
99 + #ifdef TIMER_DEBUG
100 + wrap_timer->wrap_timer_magic = WRAP_TIMER_MAGIC;
101 +@@ -2559,9 +2572,13 @@ int ntoskernel_init(void)
102 + #if defined(CONFIG_X86_64)
103 + memset(&kuser_shared_data, 0, sizeof(kuser_shared_data));
104 + *((ULONG64 *)&kuser_shared_data.system_time) = ticks_1601();
105 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
106 + init_timer(&shared_data_timer);
107 + shared_data_timer.function = update_user_shared_data_proc;
108 + shared_data_timer.data = 0;
109 ++#else
110 ++ timer_setup(&shared_data_timer, update_user_shared_data_proc, 0);
111 ++#endif
112 + #endif
113 + return 0;
114 + }
115 +diff --git a/driver/usb.c b/driver/usb.c
116 +index 3e7021a..e55c2c6 100644
117 +--- a/driver/usb.c
118 ++++ b/driver/usb.c
119 +@@ -750,6 +750,12 @@ static USBD_STATUS wrap_set_clear_feature(struct usb_device *udev,
120 + USBEXIT(return NT_URB_STATUS(nt_urb));
121 + }
122 +
123 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
124 ++#define wrap_usb_get_status usb_get_status
125 ++#else
126 ++#define wrap_usb_get_status usb_get_std_status
127 ++#endif
128 ++
129 + static USBD_STATUS wrap_get_status_request(struct usb_device *udev,
130 + struct irp *irp)
131 + {
132 +@@ -776,8 +782,8 @@ static USBD_STATUS wrap_get_status_request(struct usb_device *udev,
133 + return NT_URB_STATUS(nt_urb);
134 + }
135 + assert(status_req->transfer_buffer_length == sizeof(u16));
136 +- ret = usb_get_status(udev, type, status_req->index,
137 +- status_req->transfer_buffer);
138 ++ ret = wrap_usb_get_status(udev, type, status_req->index,
139 ++ status_req->transfer_buffer);
140 + if (ret >= 0) {
141 + assert(ret <= status_req->transfer_buffer_length);
142 + status_req->transfer_buffer_length = ret;
143 +diff --git a/driver/wrapndis.c b/driver/wrapndis.c
144 +index 870e4c2..f653440 100644
145 +--- a/driver/wrapndis.c
146 ++++ b/driver/wrapndis.c
147 +@@ -1093,9 +1093,15 @@ send_assoc_event:
148 + EXIT2(return);
149 + }
150 +
151 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
152 + static void iw_stats_timer_proc(unsigned long data)
153 + {
154 + struct ndis_device *wnd = (struct ndis_device *)data;
155 ++#else
156 ++static void iw_stats_timer_proc(struct timer_list *t)
157 ++{
158 ++ struct ndis_device *wnd = from_timer(wnd, t, iw_stats_timer);
159 ++#endif
160 +
161 + ENTER2("%d", wnd->iw_stats_interval);
162 + if (wnd->iw_stats_interval > 0) {
163 +@@ -1111,8 +1117,12 @@ static void add_iw_stats_timer(struct ndis_device *wnd)
164 + return;
165 + if (wnd->iw_stats_interval < 0)
166 + wnd->iw_stats_interval *= -1;
167 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
168 + wnd->iw_stats_timer.data = (unsigned long)wnd;
169 + wnd->iw_stats_timer.function = iw_stats_timer_proc;
170 ++#else
171 ++ timer_setup(&wnd->iw_stats_timer, iw_stats_timer_proc, 0);
172 ++#endif
173 + mod_timer(&wnd->iw_stats_timer, jiffies + wnd->iw_stats_interval);
174 + }
175 +
176 +@@ -1124,9 +1134,15 @@ static void del_iw_stats_timer(struct ndis_device *wnd)
177 + EXIT2(return);
178 + }
179 +
180 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
181 + static void hangcheck_proc(unsigned long data)
182 + {
183 + struct ndis_device *wnd = (struct ndis_device *)data;
184 ++#else
185 ++static void hangcheck_proc(struct timer_list *t)
186 ++{
187 ++ struct ndis_device *wnd = from_timer(wnd, t, hangcheck_timer);
188 ++#endif
189 +
190 + ENTER3("%d", wnd->hangcheck_interval);
191 + if (wnd->hangcheck_interval > 0) {
192 +@@ -1147,8 +1163,12 @@ void hangcheck_add(struct ndis_device *wnd)
193 + wnd->hangcheck_interval = hangcheck_interval * HZ;
194 + if (wnd->hangcheck_interval < 0)
195 + wnd->hangcheck_interval *= -1;
196 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
197 + wnd->hangcheck_timer.data = (unsigned long)wnd;
198 + wnd->hangcheck_timer.function = hangcheck_proc;
199 ++#else
200 ++ timer_setup(&wnd->hangcheck_timer, hangcheck_proc, 0);
201 ++#endif
202 + mod_timer(&wnd->hangcheck_timer, jiffies + wnd->hangcheck_interval);
203 + EXIT2(return);
204 + }
205 +@@ -2138,9 +2158,17 @@ static NTSTATUS ndis_add_device(struct driver_object *drv_obj,
206 + wnd->dma_map_count = 0;
207 + wnd->dma_map_addr = NULL;
208 + wnd->nick[0] = 0;
209 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
210 + init_timer(&wnd->hangcheck_timer);
211 ++#else
212 ++ timer_setup(&wnd->hangcheck_timer, NULL, 0);
213 ++#endif
214 + wnd->scan_timestamp = 0;
215 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
216 + init_timer(&wnd->iw_stats_timer);
217 ++#else
218 ++ timer_setup(&wnd->iw_stats_timer, NULL, 0);
219 ++#endif
220 + wnd->iw_stats_interval = 10 * HZ;
221 + wnd->ndis_pending_work = 0;
222 + memset(&wnd->essid, 0, sizeof(wnd->essid));
223
224 diff --git a/net-wireless/ndiswrapper/ndiswrapper-1.61.ebuild b/net-wireless/ndiswrapper/ndiswrapper-1.61.ebuild
225 index bcb493f1a55..b815a61fcb1 100644
226 --- a/net-wireless/ndiswrapper/ndiswrapper-1.61.ebuild
227 +++ b/net-wireless/ndiswrapper/ndiswrapper-1.61.ebuild
228 @@ -1,7 +1,7 @@
229 -# Copyright 1999-2017 Gentoo Foundation
230 +# Copyright 1999-2018 Gentoo Authors
231 # Distributed under the terms of the GNU General Public License v2
232
233 -EAPI=6
234 +EAPI=7
235 inherit linux-mod readme.gentoo-r1 toolchain-funcs
236
237 DESCRIPTION="Wrapper for using Windows drivers for some wireless cards"
238 @@ -30,6 +30,7 @@ PATCHES=(
239 "${FILESDIR}"/${PN}-1.59-cflags.patch
240 "${FILESDIR}"/${PN}-1.61-kernel-4.11.patch
241 "${FILESDIR}"/${PN}-1.61-kernel-4.13.patch
242 + "${FILESDIR}"/${PN}-1.61-kernel-4.15.patch
243 )
244
245 MODULE_NAMES="ndiswrapper(misc:${S}/driver)"