[PATCH] synclinkmp.c 2.5.41

From: Paul Fulghum (paulkf@microgate.com)
Date: Thu Oct 10 2002 - 14:13:04 EST


* Remove cli()/restore()
* Use time_after() macro for jiffie wrap
* call timer_init() before actual timer usage

Please apply

Paul Fulghum
paulkf@microgate.com

--- linux-2.5.41/drivers/char/synclinkmp.c Thu Oct 10 09:56:24 2002
+++ linux-2.5.41-mg/drivers/char/synclinkmp.c Thu Oct 10 09:56:06 2002
@@ -1,5 +1,5 @@
 /*
- * $Id: synclinkmp.c,v 4.4 2002/04/22 16:05:41 paulkf Exp $
+ * $Id: synclinkmp.c,v 4.6 2002/10/10 14:50:47 paulkf Exp $
  *
  * Device driver for Microgate SyncLink Multiport
  * high speed multiprotocol serial adapter.
@@ -503,7 +503,7 @@
 MODULE_PARM(dosyncppp,"1-" __MODULE_STRING(MAX_DEVICES) "i");
 
 static char *driver_name = "SyncLink MultiPort driver";
-static char *driver_version = "$Revision: 4.4 $";
+static char *driver_version = "$Revision: 4.6 $";
 
 static int synclinkmp_init_one(struct pci_dev *dev,const struct pci_device_id *ent);
 static void synclinkmp_remove_one(struct pci_dev *dev);
@@ -1204,7 +1204,7 @@
                         schedule_timeout(char_time);
                         if (signal_pending(current))
                                 break;
- if (timeout && ((orig_jiffies + timeout) < jiffies))
+ if (timeout && time_after(jiffies, orig_jiffies + timeout))
                                 break;
                 }
         } else {
@@ -1215,7 +1215,7 @@
                         schedule_timeout(char_time);
                         if (signal_pending(current))
                                 break;
- if (timeout && ((orig_jiffies + timeout) < jiffies))
+ if (timeout && time_after(jiffies, orig_jiffies + timeout))
                                 break;
                 }
         }
@@ -2605,18 +2605,11 @@
 
         info->pending_bh = 0;
 
- init_timer(&info->tx_timer);
- info->tx_timer.data = (unsigned long)info;
- info->tx_timer.function = tx_timeout;
-
         /* program hardware for current parameters */
         reset_port(info);
 
         change_params(info);
 
- init_timer(&info->status_timer);
- info->status_timer.data = (unsigned long)info;
- info->status_timer.function = status_timeout;
         info->status_timer.expires = jiffies + jiffies_from_ms(10);
         add_timer(&info->status_timer);
 
@@ -3304,12 +3297,12 @@
                 printk("%s(%d):%s block_til_ready() before block, count=%d\n",
                          __FILE__,__LINE__, tty->driver.name, info->count );
 
- save_flags(flags); cli();
+ spin_lock_irqsave(&info->lock, flags);
         if (!tty_hung_up_p(filp)) {
                 extra_count = 1;
                 info->count--;
         }
- restore_flags(flags);
+ spin_unlock_irqrestore(&info->lock, flags);
         info->blocked_open++;
 
         while (1) {
@@ -3772,6 +3765,14 @@
                 info->bus_type = MGSL_BUS_TYPE_PCI;
                 info->irq_flags = SA_SHIRQ;
 
+ init_timer(&info->tx_timer);
+ info->tx_timer.data = (unsigned long)info;
+ info->tx_timer.function = tx_timeout;
+
+ init_timer(&info->status_timer);
+ info->status_timer.data = (unsigned long)info;
+ info->status_timer.function = status_timeout;
+
                 /* Store the PCI9050 misc control register value because a flaw
                  * in the PCI9050 prevents LCR registers from being read if
                  * BIOS assigns an LCR base address with bit 7 set.
@@ -3959,15 +3960,13 @@
         SLMP_INFO *tmp;
 
         printk("Unloading %s %s\n", driver_name, driver_version);
- save_flags(flags);
- cli();
+
         if ((rc = tty_unregister_driver(&serial_driver)))
                 printk("%s(%d) failed to unregister tty driver err=%d\n",
                        __FILE__,__LINE__,rc);
         if ((rc = tty_unregister_driver(&callout_driver)))
                 printk("%s(%d) failed to unregister callout driver err=%d\n",
                        __FILE__,__LINE__,rc);
- restore_flags(flags);
 
         info = synclinkmp_device_list;
         while(info) {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Oct 15 2002 - 22:00:38 EST