]> git.pld-linux.org Git - packages/linux-gpib.git/commitdiff
- up to 4.1.0 auto/th/linux-gpib-4.1.0-1
authorJan Rękorajski <baggins@pld-linux.org>
Mon, 29 Jan 2018 20:04:21 +0000 (21:04 +0100)
committerJan Rękorajski <baggins@pld-linux.org>
Mon, 29 Jan 2018 20:04:21 +0000 (21:04 +0100)
- add upstream fixes for kernel 4.15

kernel-4.15.patch [new file with mode: 0644]
linux-gpib.spec

diff --git a/kernel-4.15.patch b/kernel-4.15.patch
new file mode 100644 (file)
index 0000000..e5b435a
--- /dev/null
@@ -0,0 +1,676 @@
+diff -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
+--- linux-gpib-4.1.0/drivers/gpib/agilent_82357a/agilent_82357a.c      2017-01-16 10:26:30.000000000 +0100
++++ linux-gpib-4.1.0-k415/drivers/gpib/agilent_82357a/agilent_82357a.c 2018-01-29 20:55:10.341502118 +0100
+@@ -42,9 +42,16 @@
+       up(&context->complete);
+ }
++#ifdef HAVE_TIMER_SETUP
++static void agilent_82357a_timeout_handler(struct timer_list *t)
++{
++      agilent_82357a_private_t *a_priv = from_timer(a_priv, t, bulk_timer);
++#else
+ static void agilent_82357a_timeout_handler(unsigned long arg)
+ {
+-      agilent_82357a_urb_context_t *context = (agilent_82357a_urb_context_t *) arg;
++      agilent_82357a_private_t *a_priv = (agilent_82357a_private_t *) arg;
++#endif
++      agilent_82357a_urb_context_t *context = &a_priv->context;
+       context->timed_out = 1;
+       up(&context->complete);
+ }
+@@ -55,8 +62,7 @@
+       struct usb_device *usb_dev;
+       int retval;
+       unsigned int out_pipe;
+-      agilent_82357a_urb_context_t context;
+-      struct timer_list *timer = NULL;
++      agilent_82357a_urb_context_t *context = &a_priv->context;
+       *actual_data_length = 0;
+       retval = mutex_lock_interruptible(&a_priv->bulk_alloc_lock);
+@@ -79,25 +85,14 @@
+       }
+       usb_dev = interface_to_usbdev(a_priv->bus_interface);
+       out_pipe = usb_sndbulkpipe(usb_dev, a_priv->bulk_out_endpoint);
+-      sema_init(&context.complete, 0);
+-      context.timed_out = 0;
++      sema_init(&context->complete, 0);
++      context->timed_out = 0;
+       usb_fill_bulk_urb(a_priv->bulk_urb, usb_dev, out_pipe, data, data_length,
+-              &agilent_82357a_bulk_complete, &context);
++              &agilent_82357a_bulk_complete, context);
++
+       if(timeout_msecs)
+-      {
+-              timer = kmalloc(sizeof(struct timer_list), GFP_KERNEL);
+-              if(timer == NULL)
+-              {
+-                      mutex_unlock(&a_priv->bulk_alloc_lock);
+-                      retval = -ENOMEM;
+-                      goto cleanup;
+-              }
+-              init_timer(timer);
+-              timer->expires = jiffies + msecs_to_jiffies(timeout_msecs);
+-              timer->function = agilent_82357a_timeout_handler;
+-              timer->data = (unsigned long) &context;
+-              add_timer(timer);
+-      }
++              mod_timer(&a_priv->bulk_timer, jiffies + msecs_to_jiffies(timeout_msecs));
++
+       //printk("%s: submitting urb\n", __FUNCTION__);
+       retval = usb_submit_urb(a_priv->bulk_urb, GFP_KERNEL);
+       if(retval)
+@@ -107,13 +102,13 @@
+               goto cleanup;
+       }
+       mutex_unlock(&a_priv->bulk_alloc_lock);
+-      if(down_interruptible(&context.complete))
++      if(down_interruptible(&context->complete))
+       {
+               printk("%s: %s: interrupted\n", __FILE__, __FUNCTION__);
+               retval = -ERESTARTSYS;
+               goto cleanup;
+       }
+-      if(context.timed_out)
++      if(context->timed_out)
+       {
+               retval = -ETIMEDOUT;
+       }else
+@@ -122,11 +117,10 @@
+               *actual_data_length = a_priv->bulk_urb->actual_length;
+       }
+ cleanup:
+-      if(timer)
++      if(timeout_msecs)
+       {
+-              if(timer_pending(timer))
+-                      del_timer_sync(timer);
+-              kfree(timer);
++              if(timer_pending(&a_priv->bulk_timer))
++                      del_timer_sync(&a_priv->bulk_timer);
+       }
+       mutex_lock(&a_priv->bulk_alloc_lock);
+       if(a_priv->bulk_urb)
+@@ -145,8 +139,7 @@
+       struct usb_device *usb_dev;
+       int retval;
+       unsigned int in_pipe;
+-      agilent_82357a_urb_context_t context;
+-      struct timer_list *timer = NULL;
++      agilent_82357a_urb_context_t *context = &a_priv->context;
+       *actual_data_length = 0;
+       retval = mutex_lock_interruptible(&a_priv->bulk_alloc_lock);
+@@ -169,25 +162,14 @@
+       }
+       usb_dev = interface_to_usbdev(a_priv->bus_interface);
+       in_pipe = usb_rcvbulkpipe(usb_dev, AGILENT_82357_BULK_IN_ENDPOINT);
+-      sema_init(&context.complete, 0);
+-      context.timed_out = 0;
++      sema_init(&context->complete, 0);
++      context->timed_out = 0;
+       usb_fill_bulk_urb(a_priv->bulk_urb, usb_dev, in_pipe, data, data_length,
+-              &agilent_82357a_bulk_complete, &context);
++              &agilent_82357a_bulk_complete, context);
++
+       if(timeout_msecs)
+-      {
+-              timer = kmalloc(sizeof(struct timer_list), GFP_KERNEL);
+-              if(timer == NULL)
+-              {
+-                      retval = -ENOMEM;
+-                      mutex_unlock(&a_priv->bulk_alloc_lock);
+-                      goto cleanup;
+-              }
+-              init_timer(timer);
+-              timer->expires = jiffies + msecs_to_jiffies(timeout_msecs);
+-              timer->function = agilent_82357a_timeout_handler;
+-              timer->data = (unsigned long) &context;
+-              add_timer(timer);
+-      }
++              mod_timer(&a_priv->bulk_timer, jiffies + msecs_to_jiffies(timeout_msecs));
++
+       //printk("%s: submitting urb\n", __FUNCTION__);
+       retval = usb_submit_urb(a_priv->bulk_urb, GFP_KERNEL);
+       if(retval)
+@@ -197,13 +179,13 @@
+               goto cleanup;
+       }
+       mutex_unlock(&a_priv->bulk_alloc_lock);
+-      if(down_interruptible(&context.complete))
++      if(down_interruptible(&context->complete))
+       {
+               printk("%s: %s: interrupted\n", __FILE__, __FUNCTION__);
+               retval = -ERESTARTSYS;
+               goto cleanup;
+       }
+-      if(context.timed_out)
++      if(context->timed_out)
+       {
+               retval = -ETIMEDOUT;
+               goto cleanup;
+@@ -211,14 +193,9 @@
+       retval = a_priv->bulk_urb->status;
+       *actual_data_length = a_priv->bulk_urb->actual_length;
+ cleanup:
+-      if(timer)
+-      {
+-              if(timer_pending(timer))
+-              {
+-                      del_timer_sync(timer);
+-              }
+-              kfree(timer);
+-      }
++      if(timeout_msecs)
++              del_timer_sync(&a_priv->bulk_timer);
++
+       mutex_lock(&a_priv->bulk_alloc_lock);
+       if(a_priv->bulk_urb)
+       {
+@@ -1351,13 +1328,22 @@
+               return retval;
+       }
+       //printk("%s: finished setup_urbs()()\n", __FUNCTION__);
++
++#ifdef HAVE_TIMER_SETUP
++      timer_setup(&a_priv->bulk_timer, agilent_82357a_timeout_handler, 0);
++#else
++      setup_timer(&a_priv->bulk_timer, agilent_82357a_timeout_handler, (unsigned long) a_priv);
++#endif
++
+       retval = agilent_82357a_init(board);
++
+       if(retval < 0)
+       {
+               mutex_unlock(&agilent_82357a_hotplug_lock);
+               return retval;
+       }
+       //printk("%s: finished init()\n", __FUNCTION__);
++
+       printk("%s: attached\n", __FUNCTION__);
+       mutex_unlock(&agilent_82357a_hotplug_lock);
+       return retval;
+diff -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
+--- linux-gpib-4.1.0/drivers/gpib/agilent_82357a/agilent_82357a.h      2017-01-16 09:31:39.000000000 +0100
++++ linux-gpib-4.1.0-k415/drivers/gpib/agilent_82357a/agilent_82357a.h 2018-01-29 20:55:10.341502118 +0100
+@@ -19,6 +19,7 @@
+ #ifndef _AGILENT_82357_H
+ #define _AGILENT_82357_H
++#include <linux/kernel.h>
+ #include <linux/mutex.h>
+ #include <linux/semaphore.h>
+ #include <linux/usb.h>
+@@ -140,6 +141,12 @@
+ #define STATUS_DATA_LEN 8
+ #define INTERRUPT_BUF_LEN 8
++typedef struct
++{
++      struct semaphore complete;
++      unsigned timed_out : 1;
++} agilent_82357a_urb_context_t ;
++
+ // struct which defines local data for each 82357 device
+ typedef struct
+ {
+@@ -155,17 +162,14 @@
+       struct mutex bulk_alloc_lock;
+       struct mutex interrupt_alloc_lock;
+       struct mutex control_alloc_lock;
++      struct timer_list bulk_timer;
++        agilent_82357a_urb_context_t context;
+       unsigned bulk_out_endpoint;
+       unsigned interrupt_in_endpoint;
+         uint8_t *status_data;
+       unsigned is_cic : 1;
+ } agilent_82357a_private_t;
+-typedef struct
+-{
+-      struct semaphore complete;
+-      unsigned timed_out : 1;
+-} agilent_82357a_urb_context_t;
+ struct agilent_82357a_register_pairlet
+ {
+diff -ur linux-gpib-4.1.0/drivers/gpib/include/gpib_proto.h linux-gpib-4.1.0-k415/drivers/gpib/include/gpib_proto.h
+--- linux-gpib-4.1.0/drivers/gpib/include/gpib_proto.h 2016-06-22 10:48:46.000000000 +0200
++++ linux-gpib-4.1.0-k415/drivers/gpib/include/gpib_proto.h    2018-01-29 20:55:10.341502118 +0100
+@@ -9,7 +9,7 @@
+ 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 *t );
+ void osStartTimer( gpib_board_t *board, unsigned int usec_timeout );
+ void osRemoveTimer( gpib_board_t *board );
+ void osSendEOI( void );
+diff -ur linux-gpib-4.1.0/drivers/gpib/include/gpib_types.h linux-gpib-4.1.0-k415/drivers/gpib/include/gpib_types.h
+--- linux-gpib-4.1.0/drivers/gpib/include/gpib_types.h 2018-01-29 21:01:19.642149223 +0100
++++ linux-gpib-4.1.0-k415/drivers/gpib/include/gpib_types.h    2018-01-29 20:55:10.344835496 +0100
+@@ -32,6 +32,10 @@
+ #include <linux/timer.h>
+ #include <linux/interrupt.h>
++#if defined(timer_setup) && defined(from_timer)
++#define HAVE_TIMER_SETUP
++#endif
++
+ typedef struct gpib_interface_struct gpib_interface_t;
+ typedef struct gpib_board_struct gpib_board_t;
+@@ -157,14 +161,21 @@
+ {
+       struct timer_list timer;
+       irqreturn_t (*handler)(int, void * PT_REGS_ARG);
++      gpib_board_t *board;
+       atomic_t active;
+ };
+ static inline void init_gpib_pseudo_irq( struct gpib_pseudo_irq *pseudo_irq)
+ {
+       pseudo_irq->handler = NULL;
+-      init_timer(&pseudo_irq->timer);
++#ifdef HAVE_TIMER_SETUP
++      timer_setup(&pseudo_irq->timer, NULL, 0);
++#else
++      setup_timer(&pseudo_irq->timer, NULL, (unsigned long)pseudo_irq);
++#endif
++      smp_mb__before_atomic();
+       atomic_set(&pseudo_irq->active, 0);
++      smp_mb__after_atomic();
+ }
+ /* list so we can make a linked list of drivers */
+diff -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
+--- linux-gpib-4.1.0/drivers/gpib/ni_usb/ni_usb_gpib.c 2017-09-02 19:29:49.000000000 +0200
++++ linux-gpib-4.1.0-k415/drivers/gpib/ni_usb/ni_usb_gpib.c    2018-01-29 20:55:10.341502118 +0100
+@@ -81,9 +81,16 @@
+       up(&context->complete);
+ }
+-static void ni_usb_timeout_handler(unsigned long arg)
++#ifdef HAVE_TIMER_SETUP
++static void ni_usb_timeout_handler(struct timer_list *t)
+ {
+-      ni_usb_urb_context_t *context = (ni_usb_urb_context_t *) arg;
++      ni_usb_private_t *ni_priv = from_timer(ni_priv, t, bulk_timer);
++#else
++static void ni_usb_timeout_handler (unsigned long arg)
++{
++      ni_usb_private_t *ni_priv = (ni_usb_private_t *) arg;
++#endif
++      ni_usb_urb_context_t *context = &ni_priv->context;
+       context->timed_out = 1;
+       up(&context->complete);
+ };
+@@ -94,8 +101,7 @@
+       struct usb_device *usb_dev;
+       int retval;
+       unsigned int out_pipe;
+-      ni_usb_urb_context_t context;
+-      struct timer_list timer;
++      ni_usb_urb_context_t *context = &ni_priv->context;
+       *actual_data_length = 0;
+       mutex_lock(&ni_priv->bulk_transfer_lock);
+@@ -117,24 +123,19 @@
+       }
+       usb_dev = interface_to_usbdev(ni_priv->bus_interface);
+       out_pipe = usb_sndbulkpipe(usb_dev, ni_priv->bulk_out_endpoint);
+-      sema_init(&context.complete, 0);
+-      context.timed_out = 0;
++      sema_init(&context->complete, 0);
++      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);
++              &ni_usb_bulk_complete, context);
++
+       if(timeout_msecs)
+-      {
+-              timer.expires = jiffies + msecs_to_jiffies(timeout_msecs);
+-              timer.function = ni_usb_timeout_handler;
+-              timer.data = (unsigned long) &context;
+-              add_timer(&timer);
+-      }
++              mod_timer(&ni_priv->bulk_timer, jiffies + msecs_to_jiffies(timeout_msecs));
++
+       //printk("%s: submitting urb\n", __FUNCTION__);
+       retval = usb_submit_urb(ni_priv->bulk_urb, GFP_KERNEL);
+       if(retval)
+       {
+-              if(timer_pending(&timer))
+-                      del_timer_sync(&timer);
++              del_timer_sync(&ni_priv->bulk_timer);
+               usb_free_urb(ni_priv->bulk_urb);
+               ni_priv->bulk_urb = NULL;
+               printk("%s: failed to submit bulk out urb, retval=%i\n", __FILE__, retval);
+@@ -142,16 +143,16 @@
+               return retval;
+       }
+       mutex_unlock(&ni_priv->bulk_transfer_lock);
+-      down(&context.complete);    // wait for ni_usb_bulk_complete
+-      if(context.timed_out)
++      down(&context->complete);    // wait for ni_usb_bulk_complete
++      if(context->timed_out)
+       {
+               usb_kill_urb(ni_priv->bulk_urb);
+               printk("%s: killed urb due to timeout\n", __FUNCTION__);
+               retval = -ETIMEDOUT;
+       }else
+               retval = ni_priv->bulk_urb->status;
+-      if(timer_pending(&timer))
+-              del_timer_sync(&timer);
++
++      del_timer_sync(&ni_priv->bulk_timer);
+       *actual_data_length = ni_priv->bulk_urb->actual_length;
+       mutex_lock(&ni_priv->bulk_transfer_lock);
+       usb_free_urb(ni_priv->bulk_urb);
+@@ -183,8 +184,7 @@
+       struct usb_device *usb_dev;
+       int retval;
+       unsigned int in_pipe;
+-      ni_usb_urb_context_t context;
+-      struct timer_list timer;
++      ni_usb_urb_context_t *context = &ni_priv->context;
+       *actual_data_length = 0;
+       mutex_lock(&ni_priv->bulk_transfer_lock);
+@@ -206,24 +206,19 @@
+       }
+       usb_dev = interface_to_usbdev(ni_priv->bus_interface);
+       in_pipe = usb_rcvbulkpipe(usb_dev, ni_priv->bulk_in_endpoint);
+-      sema_init(&context.complete, 0);
+-      context.timed_out = 0;
++      sema_init(&context->complete, 0);
++      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);
++              &ni_usb_bulk_complete, context);
++
+       if(timeout_msecs)
+-      {
+-              timer.expires = jiffies + msecs_to_jiffies(timeout_msecs);
+-              timer.function = ni_usb_timeout_handler;
+-              timer.data = (unsigned long) &context;
+-              add_timer(&timer);
+-      }
++              mod_timer(&ni_priv->bulk_timer, jiffies + msecs_to_jiffies(timeout_msecs));
++
+       //printk("%s: submitting urb\n", __FUNCTION__);
+       retval = usb_submit_urb(ni_priv->bulk_urb, GFP_KERNEL);
+       if(retval)
+       {
+-              if(timer_pending(&timer))
+-                      del_timer_sync(&timer);
++              del_timer_sync(&ni_priv->bulk_timer);
+               usb_free_urb(ni_priv->bulk_urb);
+               ni_priv->bulk_urb = NULL;
+               printk("%s: failed to submit bulk out urb, retval=%i\n", __FILE__, retval);
+@@ -233,7 +228,7 @@
+       mutex_unlock(&ni_priv->bulk_transfer_lock);
+       if(interruptible)
+       {
+-              if(down_interruptible(&context.complete))
++              if(down_interruptible(&context->complete))
+               {
+                       /* If we got interrupted by a signal while waiting for the usb gpib
+                               to respond, we should send a stop command so it will finish
+@@ -242,21 +237,21 @@
+                       retval = -ERESTARTSYS;
+                       /* now do an uninterruptible wait, it shouldn't take long
+                               for the board to respond now. */
+-                      down(&context.complete);
++                      down(&context->complete);
+               }
+       }else
+       {
+-              down(&context.complete);
++              down(&context->complete);
+       }
+-      if(context.timed_out)
++      if(context->timed_out)
+       {
+               usb_kill_urb(ni_priv->bulk_urb);
+               printk("%s: killed urb due to timeout\n", __FUNCTION__);
+               retval = -ETIMEDOUT;
+       }else if(ni_priv->bulk_urb->status)
+               retval = ni_priv->bulk_urb->status;
+-      if(timer_pending(&timer))
+-              del_timer_sync(&timer);
++
++      del_timer_sync(&ni_priv->bulk_timer);
+       *actual_data_length = ni_priv->bulk_urb->actual_length;
+       mutex_lock(&ni_priv->bulk_transfer_lock);
+       usb_free_urb(ni_priv->bulk_urb);
+@@ -2170,6 +2165,13 @@
+               mutex_unlock(&ni_usb_hotplug_lock);
+               return retval;
+       }
++
++#ifdef HAVE_TIMER_SETUP
++      timer_setup(&ni_priv->bulk_timer, ni_usb_timeout_handler, 0);
++#else
++      setup_timer(&ni_priv->bulk_timer, ni_usb_timeout_handler, (unsigned long)ni_priv);
++#endif
++
+       retval = ni_usb_init(board);
+       if(retval < 0)
+       {
+@@ -2182,6 +2184,7 @@
+               mutex_unlock(&ni_usb_hotplug_lock);
+               return retval;
+       }
++
+       mutex_unlock(&ni_usb_hotplug_lock);
+       return retval;
+ }
+diff -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
+--- linux-gpib-4.1.0/drivers/gpib/ni_usb/ni_usb_gpib.h 2017-09-01 17:32:15.000000000 +0200
++++ linux-gpib-4.1.0-k415/drivers/gpib/ni_usb/ni_usb_gpib.h    2018-01-29 20:55:10.341502118 +0100
+@@ -73,6 +73,12 @@
+       NIUSB_HS_PLUS_INTERRUPT_IN_ENDPOINT = 0x3,
+ };
++typedef struct
++{
++      struct semaphore complete;
++      unsigned timed_out : 1;
++} ni_usb_urb_context_t;
++
+ // struct which defines private_data for ni_usb devices
+ typedef struct
+ {
+@@ -90,14 +96,10 @@
+         struct mutex bulk_transfer_lock;
+       struct mutex control_transfer_lock;
+       struct mutex interrupt_transfer_lock;
++      struct timer_list bulk_timer;
++      ni_usb_urb_context_t context;
+ } ni_usb_private_t;
+-typedef struct
+-{
+-      struct semaphore complete;
+-      unsigned timed_out : 1;
+-} ni_usb_urb_context_t;
+-
+ struct ni_usb_status_block
+ {
+       short id;
+diff -ur linux-gpib-4.1.0/drivers/gpib/sys/ibwait.c linux-gpib-4.1.0-k415/drivers/gpib/sys/ibwait.c
+--- linux-gpib-4.1.0/drivers/gpib/sys/ibwait.c 2017-09-02 15:19:47.000000000 +0200
++++ linux-gpib-4.1.0-k415/drivers/gpib/sys/ibwait.c    2018-01-29 20:55:10.341502118 +0100
+@@ -28,11 +28,29 @@
+       unsigned long usec_timeout;
+ };
++
++#ifdef HAVE_TIMER_SETUP
++static void wait_timeout( struct timer_list *t )
++{
++      struct wait_info *winfo = from_timer(winfo, t, timer);
++#else
++static void wait_timeout( unsigned long arg )
++{
++      struct wait_info *winfo = ( struct wait_info * ) arg;
++#endif
++      winfo->timed_out = 1;
++      wake_up_interruptible( &winfo->board->wait );
++}
++
+ static void init_wait_info( struct wait_info *winfo )
+ {
+       winfo->board = NULL;
+-      init_timer( &winfo->timer );
+       winfo->timed_out = 0;
++#ifdef HAVE_TIMER_SETUP
++      timer_setup_on_stack( &winfo->timer, wait_timeout, 0 );
++#else
++      setup_timer( &winfo->timer, wait_timeout, (unsigned long)winfo );
++#endif
+ }
+ static int wait_satisfied( struct wait_info *winfo, gpib_status_queue_t *status_queue,
+@@ -63,15 +81,6 @@
+       return 0;
+ }
+-static void wait_timeout( unsigned long arg )
+-/* Watchdog timeout routine */
+-{
+-      struct wait_info *winfo = ( struct wait_info * ) arg;
+-
+-      winfo->timed_out = 1;
+-      wake_up_interruptible( &winfo->board->wait );
+-}
+-
+ /* install timer interrupt handler */
+ static void startWaitTimer( struct wait_info *winfo )
+ /* Starts the timeout task  */
+@@ -80,17 +89,16 @@
+       if( winfo->usec_timeout > 0 )
+       {
+-              winfo->timer.expires = jiffies + usec_to_jiffies( winfo->usec_timeout );
+-              winfo->timer.function = wait_timeout;
+-              winfo->timer.data = (unsigned long) winfo;
+-              add_timer( &winfo->timer );              /* add timer           */
++              mod_timer( &winfo->timer, jiffies + usec_to_jiffies( winfo->usec_timeout ));
+       }
+ }
+ static void removeWaitTimer( struct wait_info *winfo )
+ {
+-      if( timer_pending( &winfo->timer ) )
+-              del_timer_sync( &winfo->timer );
++      del_timer_sync( &winfo->timer );
++#ifdef HAVE_TIMER_SETUP
++      destroy_timer_on_stack( &winfo->timer );
++#endif
+ }
+ /*
+diff -ur linux-gpib-4.1.0/drivers/gpib/sys/osinit.c linux-gpib-4.1.0-k415/drivers/gpib/sys/osinit.c
+--- linux-gpib-4.1.0/drivers/gpib/sys/osinit.c 2017-09-29 19:25:30.000000000 +0200
++++ linux-gpib-4.1.0-k415/drivers/gpib/sys/osinit.c    2018-01-29 20:55:10.341502118 +0100
+@@ -115,7 +115,11 @@
+       board->locking_pid = 0;
+       spin_lock_init(&board->locking_pid_spinlock);
+       spin_lock_init(&board->spinlock);
+-      init_timer(&board->timer);
++#ifdef HAVE_TIMER_SETUP
++      timer_setup(&board->timer, NULL, 0);
++#else
++      setup_timer(&board->timer, NULL, (unsigned long)board);
++#endif
+       board->ibbase = 0;
+       board->ibirq = 0;
+       board->ibdma = 0;
+diff -ur linux-gpib-4.1.0/drivers/gpib/sys/ostimer.c linux-gpib-4.1.0-k415/drivers/gpib/sys/ostimer.c
+--- linux-gpib-4.1.0/drivers/gpib/sys/ostimer.c        2016-06-22 10:48:48.000000000 +0200
++++ linux-gpib-4.1.0-k415/drivers/gpib/sys/ostimer.c   2018-01-29 21:00:09.728177393 +0100
+@@ -20,11 +20,17 @@
+ /*
+  * Timer functions
+  */
+-void watchdog_timeout( unsigned long arg )
+ /* Watchdog timeout routine */
++
++#ifdef HAVE_TIMER_SETUP
++void watchdog_timeout( struct timer_list *t )
++{
++      gpib_board_t *board = from_timer(board, t, timer);
++#else
++void watchdog_timeout( unsigned long arg )
+ {
+       gpib_board_t *board = (gpib_board_t*) arg;
+-
++#endif
+       set_bit( TIMO_NUM, &board->status );
+       wake_up_interruptible( &board->wait );
+ }
+@@ -42,10 +48,8 @@
+       if( usec_timeout > 0 )
+       {
+-              board->timer.expires = jiffies + usec_to_jiffies( usec_timeout );   /* set number of ticks */
+               board->timer.function = watchdog_timeout;
+-              board->timer.data = (unsigned long) board;
+-              add_timer( &board->timer );              /* add timer           */
++              mod_timer(&board->timer, jiffies + usec_to_jiffies( usec_timeout ));   /* set number of ticks */
+       }
+ }
+diff -ur linux-gpib-4.1.0/drivers/gpib/sys/osutil.c linux-gpib-4.1.0-k415/drivers/gpib/sys/osutil.c
+--- linux-gpib-4.1.0/drivers/gpib/sys/osutil.c 2016-06-22 10:48:48.000000000 +0200
++++ linux-gpib-4.1.0-k415/drivers/gpib/sys/osutil.c    2018-01-29 20:59:08.427580118 +0100
+@@ -49,19 +49,25 @@
+       return (HZ + 99) / 100;
+ }
++#ifdef HAVE_TIMER_SETUP
++void pseudo_irq_handler(struct timer_list *t)
++{
++        struct gpib_pseudo_irq *pseudo_irq = from_timer(pseudo_irq, t, timer);
++#else
+ void pseudo_irq_handler(unsigned long arg)
+ {
+-      gpib_board_t *board = (gpib_board_t*) arg;
+-      if(board->pseudo_irq.handler)
+-              board->pseudo_irq.handler(0, board
++      struct gpib_pseudo_irq *pseudo_irq = (struct gpib_pseudo_irq *)arg;
++#endif
++      if(pseudo_irq->handler)
++              pseudo_irq->handler(0, pseudo_irq->board
+ #ifdef HAVE_PT_REGS
+               , NULL
+ #endif
+               );
+       else
+               printk("gpib: bug! pseudo_irq.handler is NULL\n");
+-      if(atomic_read(&board->pseudo_irq.active))
+-              mod_timer(&board->pseudo_irq.timer, jiffies + pseudo_irq_period());
++      if(atomic_read(&pseudo_irq->active))
++              mod_timer(&pseudo_irq->timer, jiffies + pseudo_irq_period());
+ }
+ int gpib_request_pseudo_irq(gpib_board_t *board, irqreturn_t (*handler)(int, void * PT_REGS_ARG))
+@@ -73,11 +79,10 @@
+       }
+       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.board = board;
+       atomic_set(&board->pseudo_irq.active, 1);
+-      add_timer(&board->pseudo_irq.timer);
++      mod_timer(&board->pseudo_irq.timer, jiffies + pseudo_irq_period());
+       return 0;
+ }
index 3f6bd2fd2a89a98698527d99ff93ec999027f581..c90be4625bc92da0f623654cd5e60629f2bde57a 100644 (file)
@@ -33,18 +33,17 @@ exit 1
 %include       /usr/lib/rpm/macros.perl
 %define                php_name        php%{?php_suffix}
 
