Commit d42ea696 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] synclink updates

parent 70074268
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Al Longyear <longyear@netcom.com>, Paul Mackerras <Paul.Mackerras@cs.anu.edu.au> * Al Longyear <longyear@netcom.com>, Paul Mackerras <Paul.Mackerras@cs.anu.edu.au>
* *
* Original release 01/11/99 * Original release 01/11/99
* $Id: n_hdlc.c,v 4.1 2002/04/10 19:30:58 paulkf Exp $ * $Id: n_hdlc.c,v 4.2 2002/10/10 14:52:41 paulkf Exp $
* *
* This code is released under the GNU General Public License (GPL) * This code is released under the GNU General Public License (GPL)
* *
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
*/ */
#define HDLC_MAGIC 0x239e #define HDLC_MAGIC 0x239e
#define HDLC_VERSION "$Revision: 4.1 $" #define HDLC_VERSION "$Revision: 4.2 $"
#include <linux/version.h> #include <linux/version.h>
#include <linux/config.h> #include <linux/config.h>
...@@ -264,7 +264,8 @@ static void n_hdlc_release (struct n_hdlc *n_hdlc) ...@@ -264,7 +264,8 @@ static void n_hdlc_release (struct n_hdlc *n_hdlc)
} else } else
break; break;
} }
if (n_hdlc->tbuf)
kfree(n_hdlc->tbuf);
kfree(n_hdlc); kfree(n_hdlc);
} /* end of n_hdlc_release() */ } /* end of n_hdlc_release() */
...@@ -381,16 +382,15 @@ static void n_hdlc_send_frames (struct n_hdlc *n_hdlc, struct tty_struct *tty) ...@@ -381,16 +382,15 @@ static void n_hdlc_send_frames (struct n_hdlc *n_hdlc, struct tty_struct *tty)
printk("%s(%d)n_hdlc_send_frames() called\n",__FILE__,__LINE__); printk("%s(%d)n_hdlc_send_frames() called\n",__FILE__,__LINE__);
check_again: check_again:
save_flags(flags); spin_lock_irqsave(&n_hdlc->tx_buf_list.spinlock, flags);
cli ();
if (n_hdlc->tbusy) { if (n_hdlc->tbusy) {
n_hdlc->woke_up = 1; n_hdlc->woke_up = 1;
restore_flags(flags); spin_unlock_irqrestore(&n_hdlc->tx_buf_list.spinlock, flags);
return; return;
} }
n_hdlc->tbusy = 1; n_hdlc->tbusy = 1;
n_hdlc->woke_up = 0; n_hdlc->woke_up = 0;
restore_flags(flags); spin_unlock_irqrestore(&n_hdlc->tx_buf_list.spinlock, flags);
/* get current transmit buffer or get new transmit */ /* get current transmit buffer or get new transmit */
/* buffer from list of pending transmit buffers */ /* buffer from list of pending transmit buffers */
...@@ -445,10 +445,9 @@ static void n_hdlc_send_frames (struct n_hdlc *n_hdlc, struct tty_struct *tty) ...@@ -445,10 +445,9 @@ static void n_hdlc_send_frames (struct n_hdlc *n_hdlc, struct tty_struct *tty)
tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
/* Clear the re-entry flag */ /* Clear the re-entry flag */
save_flags(flags); spin_lock_irqsave(&n_hdlc->tx_buf_list.spinlock, flags);
cli ();
n_hdlc->tbusy = 0; n_hdlc->tbusy = 0;
restore_flags(flags); spin_unlock_irqrestore(&n_hdlc->tx_buf_list.spinlock, flags);
if (n_hdlc->woke_up) if (n_hdlc->woke_up)
goto check_again; goto check_again;
......
/* /*
* linux/drivers/char/pcmcia/synclink_cs.c * linux/drivers/char/pcmcia/synclink_cs.c
* *
* $Id: synclink_cs.c,v 4.2 2002/04/22 14:36:43 paulkf Exp $ * $Id: synclink_cs.c,v 4.4 2002/10/10 14:53:37 paulkf Exp $
* *
* Device driver for Microgate SyncLink PC Card * Device driver for Microgate SyncLink PC Card
* multiprotocol serial adapter. * multiprotocol serial adapter.
...@@ -498,7 +498,7 @@ MODULE_PARM(maxframe,"1-" __MODULE_STRING(MAX_DEVICE_COUNT) "i"); ...@@ -498,7 +498,7 @@ MODULE_PARM(maxframe,"1-" __MODULE_STRING(MAX_DEVICE_COUNT) "i");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static char *driver_name = "SyncLink PC Card driver"; static char *driver_name = "SyncLink PC Card driver";
static char *driver_version = "$Revision: 4.2 $"; static char *driver_version = "$Revision: 4.4 $";
static struct tty_driver serial_driver, callout_driver; static struct tty_driver serial_driver, callout_driver;
static int serial_refcount; static int serial_refcount;
...@@ -2741,7 +2741,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -2741,7 +2741,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout)
schedule_timeout(char_time); schedule_timeout(char_time);
if (signal_pending(current)) if (signal_pending(current))
break; break;
if (timeout && ((orig_jiffies + timeout) < jiffies)) if (timeout && time_after(jiffies, orig_jiffies + timeout))
break; break;
} }
} else { } else {
...@@ -2751,7 +2751,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -2751,7 +2751,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout)
schedule_timeout(char_time); schedule_timeout(char_time);
if (signal_pending(current)) if (signal_pending(current))
break; break;
if (timeout && ((orig_jiffies + timeout) < jiffies)) if (timeout && time_after(jiffies, orig_jiffies + timeout))
break; break;
} }
} }
...@@ -2849,12 +2849,12 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, ...@@ -2849,12 +2849,12 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
printk("%s(%d):block_til_ready before block on %s count=%d\n", printk("%s(%d):block_til_ready before block on %s count=%d\n",
__FILE__,__LINE__, tty->driver.name, info->count ); __FILE__,__LINE__, tty->driver.name, info->count );
save_flags(flags); cli(); spin_lock_irqsave(&info->lock, flags);
if (!tty_hung_up_p(filp)) { if (!tty_hung_up_p(filp)) {
extra_count = 1; extra_count = 1;
info->count--; info->count--;
} }
restore_flags(flags); spin_unlock_irqrestore(&info->lock, flags);
info->blocked_open++; info->blocked_open++;
while (1) { while (1) {
...@@ -3319,7 +3319,6 @@ static int __init synclink_cs_init(void) ...@@ -3319,7 +3319,6 @@ static int __init synclink_cs_init(void)
static void __exit synclink_cs_exit(void) static void __exit synclink_cs_exit(void)
{ {
unsigned long flags;
int rc; int rc;
printk("Unloading %s: version %s\n", driver_name, driver_version); printk("Unloading %s: version %s\n", driver_name, driver_version);
...@@ -3327,15 +3326,12 @@ static void __exit synclink_cs_exit(void) ...@@ -3327,15 +3326,12 @@ static void __exit synclink_cs_exit(void)
while(mgslpc_device_list) while(mgslpc_device_list)
mgslpc_remove_device(mgslpc_device_list); mgslpc_remove_device(mgslpc_device_list);
save_flags(flags);
cli();
if ((rc = tty_unregister_driver(&serial_driver))) if ((rc = tty_unregister_driver(&serial_driver)))
printk("%s(%d) failed to unregister tty driver err=%d\n", printk("%s(%d) failed to unregister tty driver err=%d\n",
__FILE__,__LINE__,rc); __FILE__,__LINE__,rc);
if ((rc = tty_unregister_driver(&callout_driver))) if ((rc = tty_unregister_driver(&callout_driver)))
printk("%s(%d) failed to unregister callout driver err=%d\n", printk("%s(%d) failed to unregister callout driver err=%d\n",
__FILE__,__LINE__,rc); __FILE__,__LINE__,rc);
restore_flags(flags);
unregister_pccard_driver(&dev_info); unregister_pccard_driver(&dev_info);
while (dev_list != NULL) { while (dev_list != NULL) {
......
/* /*
* linux/drivers/char/synclink.c * linux/drivers/char/synclink.c
* *
* $Id: synclink.c,v 4.2 2002/04/10 20:45:13 paulkf Exp $ * $Id: synclink.c,v 4.4 2002/10/10 14:53:36 paulkf Exp $
* *
* Device driver for Microgate SyncLink ISA and PCI * Device driver for Microgate SyncLink ISA and PCI
* high speed multiprotocol serial adapters. * high speed multiprotocol serial adapters.
...@@ -917,7 +917,7 @@ MODULE_PARM(txdmabufs,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i"); ...@@ -917,7 +917,7 @@ MODULE_PARM(txdmabufs,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i");
MODULE_PARM(txholdbufs,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i"); MODULE_PARM(txholdbufs,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i");
static char *driver_name = "SyncLink serial driver"; static char *driver_name = "SyncLink serial driver";
static char *driver_version = "$Revision: 4.2 $"; static char *driver_version = "$Revision: 4.4 $";
static int synclink_init_one (struct pci_dev *dev, static int synclink_init_one (struct pci_dev *dev,
const struct pci_device_id *ent); const struct pci_device_id *ent);
...@@ -3387,7 +3387,7 @@ static void mgsl_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -3387,7 +3387,7 @@ static void mgsl_wait_until_sent(struct tty_struct *tty, int timeout)
schedule_timeout(char_time); schedule_timeout(char_time);
if (signal_pending(current)) if (signal_pending(current))
break; break;
if (timeout && ((orig_jiffies + timeout) < jiffies)) if (timeout && time_after(jiffies, orig_jiffies + timeout))
break; break;
} }
} else { } else {
...@@ -3397,7 +3397,7 @@ static void mgsl_wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -3397,7 +3397,7 @@ static void mgsl_wait_until_sent(struct tty_struct *tty, int timeout)
schedule_timeout(char_time); schedule_timeout(char_time);
if (signal_pending(current)) if (signal_pending(current))
break; break;
if (timeout && ((orig_jiffies + timeout) < jiffies)) if (timeout && time_after(jiffies, orig_jiffies + timeout))
break; break;
} }
} }
...@@ -3512,12 +3512,12 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, ...@@ -3512,12 +3512,12 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
printk("%s(%d):block_til_ready before block on %s count=%d\n", printk("%s(%d):block_til_ready before block on %s count=%d\n",
__FILE__,__LINE__, tty->driver.name, info->count ); __FILE__,__LINE__, tty->driver.name, info->count );
save_flags(flags); cli(); spin_lock_irqsave(&info->irq_spinlock, flags);
if (!tty_hung_up_p(filp)) { if (!tty_hung_up_p(filp)) {
extra_count = 1; extra_count = 1;
info->count--; info->count--;
} }
restore_flags(flags); spin_unlock_irqrestore(&info->irq_spinlock, flags);
info->blocked_open++; info->blocked_open++;
while (1) { while (1) {
...@@ -4728,21 +4728,18 @@ static int __init synclink_init(void) ...@@ -4728,21 +4728,18 @@ static int __init synclink_init(void)
static void __exit synclink_exit(void) static void __exit synclink_exit(void)
{ {
unsigned long flags;
int rc; int rc;
struct mgsl_struct *info; struct mgsl_struct *info;
struct mgsl_struct *tmp; struct mgsl_struct *tmp;
printk("Unloading %s: %s\n", driver_name, driver_version); printk("Unloading %s: %s\n", driver_name, driver_version);
save_flags(flags);
cli();
if ((rc = tty_unregister_driver(&serial_driver))) if ((rc = tty_unregister_driver(&serial_driver)))
printk("%s(%d) failed to unregister tty driver err=%d\n", printk("%s(%d) failed to unregister tty driver err=%d\n",
__FILE__,__LINE__,rc); __FILE__,__LINE__,rc);
if ((rc = tty_unregister_driver(&callout_driver))) if ((rc = tty_unregister_driver(&callout_driver)))
printk("%s(%d) failed to unregister callout driver err=%d\n", printk("%s(%d) failed to unregister callout driver err=%d\n",
__FILE__,__LINE__,rc); __FILE__,__LINE__,rc);
restore_flags(flags);
info = mgsl_device_list; info = mgsl_device_list;
while(info) { while(info) {
...@@ -7486,7 +7483,7 @@ BOOLEAN mgsl_dma_test( struct mgsl_struct *info ) ...@@ -7486,7 +7483,7 @@ BOOLEAN mgsl_dma_test( struct mgsl_struct *info )
EndTime = jiffies + jiffies_from_ms(100); EndTime = jiffies + jiffies_from_ms(100);
for(;;) { for(;;) {
if ( jiffies > EndTime ) { if (time_after(jiffies, EndTime)) {
rc = FALSE; rc = FALSE;
break; break;
} }
...@@ -7542,7 +7539,7 @@ BOOLEAN mgsl_dma_test( struct mgsl_struct *info ) ...@@ -7542,7 +7539,7 @@ BOOLEAN mgsl_dma_test( struct mgsl_struct *info )
EndTime = jiffies + jiffies_from_ms(100); EndTime = jiffies + jiffies_from_ms(100);
for(;;) { for(;;) {
if ( jiffies > EndTime ) { if (time_after(jiffies, EndTime)) {
rc = FALSE; rc = FALSE;
break; break;
} }
...@@ -7590,7 +7587,7 @@ BOOLEAN mgsl_dma_test( struct mgsl_struct *info ) ...@@ -7590,7 +7587,7 @@ BOOLEAN mgsl_dma_test( struct mgsl_struct *info )
spin_unlock_irqrestore(&info->irq_spinlock,flags); spin_unlock_irqrestore(&info->irq_spinlock,flags);
while ( !(status & (BIT6+BIT5+BIT4+BIT2+BIT1)) ) { while ( !(status & (BIT6+BIT5+BIT4+BIT2+BIT1)) ) {
if ( jiffies > EndTime ) { if (time_after(jiffies, EndTime)) {
rc = FALSE; rc = FALSE;
break; break;
} }
...@@ -7617,8 +7614,7 @@ BOOLEAN mgsl_dma_test( struct mgsl_struct *info ) ...@@ -7617,8 +7614,7 @@ BOOLEAN mgsl_dma_test( struct mgsl_struct *info )
/* Wait for 16C32 to write receive status to buffer entry. */ /* Wait for 16C32 to write receive status to buffer entry. */
status=info->rx_buffer_list[0].status; status=info->rx_buffer_list[0].status;
while ( status == 0 ) { while ( status == 0 ) {
if ( jiffies > EndTime ) { if (time_after(jiffies, EndTime)) {
printk(KERN_ERR"mark 4\n");
rc = FALSE; rc = FALSE;
break; break;
} }
......
/* /*
* $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 * Device driver for Microgate SyncLink Multiport
* high speed multiprotocol serial adapter. * high speed multiprotocol serial adapter.
...@@ -503,7 +503,7 @@ MODULE_PARM(maxframe,"1-" __MODULE_STRING(MAX_DEVICES) "i"); ...@@ -503,7 +503,7 @@ MODULE_PARM(maxframe,"1-" __MODULE_STRING(MAX_DEVICES) "i");
MODULE_PARM(dosyncppp,"1-" __MODULE_STRING(MAX_DEVICES) "i"); MODULE_PARM(dosyncppp,"1-" __MODULE_STRING(MAX_DEVICES) "i");
static char *driver_name = "SyncLink MultiPort driver"; 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 int synclinkmp_init_one(struct pci_dev *dev,const struct pci_device_id *ent);
static void synclinkmp_remove_one(struct pci_dev *dev); static void synclinkmp_remove_one(struct pci_dev *dev);
...@@ -1204,7 +1204,7 @@ static void wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -1204,7 +1204,7 @@ static void wait_until_sent(struct tty_struct *tty, int timeout)
schedule_timeout(char_time); schedule_timeout(char_time);
if (signal_pending(current)) if (signal_pending(current))
break; break;
if (timeout && ((orig_jiffies + timeout) < jiffies)) if (timeout && time_after(jiffies, orig_jiffies + timeout))
break; break;
} }
} else { } else {
...@@ -1215,7 +1215,7 @@ static void wait_until_sent(struct tty_struct *tty, int timeout) ...@@ -1215,7 +1215,7 @@ static void wait_until_sent(struct tty_struct *tty, int timeout)
schedule_timeout(char_time); schedule_timeout(char_time);
if (signal_pending(current)) if (signal_pending(current))
break; break;
if (timeout && ((orig_jiffies + timeout) < jiffies)) if (timeout && time_after(jiffies, orig_jiffies + timeout))
break; break;
} }
} }
...@@ -2605,18 +2605,11 @@ static int startup(SLMP_INFO * info) ...@@ -2605,18 +2605,11 @@ static int startup(SLMP_INFO * info)
info->pending_bh = 0; 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 */ /* program hardware for current parameters */
reset_port(info); reset_port(info);
change_params(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); info->status_timer.expires = jiffies + jiffies_from_ms(10);
add_timer(&info->status_timer); add_timer(&info->status_timer);
...@@ -3304,12 +3297,12 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, ...@@ -3304,12 +3297,12 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
printk("%s(%d):%s block_til_ready() before block, count=%d\n", printk("%s(%d):%s block_til_ready() before block, count=%d\n",
__FILE__,__LINE__, tty->driver.name, info->count ); __FILE__,__LINE__, tty->driver.name, info->count );
save_flags(flags); cli(); spin_lock_irqsave(&info->lock, flags);
if (!tty_hung_up_p(filp)) { if (!tty_hung_up_p(filp)) {
extra_count = 1; extra_count = 1;
info->count--; info->count--;
} }
restore_flags(flags); spin_unlock_irqrestore(&info->lock, flags);
info->blocked_open++; info->blocked_open++;
while (1) { while (1) {
...@@ -3772,6 +3765,14 @@ SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev) ...@@ -3772,6 +3765,14 @@ SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev)
info->bus_type = MGSL_BUS_TYPE_PCI; info->bus_type = MGSL_BUS_TYPE_PCI;
info->irq_flags = SA_SHIRQ; 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 /* Store the PCI9050 misc control register value because a flaw
* in the PCI9050 prevents LCR registers from being read if * in the PCI9050 prevents LCR registers from being read if
* BIOS assigns an LCR base address with bit 7 set. * BIOS assigns an LCR base address with bit 7 set.
...@@ -3959,15 +3960,13 @@ static void __exit synclinkmp_exit(void) ...@@ -3959,15 +3960,13 @@ static void __exit synclinkmp_exit(void)
SLMP_INFO *tmp; SLMP_INFO *tmp;
printk("Unloading %s %s\n", driver_name, driver_version); printk("Unloading %s %s\n", driver_name, driver_version);
save_flags(flags);
cli();
if ((rc = tty_unregister_driver(&serial_driver))) if ((rc = tty_unregister_driver(&serial_driver)))
printk("%s(%d) failed to unregister tty driver err=%d\n", printk("%s(%d) failed to unregister tty driver err=%d\n",
__FILE__,__LINE__,rc); __FILE__,__LINE__,rc);
if ((rc = tty_unregister_driver(&callout_driver))) if ((rc = tty_unregister_driver(&callout_driver)))
printk("%s(%d) failed to unregister callout driver err=%d\n", printk("%s(%d) failed to unregister callout driver err=%d\n",
__FILE__,__LINE__,rc); __FILE__,__LINE__,rc);
restore_flags(flags);
info = synclinkmp_device_list; info = synclinkmp_device_list;
while(info) { while(info) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment