]> git.pld-linux.org Git - packages/linux-gpib.git/blame - kernel-4.15.patch
- rebuild with perl 5.28.0
[packages/linux-gpib.git] / kernel-4.15.patch
CommitLineData
996e3d04
JR
1diff -ur linux-gpib-4.1.0/drivers/gpib/agilent_82357a/agilent_82357a.c linux-gpib-4.1.0-k415/drivers/gpib/agilent_82357a/agilent_82357a.c
2--- linux-gpib-4.1.0/drivers/gpib/agilent_82357a/agilent_82357a.c 2017-01-16 10:26:30.000000000 +0100
3+++ linux-gpib-4.1.0-k415/drivers/gpib/agilent_82357a/agilent_82357a.c 2018-01-29 20:55:10.341502118 +0100
4@@ -42,9 +42,16 @@
5 up(&context->complete);
6 }
7
8+#ifdef HAVE_TIMER_SETUP
9+static void agilent_82357a_timeout_handler(struct timer_list *t)
10+{
11+ agilent_82357a_private_t *a_priv = from_timer(a_priv, t, bulk_timer);
12+#else
13 static void agilent_82357a_timeout_handler(unsigned long arg)
14 {
15- agilent_82357a_urb_context_t *context = (agilent_82357a_urb_context_t *) arg;
16+ agilent_82357a_private_t *a_priv = (agilent_82357a_private_t *) arg;
17+#endif
18+ agilent_82357a_urb_context_t *context = &a_priv->context;
19 context->timed_out = 1;
20 up(&context->complete);
21 }
22@@ -55,8 +62,7 @@
23 struct usb_device *usb_dev;
24 int retval;
25 unsigned int out_pipe;
26- agilent_82357a_urb_context_t context;
27- struct timer_list *timer = NULL;
28+ agilent_82357a_urb_context_t *context = &a_priv->context;
29
30 *actual_data_length = 0;
31 retval = mutex_lock_interruptible(&a_priv->bulk_alloc_lock);
32@@ -79,25 +85,14 @@
33 }
34 usb_dev = interface_to_usbdev(a_priv->bus_interface);
35 out_pipe = usb_sndbulkpipe(usb_dev, a_priv->bulk_out_endpoint);
36- sema_init(&context.complete, 0);
37- context.timed_out = 0;
38+ sema_init(&context->complete, 0);
39+ context->timed_out = 0;
40 usb_fill_bulk_urb(a_priv->bulk_urb, usb_dev, out_pipe, data, data_length,
41- &agilent_82357a_bulk_complete, &context);
42+ &agilent_82357a_bulk_complete, context);
43+
44 if(timeout_msecs)
45- {
46- timer = kmalloc(sizeof(struct timer_list), GFP_KERNEL);
47- if(timer == NULL)
48- {
49- mutex_unlock(&a_priv->bulk_alloc_lock);
50- retval = -ENOMEM;
51- goto cleanup;
52- }
53- init_timer(timer);
54- timer->expires = jiffies + msecs_to_jiffies(timeout_msecs);
55- timer->function = agilent_82357a_timeout_handler;
56- timer->data = (unsigned long) &context;
57- add_timer(timer);
58- }
59+ mod_timer(&a_priv->bulk_timer, jiffies + msecs_to_jiffies(timeout_msecs));
60+
61 //printk("%s: submitting urb\n", __FUNCTION__);
62 retval = usb_submit_urb(a_priv->bulk_urb, GFP_KERNEL);
63 if(retval)
64@@ -107,13 +102,13 @@
65 goto cleanup;
66 }
67 mutex_unlock(&a_priv->bulk_alloc_lock);
68- if(down_interruptible(&context.complete))
69+ if(down_interruptible(&context->complete))
70 {
71 printk("%s: %s: interrupted\n", __FILE__, __FUNCTION__);
72 retval = -ERESTARTSYS;
73 goto cleanup;
74 }
75- if(context.timed_out)
76+ if(context->timed_out)
77 {
78 retval = -ETIMEDOUT;
79 }else
80@@ -122,11 +117,10 @@
81 *actual_data_length = a_priv->bulk_urb->actual_length;
82 }
83 cleanup:
84- if(timer)
85+ if(timeout_msecs)
86 {
87- if(timer_pending(timer))
88- del_timer_sync(timer);
89- kfree(timer);
90+ if(timer_pending(&a_priv->bulk_timer))
91+ del_timer_sync(&a_priv->bulk_timer);
92 }
93 mutex_lock(&a_priv->bulk_alloc_lock);
94 if(a_priv->bulk_urb)
95@@ -145,8 +139,7 @@
96 struct usb_device *usb_dev;
97 int retval;
98 unsigned int in_pipe;
99- agilent_82357a_urb_context_t context;
100- struct timer_list *timer = NULL;
101+ agilent_82357a_urb_context_t *context = &a_priv->context;
102
103 *actual_data_length = 0;
104 retval = mutex_lock_interruptible(&a_priv->bulk_alloc_lock);
105@@ -169,25 +162,14 @@
106 }
107 usb_dev = interface_to_usbdev(a_priv->bus_interface);
108 in_pipe = usb_rcvbulkpipe(usb_dev, AGILENT_82357_BULK_IN_ENDPOINT);
109- sema_init(&context.complete, 0);
110- context.timed_out = 0;
111+ sema_init(&context->complete, 0);
112+ context->timed_out = 0;
113 usb_fill_bulk_urb(a_priv->bulk_urb, usb_dev, in_pipe, data, data_length,
114- &agilent_82357a_bulk_complete, &context);
115+ &agilent_82357a_bulk_complete, context);
116+
117 if(timeout_msecs)
118- {
119- timer = kmalloc(sizeof(struct timer_list), GFP_KERNEL);
120- if(timer == NULL)
121- {
122- retval = -ENOMEM;
123- mutex_unlock(&a_priv->bulk_alloc_lock);
124- goto cleanup;
125- }
126- init_timer(timer);
127- timer->expires = jiffies + msecs_to_jiffies(timeout_msecs);
128- timer->function = agilent_82357a_timeout_handler;
129- timer->data = (unsigned long) &context;
130- add_timer(timer);
131- }
132+ mod_timer(&a_priv->bulk_timer, jiffies + msecs_to_jiffies(timeout_msecs));
133+
134 //printk("%s: submitting urb\n", __FUNCTION__);
135 retval = usb_submit_urb(a_priv->bulk_urb, GFP_KERNEL);
136 if(retval)
137@@ -197,13 +179,13 @@
138 goto cleanup;
139 }
140 mutex_unlock(&a_priv->bulk_alloc_lock);
141- if(down_interruptible(&context.complete))
142+ if(down_interruptible(&context->complete))
143 {
144 printk("%s: %s: interrupted\n", __FILE__, __FUNCTION__);
145 retval = -ERESTARTSYS;
146 goto cleanup;
147 }
148- if(context.timed_out)
149+ if(context->timed_out)
150 {
151 retval = -ETIMEDOUT;
152 goto cleanup;
153@@ -211,14 +193,9 @@
154 retval = a_priv->bulk_urb->status;
155 *actual_data_length = a_priv->bulk_urb->actual_length;
156 cleanup:
157- if(timer)
158- {
159- if(timer_pending(timer))
160- {
161- del_timer_sync(timer);
162- }
163- kfree(timer);
164- }
165+ if(timeout_msecs)
166+ del_timer_sync(&a_priv->bulk_timer);
167+
168 mutex_lock(&a_priv->bulk_alloc_lock);
169 if(a_priv->bulk_urb)
170 {
171@@ -1351,13 +1328,22 @@
172 return retval;
173 }
174 //printk("%s: finished setup_urbs()()\n", __FUNCTION__);
175+
176+#ifdef HAVE_TIMER_SETUP
177+ timer_setup(&a_priv->bulk_timer, agilent_82357a_timeout_handler, 0);
178+#else
179+ setup_timer(&a_priv->bulk_timer, agilent_82357a_timeout_handler, (unsigned long) a_priv);
180+#endif
181+
182 retval = agilent_82357a_init(board);
183+
184 if(retval < 0)
185 {
186 mutex_unlock(&agilent_82357a_hotplug_lock);
187 return retval;
188 }
189 //printk("%s: finished init()\n", __FUNCTION__);
190+
191 printk("%s: attached\n", __FUNCTION__);
192 mutex_unlock(&agilent_82357a_hotplug_lock);
193 return retval;
194diff -ur linux-gpib-4.1.0/drivers/gpib/agilent_82357a/agilent_82357a.h linux-gpib-4.1.0-k415/drivers/gpib/agilent_82357a/agilent_82357a.h
195--- linux-gpib-4.1.0/drivers/gpib/agilent_82357a/agilent_82357a.h 2017-01-16 09:31:39.000000000 +0100
196+++ linux-gpib-4.1.0-k415/drivers/gpib/agilent_82357a/agilent_82357a.h 2018-01-29 20:55:10.341502118 +0100
197@@ -19,6 +19,7 @@
198 #ifndef _AGILENT_82357_H
199 #define _AGILENT_82357_H
200
201+#include <linux/kernel.h>
202 #include <linux/mutex.h>
203 #include <linux/semaphore.h>
204 #include <linux/usb.h>
205@@ -140,6 +141,12 @@
206 #define STATUS_DATA_LEN 8
207 #define INTERRUPT_BUF_LEN 8
208
209+typedef struct
210+{
211+ struct semaphore complete;
212+ unsigned timed_out : 1;
213+} agilent_82357a_urb_context_t ;
214+
215 // struct which defines local data for each 82357 device
216 typedef struct
217 {
218@@ -155,17 +162,14 @@
219 struct mutex bulk_alloc_lock;
220 struct mutex interrupt_alloc_lock;
221 struct mutex control_alloc_lock;
222+ struct timer_list bulk_timer;
223+ agilent_82357a_urb_context_t context;
224 unsigned bulk_out_endpoint;
225 unsigned interrupt_in_endpoint;
226 uint8_t *status_data;
227 unsigned is_cic : 1;
228 } agilent_82357a_private_t;
229
230-typedef struct
231-{
232- struct semaphore complete;
233- unsigned timed_out : 1;
234-} agilent_82357a_urb_context_t;
235
236 struct agilent_82357a_register_pairlet
237 {
238diff -ur linux-gpib-4.1.0/drivers/gpib/include/gpib_proto.h linux-gpib-4.1.0-k415/drivers/gpib/include/gpib_proto.h
239--- linux-gpib-4.1.0/drivers/gpib/include/gpib_proto.h 2016-06-22 10:48:46.000000000 +0200
240+++ linux-gpib-4.1.0-k415/drivers/gpib/include/gpib_proto.h 2018-01-29 20:55:10.341502118 +0100
241@@ -9,7 +9,7 @@
242 long ibioctl(struct file *filep, unsigned int cmd, unsigned long arg );
243 int osInit( void );
244 void osReset( void );
245-void watchdog_timeout( unsigned long arg );
246+//void watchdog_timeout( struct timer_list *t );
247 void osStartTimer( gpib_board_t *board, unsigned int usec_timeout );
248 void osRemoveTimer( gpib_board_t *board );
249 void osSendEOI( void );
250diff -ur linux-gpib-4.1.0/drivers/gpib/include/gpib_types.h linux-gpib-4.1.0-k415/drivers/gpib/include/gpib_types.h
251--- linux-gpib-4.1.0/drivers/gpib/include/gpib_types.h 2018-01-29 21:01:19.642149223 +0100
252+++ linux-gpib-4.1.0-k415/drivers/gpib/include/gpib_types.h 2018-01-29 20:55:10.344835496 +0100
253@@ -32,6 +32,10 @@
254 #include <linux/timer.h>
255 #include <linux/interrupt.h>
256
257+#if defined(timer_setup) && defined(from_timer)
258+#define HAVE_TIMER_SETUP
259+#endif
260+
261 typedef struct gpib_interface_struct gpib_interface_t;
262 typedef struct gpib_board_struct gpib_board_t;
263
264@@ -157,14 +161,21 @@
265 {
266 struct timer_list timer;
267 irqreturn_t (*handler)(int, void * PT_REGS_ARG);
268+ gpib_board_t *board;
269 atomic_t active;
270 };
271
272 static inline void init_gpib_pseudo_irq( struct gpib_pseudo_irq *pseudo_irq)
273 {
274 pseudo_irq->handler = NULL;
275- init_timer(&pseudo_irq->timer);
276+#ifdef HAVE_TIMER_SETUP
277+ timer_setup(&pseudo_irq->timer, NULL, 0);
278+#else
279+ setup_timer(&pseudo_irq->timer, NULL, (unsigned long)pseudo_irq);
280+#endif
281+ smp_mb__before_atomic();
282 atomic_set(&pseudo_irq->active, 0);
283+ smp_mb__after_atomic();
284 }
285
286 /* list so we can make a linked list of drivers */
287diff -ur linux-gpib-4.1.0/drivers/gpib/ni_usb/ni_usb_gpib.c linux-gpib-4.1.0-k415/drivers/gpib/ni_usb/ni_usb_gpib.c
288--- linux-gpib-4.1.0/drivers/gpib/ni_usb/ni_usb_gpib.c 2017-09-02 19:29:49.000000000 +0200
289+++ linux-gpib-4.1.0-k415/drivers/gpib/ni_usb/ni_usb_gpib.c 2018-01-29 20:55:10.341502118 +0100
290@@ -81,9 +81,16 @@
291 up(&context->complete);
292 }
293
294-static void ni_usb_timeout_handler(unsigned long arg)
295+#ifdef HAVE_TIMER_SETUP
296+static void ni_usb_timeout_handler(struct timer_list *t)
297 {
298- ni_usb_urb_context_t *context = (ni_usb_urb_context_t *) arg;
299+ ni_usb_private_t *ni_priv = from_timer(ni_priv, t, bulk_timer);
300+#else
301+static void ni_usb_timeout_handler (unsigned long arg)
302+{
303+ ni_usb_private_t *ni_priv = (ni_usb_private_t *) arg;
304+#endif
305+ ni_usb_urb_context_t *context = &ni_priv->context;
306 context->timed_out = 1;
307 up(&context->complete);
308 };
309@@ -94,8 +101,7 @@
310 struct usb_device *usb_dev;
311 int retval;
312 unsigned int out_pipe;
313- ni_usb_urb_context_t context;
314- struct timer_list timer;
315+ ni_usb_urb_context_t *context = &ni_priv->context;
316
317 *actual_data_length = 0;
318 mutex_lock(&ni_priv->bulk_transfer_lock);
319@@ -117,24 +123,19 @@
320 }
321 usb_dev = interface_to_usbdev(ni_priv->bus_interface);
322 out_pipe = usb_sndbulkpipe(usb_dev, ni_priv->bulk_out_endpoint);
323- sema_init(&context.complete, 0);
324- context.timed_out = 0;
325+ sema_init(&context->complete, 0);
326+ context->timed_out = 0;
327 usb_fill_bulk_urb(ni_priv->bulk_urb, usb_dev, out_pipe, data, data_length,
328- &ni_usb_bulk_complete, &context);
329- init_timer(&timer);
330+ &ni_usb_bulk_complete, context);
331+
332 if(timeout_msecs)
333- {
334- timer.expires = jiffies + msecs_to_jiffies(timeout_msecs);
335- timer.function = ni_usb_timeout_handler;
336- timer.data = (unsigned long) &context;
337- add_timer(&timer);
338- }
339+ mod_timer(&ni_priv->bulk_timer, jiffies + msecs_to_jiffies(timeout_msecs));
340+
341 //printk("%s: submitting urb\n", __FUNCTION__);
342 retval = usb_submit_urb(ni_priv->bulk_urb, GFP_KERNEL);
343 if(retval)
344 {
345- if(timer_pending(&timer))
346- del_timer_sync(&timer);
347+ del_timer_sync(&ni_priv->bulk_timer);
348 usb_free_urb(ni_priv->bulk_urb);
349 ni_priv->bulk_urb = NULL;
350 printk("%s: failed to submit bulk out urb, retval=%i\n", __FILE__, retval);
351@@ -142,16 +143,16 @@
352 return retval;
353 }
354 mutex_unlock(&ni_priv->bulk_transfer_lock);
355- down(&context.complete); // wait for ni_usb_bulk_complete
356- if(context.timed_out)
357+ down(&context->complete); // wait for ni_usb_bulk_complete
358+ if(context->timed_out)
359 {
360 usb_kill_urb(ni_priv->bulk_urb);
361 printk("%s: killed urb due to timeout\n", __FUNCTION__);
362 retval = -ETIMEDOUT;
363 }else
364 retval = ni_priv->bulk_urb->status;
365- if(timer_pending(&timer))
366- del_timer_sync(&timer);
367+
368+ del_timer_sync(&ni_priv->bulk_timer);
369 *actual_data_length = ni_priv->bulk_urb->actual_length;
370 mutex_lock(&ni_priv->bulk_transfer_lock);
371 usb_free_urb(ni_priv->bulk_urb);
372@@ -183,8 +184,7 @@
373 struct usb_device *usb_dev;
374 int retval;
375 unsigned int in_pipe;
376- ni_usb_urb_context_t context;
377- struct timer_list timer;
378+ ni_usb_urb_context_t *context = &ni_priv->context;
379
380 *actual_data_length = 0;
381 mutex_lock(&ni_priv->bulk_transfer_lock);
382@@ -206,24 +206,19 @@
383 }
384 usb_dev = interface_to_usbdev(ni_priv->bus_interface);
385 in_pipe = usb_rcvbulkpipe(usb_dev, ni_priv->bulk_in_endpoint);
386- sema_init(&context.complete, 0);
387- context.timed_out = 0;
388+ sema_init(&context->complete, 0);
389+ context->timed_out = 0;
390 usb_fill_bulk_urb(ni_priv->bulk_urb, usb_dev, in_pipe, data, data_length,
391- &ni_usb_bulk_complete, &context);
392- init_timer(&timer);
393+ &ni_usb_bulk_complete, context);
394+
395 if(timeout_msecs)
396- {
397- timer.expires = jiffies + msecs_to_jiffies(timeout_msecs);
398- timer.function = ni_usb_timeout_handler;
399- timer.data = (unsigned long) &context;
400- add_timer(&timer);
401- }
402+ mod_timer(&ni_priv->bulk_timer, jiffies + msecs_to_jiffies(timeout_msecs));
403+
404 //printk("%s: submitting urb\n", __FUNCTION__);
405 retval = usb_submit_urb(ni_priv->bulk_urb, GFP_KERNEL);
406 if(retval)
407 {
408- if(timer_pending(&timer))
409- del_timer_sync(&timer);
410+ del_timer_sync(&ni_priv->bulk_timer);
411 usb_free_urb(ni_priv->bulk_urb);
412 ni_priv->bulk_urb = NULL;
413 printk("%s: failed to submit bulk out urb, retval=%i\n", __FILE__, retval);
414@@ -233,7 +228,7 @@
415 mutex_unlock(&ni_priv->bulk_transfer_lock);
416 if(interruptible)
417 {
418- if(down_interruptible(&context.complete))
419+ if(down_interruptible(&context->complete))
420 {
421 /* If we got interrupted by a signal while waiting for the usb gpib
422 to respond, we should send a stop command so it will finish
423@@ -242,21 +237,21 @@
424 retval = -ERESTARTSYS;
425 /* now do an uninterruptible wait, it shouldn't take long
426 for the board to respond now. */
427- down(&context.complete);
428+ down(&context->complete);
429 }
430 }else
431 {
432- down(&context.complete);
433+ down(&context->complete);
434 }
435- if(context.timed_out)
436+ if(context->timed_out)
437 {
438 usb_kill_urb(ni_priv->bulk_urb);
439 printk("%s: killed urb due to timeout\n", __FUNCTION__);
440 retval = -ETIMEDOUT;
441 }else if(ni_priv->bulk_urb->status)
442 retval = ni_priv->bulk_urb->status;
443- if(timer_pending(&timer))
444- del_timer_sync(&timer);
445+
446+ del_timer_sync(&ni_priv->bulk_timer);
447 *actual_data_length = ni_priv->bulk_urb->actual_length;
448 mutex_lock(&ni_priv->bulk_transfer_lock);
449 usb_free_urb(ni_priv->bulk_urb);
450@@ -2170,6 +2165,13 @@
451 mutex_unlock(&ni_usb_hotplug_lock);
452 return retval;
453 }
454+
455+#ifdef HAVE_TIMER_SETUP
456+ timer_setup(&ni_priv->bulk_timer, ni_usb_timeout_handler, 0);
457+#else
458+ setup_timer(&ni_priv->bulk_timer, ni_usb_timeout_handler, (unsigned long)ni_priv);
459+#endif
460+
461 retval = ni_usb_init(board);
462 if(retval < 0)
463 {
464@@ -2182,6 +2184,7 @@
465 mutex_unlock(&ni_usb_hotplug_lock);
466 return retval;
467 }
468+
469 mutex_unlock(&ni_usb_hotplug_lock);
470 return retval;
471 }
472diff -ur linux-gpib-4.1.0/drivers/gpib/ni_usb/ni_usb_gpib.h linux-gpib-4.1.0-k415/drivers/gpib/ni_usb/ni_usb_gpib.h
473--- linux-gpib-4.1.0/drivers/gpib/ni_usb/ni_usb_gpib.h 2017-09-01 17:32:15.000000000 +0200
474+++ linux-gpib-4.1.0-k415/drivers/gpib/ni_usb/ni_usb_gpib.h 2018-01-29 20:55:10.341502118 +0100
475@@ -73,6 +73,12 @@
476 NIUSB_HS_PLUS_INTERRUPT_IN_ENDPOINT = 0x3,
477 };
478
479+typedef struct
480+{
481+ struct semaphore complete;
482+ unsigned timed_out : 1;
483+} ni_usb_urb_context_t;
484+
485 // struct which defines private_data for ni_usb devices
486 typedef struct
487 {
488@@ -90,14 +96,10 @@
489 struct mutex bulk_transfer_lock;
490 struct mutex control_transfer_lock;
491 struct mutex interrupt_transfer_lock;
492+ struct timer_list bulk_timer;
493+ ni_usb_urb_context_t context;
494 } ni_usb_private_t;
495
496-typedef struct
497-{
498- struct semaphore complete;
499- unsigned timed_out : 1;
500-} ni_usb_urb_context_t;
501-
502 struct ni_usb_status_block
503 {
504 short id;
505diff -ur linux-gpib-4.1.0/drivers/gpib/sys/ibwait.c linux-gpib-4.1.0-k415/drivers/gpib/sys/ibwait.c
506--- linux-gpib-4.1.0/drivers/gpib/sys/ibwait.c 2017-09-02 15:19:47.000000000 +0200
507+++ linux-gpib-4.1.0-k415/drivers/gpib/sys/ibwait.c 2018-01-29 20:55:10.341502118 +0100
508@@ -28,11 +28,29 @@
509 unsigned long usec_timeout;
510 };
511
512+
513+#ifdef HAVE_TIMER_SETUP
514+static void wait_timeout( struct timer_list *t )
515+{
516+ struct wait_info *winfo = from_timer(winfo, t, timer);
517+#else
518+static void wait_timeout( unsigned long arg )
519+{
520+ struct wait_info *winfo = ( struct wait_info * ) arg;
521+#endif
522+ winfo->timed_out = 1;
523+ wake_up_interruptible( &winfo->board->wait );
524+}
525+
526 static void init_wait_info( struct wait_info *winfo )
527 {
528 winfo->board = NULL;
529- init_timer( &winfo->timer );
530 winfo->timed_out = 0;
531+#ifdef HAVE_TIMER_SETUP
532+ timer_setup_on_stack( &winfo->timer, wait_timeout, 0 );
533+#else
534+ setup_timer( &winfo->timer, wait_timeout, (unsigned long)winfo );
535+#endif
536 }
537
538 static int wait_satisfied( struct wait_info *winfo, gpib_status_queue_t *status_queue,
539@@ -63,15 +81,6 @@
540 return 0;
541 }
542
543-static void wait_timeout( unsigned long arg )
544-/* Watchdog timeout routine */
545-{
546- struct wait_info *winfo = ( struct wait_info * ) arg;
547-
548- winfo->timed_out = 1;
549- wake_up_interruptible( &winfo->board->wait );
550-}
551-
552 /* install timer interrupt handler */
553 static void startWaitTimer( struct wait_info *winfo )
554 /* Starts the timeout task */
555@@ -80,17 +89,16 @@
556
557 if( winfo->usec_timeout > 0 )
558 {
559- winfo->timer.expires = jiffies + usec_to_jiffies( winfo->usec_timeout );
560- winfo->timer.function = wait_timeout;
561- winfo->timer.data = (unsigned long) winfo;
562- add_timer( &winfo->timer ); /* add timer */
563+ mod_timer( &winfo->timer, jiffies + usec_to_jiffies( winfo->usec_timeout ));
564 }
565 }
566
567 static void removeWaitTimer( struct wait_info *winfo )
568 {
569- if( timer_pending( &winfo->timer ) )
570- del_timer_sync( &winfo->timer );
571+ del_timer_sync( &winfo->timer );
572+#ifdef HAVE_TIMER_SETUP
573+ destroy_timer_on_stack( &winfo->timer );
574+#endif
575 }
576
577 /*
578diff -ur linux-gpib-4.1.0/drivers/gpib/sys/osinit.c linux-gpib-4.1.0-k415/drivers/gpib/sys/osinit.c
579--- linux-gpib-4.1.0/drivers/gpib/sys/osinit.c 2017-09-29 19:25:30.000000000 +0200
580+++ linux-gpib-4.1.0-k415/drivers/gpib/sys/osinit.c 2018-01-29 20:55:10.341502118 +0100
581@@ -115,7 +115,11 @@
582 board->locking_pid = 0;
583 spin_lock_init(&board->locking_pid_spinlock);
584 spin_lock_init(&board->spinlock);
585- init_timer(&board->timer);
586+#ifdef HAVE_TIMER_SETUP
587+ timer_setup(&board->timer, NULL, 0);
588+#else
589+ setup_timer(&board->timer, NULL, (unsigned long)board);
590+#endif
591 board->ibbase = 0;
592 board->ibirq = 0;
593 board->ibdma = 0;
594diff -ur linux-gpib-4.1.0/drivers/gpib/sys/ostimer.c linux-gpib-4.1.0-k415/drivers/gpib/sys/ostimer.c
595--- linux-gpib-4.1.0/drivers/gpib/sys/ostimer.c 2016-06-22 10:48:48.000000000 +0200
596+++ linux-gpib-4.1.0-k415/drivers/gpib/sys/ostimer.c 2018-01-29 21:00:09.728177393 +0100
597@@ -20,11 +20,17 @@
598 /*
599 * Timer functions
600 */
601-void watchdog_timeout( unsigned long arg )
602 /* Watchdog timeout routine */
603+
604+#ifdef HAVE_TIMER_SETUP
605+void watchdog_timeout( struct timer_list *t )
606+{
607+ gpib_board_t *board = from_timer(board, t, timer);
608+#else
609+void watchdog_timeout( unsigned long arg )
610 {
611 gpib_board_t *board = (gpib_board_t*) arg;
612-
613+#endif
614 set_bit( TIMO_NUM, &board->status );
615 wake_up_interruptible( &board->wait );
616 }
617@@ -42,10 +48,8 @@
618
619 if( usec_timeout > 0 )
620 {
621- board->timer.expires = jiffies + usec_to_jiffies( usec_timeout ); /* set number of ticks */
622 board->timer.function = watchdog_timeout;
623- board->timer.data = (unsigned long) board;
624- add_timer( &board->timer ); /* add timer */
625+ mod_timer(&board->timer, jiffies + usec_to_jiffies( usec_timeout )); /* set number of ticks */
626 }
627 }
628
629diff -ur linux-gpib-4.1.0/drivers/gpib/sys/osutil.c linux-gpib-4.1.0-k415/drivers/gpib/sys/osutil.c
630--- linux-gpib-4.1.0/drivers/gpib/sys/osutil.c 2016-06-22 10:48:48.000000000 +0200
631+++ linux-gpib-4.1.0-k415/drivers/gpib/sys/osutil.c 2018-01-29 20:59:08.427580118 +0100
632@@ -49,19 +49,25 @@
633 return (HZ + 99) / 100;
634 }
635
636+#ifdef HAVE_TIMER_SETUP
637+void pseudo_irq_handler(struct timer_list *t)
638+{
639+ struct gpib_pseudo_irq *pseudo_irq = from_timer(pseudo_irq, t, timer);
640+#else
641 void pseudo_irq_handler(unsigned long arg)
642 {
643- gpib_board_t *board = (gpib_board_t*) arg;
644- if(board->pseudo_irq.handler)
645- board->pseudo_irq.handler(0, board
646+ struct gpib_pseudo_irq *pseudo_irq = (struct gpib_pseudo_irq *)arg;
647+#endif
648+ if(pseudo_irq->handler)
649+ pseudo_irq->handler(0, pseudo_irq->board
650 #ifdef HAVE_PT_REGS
651 , NULL
652 #endif
653 );
654 else
655 printk("gpib: bug! pseudo_irq.handler is NULL\n");
656- if(atomic_read(&board->pseudo_irq.active))
657- mod_timer(&board->pseudo_irq.timer, jiffies + pseudo_irq_period());
658+ if(atomic_read(&pseudo_irq->active))
659+ mod_timer(&pseudo_irq->timer, jiffies + pseudo_irq_period());
660 }
661
662 int gpib_request_pseudo_irq(gpib_board_t *board, irqreturn_t (*handler)(int, void * PT_REGS_ARG))
663@@ -73,11 +79,10 @@
664 }
665
666 board->pseudo_irq.handler = handler;
667- board->pseudo_irq.timer.expires = jiffies + pseudo_irq_period();
668 board->pseudo_irq.timer.function = pseudo_irq_handler;
669- board->pseudo_irq.timer.data = (unsigned long) board;
670+ board->pseudo_irq.board = board;
671 atomic_set(&board->pseudo_irq.active, 1);
672- add_timer(&board->pseudo_irq.timer);
673+ mod_timer(&board->pseudo_irq.timer, jiffies + pseudo_irq_period());
674
675 return 0;
676 }
This page took 0.146563 seconds and 4 git commands to generate.