building linux-gpib 4.1.0 against kernel 4.17.19

Charles Lane <[email protected]>
Newsgroups gmane.linux.hardware.gpib.general
Organization Drexel University Particle Physics
Message-ID <[email protected]>
none of the kernel modules compile properly at first; it 
mostly seems to be problems with "init_timer" not being
declared, and a look at the kernel include files in linux/timer.h
shows that "init_timer" has gotten removed? modified?

Patch included to get it to compile. I haven't had a
chance to test it with hardware yet. 

Summary of changes:
init_timer(timer) -> init_timer_key(timer,NULL,0,NULL,NULL)
remove timer->data = whatever lines (no longer in timer_list struct)
timer handler routines: 
void watchdog_timeout( unsigned long arg ) -> 
void watchdog_timeout( struct timer_list*  arg )

-- 
 Drexel University    \V               --Chuck Lane
======]---------->-----*------<--------[===========
     (215) 895-1545   / \_/*~~~~~  Particle Physics
FAX: (215) 895-1281  [email protected]

_______________________________________________
Linux-gpib-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-gpib-general
20180916_newkernel.patch (text/x-patch, 7.5 KB)
diff -up ./drivers/gpib/agilent_82357a/agilent_82357a.c-orig ./drivers/gpib/agilent_82357a/agilent_82357a.c
--- ./drivers/gpib/agilent_82357a/agilent_82357a.c-orig	2017-01-16 04:26:30.000000000 -0500
+++ ./drivers/gpib/agilent_82357a/agilent_82357a.c	2018-09-16 19:53:27.672146067 -0400
@@ -42,7 +42,7 @@ static void agilent_82357a_bulk_complete
 	up(&context->complete);
 }
 
-static void agilent_82357a_timeout_handler(unsigned long arg)
+static void agilent_82357a_timeout_handler(struct timer_list *arg)
 {
 	agilent_82357a_urb_context_t *context = (agilent_82357a_urb_context_t *) arg;
 	context->timed_out = 1;
@@ -92,10 +92,10 @@ int agilent_82357a_send_bulk_msg(agilent
 			retval = -ENOMEM;
 			goto cleanup;
 		}
-		init_timer(timer);
+		init_timer_key(timer,NULL,0,NULL,NULL);
 		timer->expires = jiffies + msecs_to_jiffies(timeout_msecs);
 		timer->function = agilent_82357a_timeout_handler;
-		timer->data = (unsigned long) &context;
+		/* timer->data = (unsigned long) &context; */
 		add_timer(timer);
 	}
 	//printk("%s: submitting urb\n", __FUNCTION__);
@@ -182,10 +182,10 @@ int agilent_82357a_receive_bulk_msg(agil
 			mutex_unlock(&a_priv->bulk_alloc_lock);
 			goto cleanup;
 		}
-		init_timer(timer);
+		init_timer_key(timer,NULL,0,NULL,NULL);
 		timer->expires = jiffies + msecs_to_jiffies(timeout_msecs);
 		timer->function = agilent_82357a_timeout_handler;
-		timer->data = (unsigned long) &context;
+		/* timer->data = (unsigned long) &context; */
 		add_timer(timer);
 	}
 	//printk("%s: submitting urb\n", __FUNCTION__);
