patch-2.0.16 linux/drivers/isdn/icn/icn.c

Next file: linux/drivers/isdn/icn/icn.h
Previous file: linux/drivers/block/floppy.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.15/linux/drivers/isdn/icn/icn.c linux/drivers/isdn/icn/icn.c
@@ -1,4 +1,4 @@
-/* $Id: icn.c,v 1.28 1996/06/28 17:02:53 fritz Exp $
+/* $Id: icn.c,v 1.29 1996/08/29 20:34:54 fritz Exp $
  *
  * ISDN low-level module for the ICN active ISDN-Card.
  *
@@ -19,6 +19,11 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
  *
  * $Log: icn.c,v $
+ * Revision 1.29  1996/08/29 20:34:54  fritz
+ * Bugfix in send queue management:
+ * sndcount was not updated correctly.
+ * Minor Bugfixes.
+ *
  * Revision 1.28  1996/06/28 17:02:53  fritz
  * replaced memcpy_fromfs_toio.
  *
@@ -136,7 +141,7 @@
 #undef MAP_DEBUG
 
 static char
-*revision = "$Revision: 1.28 $";
+*revision = "$Revision: 1.29 $";
 
 static int icn_addcard(int, char *, char *);
 
@@ -675,9 +680,7 @@
 /* Append a packet to the transmit buffer-queue.
  * Parameters:
  *   channel = Number of B-channel
- *   buffer  = pointer to packet
- *   len     = size of packet (max 4000)
- *   user    = 1 = call from userproc, 0 = call from kernel
+ *   skb     = pointer to sk_buff
  *   card    = pointer to card-struct
  * Return:
  *   Number of bytes transferred, -E??? on error
@@ -701,19 +704,25 @@
                         return 0;
                 save_flags(flags);
                 cli();
-                card->sndcount[channel] += len;
                 nskb = skb_clone(skb, GFP_ATOMIC);
                 if (nskb) {
-                   skb_queue_tail(&card->spqueue[channel], nskb);
-                   dev_kfree_skb(skb, FREE_WRITE);
-                }
+                        skb_queue_tail(&card->spqueue[channel], nskb);
+                        dev_kfree_skb(skb, FREE_WRITE);
+                } else
+                        len = 0;
+                card->sndcount[channel] += len;
                 restore_flags(flags);
-                if (!nskb) 
-                   return 0;
         }
         return len;
 }
 
+/*
+ * Check card's status after starting the bootstrap loader.
+ * On entry, the card's shared memory has already to be mapped.
+ * Return:
+ *   0 on success (Boot loader ready)
+ *   -EIO on failure (timeout)
+ */
 static int icn_check_loader(int cardnumber)
 {
         int timer = 0;
@@ -1162,7 +1171,19 @@
                         case ICN_IOCTL_GETDOUBLE:
                                 return (int) card->doubleS0;
                         case ICN_IOCTL_DEBUGVAR:
-                                return (ulong) card;
+				if ((i = verify_area(VERIFY_WRITE,
+                                                    (void *) a,
+                                                    sizeof(ulong) * 2)))
+                                        return i;
+                                memcpy_tofs((char *)a,
+                                            (char *)&card, sizeof(ulong));
+				a += sizeof(ulong);
+				{
+                                        ulong l = (ulong)&dev;
+                                        memcpy_tofs((char *)a,
+                                                    (char *)&l, sizeof(ulong));
+                                }
+                                return 0;
                         case ICN_IOCTL_LOADBOOT:
                                 icn_stopcard(card);
                                 return (icn_loadboot((u_char *) a, card));
@@ -1630,7 +1651,7 @@
                 }
                 card = card->next;
         }
-        card = card;
+        card = cards;
         while (card) {
                 last = card;
                 card = card->next;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov