patch-2.2.10 linux/drivers/net/cosa.c

Next file: linux/drivers/net/cs89x0.c
Previous file: linux/drivers/net/Space.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.9/linux/drivers/net/cosa.c linux/drivers/net/cosa.c
@@ -1,7 +1,10 @@
-/* $Id: cosa.c,v 1.21 1999/02/06 19:49:18 kas Exp $ */
+/* $Id: cosa.c,v 1.24 1999/05/28 17:28:34 kas Exp $ */
 
 /*
  *  Copyright (C) 1995-1997  Jan "Yenya" Kasprzak <kas@fi.muni.cz>
+ * 
+ * 	5/25/1999 : Marcelo Tosatti <marcelo@conectiva.com.br>
+ * 		fixed a deadlock in cosa_sppp_open 
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -72,6 +75,10 @@
  * The Comtrol Hostess SV11 driver by Alan Cox
  * The Sync PPP/Cisco HDLC layer (syncppp.c) ported to Linux by Alan Cox
  */
+/*
+ *     5/25/1999 : Marcelo Tosatti <marcelo@conectiva.com.br>
+ *             fixed a deadlock in cosa_sppp_open
+ */
 
 /* ---------- Headers, macros, data structures ---------- */
 
@@ -598,6 +605,7 @@
 	if (chan->usage != 0) {
 		printk(KERN_WARNING "%s: sppp_open called with usage count %d\n",
 			chan->name, chan->usage);
+		spin_unlock_irqrestore(&chan->cosa->lock, flags);
 		return -EBUSY;
 	}
 	chan->setup_rx = sppp_setup_rx;
@@ -749,8 +757,13 @@
 
 static void chardev_channel_init(struct channel_data *chan)
 {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)
 	chan->rsem = MUTEX;
 	chan->wsem = MUTEX;
+#else
+	init_MUTEX(&chan->rsem);
+	init_MUTEX(&chan->wsem);
+#endif
 }
 
 static long long cosa_lseek(struct file * file,
@@ -1260,8 +1273,10 @@
 			debug_status_out(cosa, 0);
 #endif
 		}
+		cosa_putdata8(cosa, 0);
 		cosa_putdata8(cosa, status);
 #ifdef DEBUG_IO
+		debug_data_cmd(cosa, 0);
 		debug_data_cmd(cosa, status);
 #endif
 	}
@@ -1654,6 +1669,7 @@
 				printk(KERN_WARNING
 					"%s: No channel wants data in TX IRQ\n",
 					cosa->name);
+				put_driver_status_nolock(cosa);
 				clear_bit(TXBIT, &cosa->rxtx);
 				spin_unlock_irqrestore(&cosa->lock, flags);
 				return;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)