diff -up ./drivers/gpib/include/gpib_proto.h-orig ./drivers/gpib/include/gpib_proto.h
--- ./drivers/gpib/include/gpib_proto.h-orig	2016-06-22 04:48:46.000000000 -0400
+++ ./drivers/gpib/include/gpib_proto.h	2018-09-16 19:56:17.022066429 -0400
@@ -9,7 +9,7 @@ int ibclose( struct inode *inode, struct
 long ibioctl(struct file *filep, unsigned int cmd, unsigned long arg );
 int osInit( void );
 void osReset( void );
-void watchdog_timeout( unsigned long arg );
+void watchdog_timeout( struct timer_list*  arg );
 void osStartTimer( gpib_board_t *board, unsigned int usec_timeout );
 void osRemoveTimer( gpib_board_t *board );
 void osSendEOI( void );
diff -up ./drivers/gpib/include/gpib_types.h-orig ./drivers/gpib/include/gpib_types.h
--- ./drivers/gpib/include/gpib_types.h-orig	2017-09-29 03:31:09.000000000 -0400
+++ ./drivers/gpib/include/gpib_types.h	2018-09-16 19:55:59.720972417 -0400
@@ -163,7 +163,7 @@ struct gpib_pseudo_irq
 static inline void init_gpib_pseudo_irq( struct gpib_pseudo_irq *pseudo_irq)
 {
 	pseudo_irq->handler = NULL;
-	init_timer(&pseudo_irq->timer);
+	init_timer_key(&pseudo_irq->timer,NULL,0,NULL,NULL);
 	atomic_set(&pseudo_irq->active, 0);
 }
 
diff -up ./drivers/gpib/ni_usb/ni_usb_gpib.c-orig ./drivers/gpib/ni_usb/ni_usb_gpib.c
--- ./drivers/gpib/ni_usb/ni_usb_gpib.c-orig	2017-09-02 13:29:49.000000000 -0400
+++ ./drivers/gpib/ni_usb/ni_usb_gpib.c	2018-09-16 19:56:56.910283210 -0400
@@ -81,7 +81,7 @@ static void ni_usb_bulk_complete(struct
 	up(&context->complete);
 }
 
-static void ni_usb_timeout_handler(unsigned long arg)
+static void ni_usb_timeout_handler(struct timer_list *arg)
 {
 	ni_usb_urb_context_t *context = (ni_usb_urb_context_t *) arg;
 	context->timed_out = 1;
@@ -121,12 +121,12 @@ int ni_usb_nonblocking_send_bulk_msg(ni_
 	context.timed_out = 0;
 	usb_fill_bulk_urb(ni_priv->bulk_urb, usb_dev, out_pipe, data, data_length,
 		&ni_usb_bulk_complete, &context);
-	init_timer(&timer);
+	init_timer_key(&timer,NULL,0,NULL,NULL);
 	if(timeout_msecs)
 	{
 		timer.expires = jiffies + msecs_to_jiffies(timeout_msecs);
 		timer.function = ni_usb_timeout_handler;
-		timer.data = (unsigned long) &context;
+		/* timer.data = (unsigned long) &context; */
 		add_timer(&timer);
 	}
 	//printk("%s: submitting urb\n", __FUNCTION__);
@@ -210,12 +210,12 @@ int ni_usb_nonblocking_receive_bulk_msg(
 	context.timed_out = 0;
 	usb_fill_bulk_urb(ni_priv->bulk_urb, usb_dev, in_pipe, data, data_length,
 		&ni_usb_bulk_complete, &context);
-	init_timer(&timer);
+	init_timer_key(&timer,NULL,0,NULL,NULL);
 	if(timeout_msecs)
 	{
 		timer.expires = jiffies + msecs_to_jiffies(timeout_msecs);
 		timer.function = ni_usb_timeout_handler;
-		timer.data = (unsigned long) &context;
+		/* timer.data = (unsigned long) &context; */
 		add_timer(&timer);
 	}
 	//printk("%s: submitting urb\n", __FUNCTION__);
diff -up ./drivers/gpib/sys/ibwait.c-orig ./drivers/gpib/sys/ibwait.c
--- ./drivers/gpib/sys/ibwait.c-orig	2018-09-16 19:54:21.688439633 -0400
+++ ./drivers/gpib/sys/ibwait.c	2018-09-16 19:54:33.223502324 -0400
@@ -31,7 +31,7 @@ struct wait_info
 static void init_wait_info( struct wait_info *winfo )
 {
 	winfo->board = NULL;
-	init_timer( &winfo->timer );
+	init_timer_key( &winfo->timer,NULL,0,NULL,NULL );
 	winfo->timed_out = 0;
 }
 
@@ -63,7 +63,7 @@ static int wait_satisfied( struct wait_i
 	return 0;
 }
 
-static void wait_timeout( unsigned long arg )
+static void wait_timeout( struct timer_list *arg )
 /* Watchdog timeout routine */
 {
 	struct wait_info *winfo = ( struct wait_info * ) arg;
@@ -82,7 +82,7 @@ static void startWaitTimer( struct wait_
 	{
 		winfo->timer.expires = jiffies + usec_to_jiffies( winfo->usec_timeout );
 		winfo->timer.function = wait_timeout;
-		winfo->timer.data = (unsigned long) winfo;
+		/* winfo->timer.data = (unsigned long) winfo; */
 		add_timer( &winfo->timer );              /* add timer           */
 	}
 }
diff -up ./drivers/gpib/sys/osinit.c-orig ./drivers/gpib/sys/osinit.c
--- ./drivers/gpib/sys/osinit.c-orig	2017-09-29 13:25:30.000000000 -0400
+++ ./drivers/gpib/sys/osinit.c	2018-09-16 19:55:11.758711754 -0400
@@ -115,7 +115,7 @@ void init_gpib_board( gpib_board_t *boar
 	board->locking_pid = 0;
 	spin_lock_init(&board->locking_pid_spinlock);
 	spin_lock_init(&board->spinlock);
-	init_timer(&board->timer);
+	init_timer_key(&board->timer,NULL,0,NULL,NULL);
 	board->ibbase = 0;
 	board->ibirq = 0;
 	board->ibdma = 0;
diff -up ./drivers/gpib/sys/ostimer.c-orig ./drivers/gpib/sys/ostimer.c
--- ./drivers/gpib/sys/ostimer.c-orig	2016-06-22 04:48:48.000000000 -0400
+++ ./drivers/gpib/sys/ostimer.c	2018-09-16 19:54:09.143371454 -0400
@@ -20,7 +20,7 @@
 /*
  * Timer functions
  */
-void watchdog_timeout( unsigned long arg )
+void watchdog_timeout( struct  timer_list*arg )
 /* Watchdog timeout routine */
 {
 	gpib_board_t *board = (gpib_board_t*) arg;
@@ -44,7 +44,7 @@ void osStartTimer( gpib_board_t *board,
 	{
 		board->timer.expires = jiffies + usec_to_jiffies( usec_timeout );   /* set number of ticks */
 		board->timer.function = watchdog_timeout;
-		board->timer.data = (unsigned long) board;
+		/* board->timer.data = (unsigned long) board; */
 		add_timer( &board->timer );              /* add timer           */
 	}
 }
diff -up ./drivers/gpib/sys/osutil.c-orig ./drivers/gpib/sys/osutil.c
--- ./drivers/gpib/sys/osutil.c-orig	2016-06-22 04:48:48.000000000 -0400
+++ ./drivers/gpib/sys/osutil.c	2018-09-16 19:54:48.838587188 -0400
@@ -49,7 +49,7 @@ static inline int pseudo_irq_period(void
 	return (HZ + 99) / 100;
 }
 
-void pseudo_irq_handler(unsigned long arg)
+void pseudo_irq_handler(struct timer_list * arg)
 {
 	gpib_board_t *board = (gpib_board_t*) arg;
 	if(board->pseudo_irq.handler)
@@ -75,7 +75,7 @@ int gpib_request_pseudo_irq(gpib_board_t
 	board->pseudo_irq.handler = handler;
 	board->pseudo_irq.timer.expires = jiffies + pseudo_irq_period();
 	board->pseudo_irq.timer.function = pseudo_irq_handler;
-	board->pseudo_irq.timer.data = (unsigned long) board;
+	/* board->pseudo_irq.timer.data = (unsigned long) board; */
 	atomic_set(&board->pseudo_irq.active, 1);
 	add_timer(&board->pseudo_irq.timer);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.