-%define                _rc     rc3
-%define                rel     0.%{_rc}.1
+%define                rel     1
 %define                pname   linux-gpib
 Summary:       GPIB (IEEE 488) Linux support
 Summary(pl.UTF-8):     Obsługa GPIB (IEEE 488) dla Linuksa
 Name:          %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
-Version:       4.0.4
+Version:       4.1.0
 Release:       %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
 License:       GPL v2+
 Group:         Applications/System
-Source0:       http://downloads.sourceforge.net/linux-gpib/%{pname}-%{version}%{_rc}.tar.gz
-# Source0-md5: e12b4eeae623015c74f8ed01107e8f92
+Source0:       http://downloads.sourceforge.net/linux-gpib/%{pname}-%{version}.tar.gz
+# Source0-md5: 2614bb6dcfde4bf01f6047fdf0ea021f
 Patch0:                %{pname}-include_file.patch
 Patch1:                %{pname}-destdir.patch
 Patch2:                %{pname}-python.patch
@@ -53,6 +52,7 @@ Patch4:               %{pname}-firmwaredir.patch
 Patch5:                %{pname}-guile2.patch
 Patch6:                %{pname}-php7.patch
 Patch7:                kernel-4.11.patch
+Patch8:                kernel-4.15.patch
 URL:           http://linux-gpib.sourceforge.net/
 BuildRequires: autoconf >= 2.50
 BuildRequires: automake
@@ -253,7 +253,7 @@ cd ../..\
 %{?with_kernel:%{expand:%create_kernel_packages}}
 
 %prep
-%setup -q -n %{pname}-%{version}%{_rc}
+%setup -q -n %{pname}-%{version}
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
@@ -262,6 +262,7 @@ cd ../..\
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
+%patch8 -p1
 
 # disable modules build by default, just install userspace header
 echo 'SUBDIRS = gpib/include' > drivers/Makefile.am
@@ -439,7 +440,7 @@ fi
 %if %{with guile}
 %files -n guile-gpib
 %defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libgpib-guile-%{version}%{_rc}.so
+%attr(755,root,root) %{_libdir}/libgpib-guile-%{version}.so
 %attr(755,root,root) %{_libdir}/libgpib-guile.so
 %endif
 
@@ -459,7 +460,7 @@ fi
 %files -n %{php_name}-gpib
 %defattr(644,root,root,755)
 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/gpib.ini
-%attr(755,root,root) %{php_extensiondir}/gpib_php-%{version}%{_rc}.so
+%attr(755,root,root) %{php_extensiondir}/gpib_php-%{version}.so
 %attr(755,root,root) %{php_extensiondir}/gpib_php.so
 %endif
 
@@ -476,7 +477,7 @@ fi
 %files -n tcl-gpib
 %defattr(644,root,root,755)
 %doc language/tcl/README
-%attr(755,root,root) %{_libdir}/libgpib_tcl-%{version}%{_rc}.so
+%attr(755,root,root) %{_libdir}/libgpib_tcl-%{version}.so
 %attr(755,root,root) %{_libdir}/libgpib_tcl.so
 %{_examplesdir}/tcl-gpib-%{version}
 %endif
This page took 0.209172 seconds and 4 git commands to generate.