libata-sff: separate out BMDMA qc_issue
[safe/jmp/linux-2.6] / drivers / atm / idt77252.c
index b967919..98657a6 100644 (file)
@@ -1,8 +1,4 @@
 /******************************************************************* 
- * ident "$Id: idt77252.c,v 1.2 2001/11/11 08:13:54 ecd Exp $"
- *
- * $Author: ecd $
- * $Date: 2001/11/11 08:13:54 $
  *
  * Copyright (c) 2000 ATecoM GmbH 
  *
@@ -29,9 +25,6 @@
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  *******************************************************************/
-static char const rcsid[] =
-"$Id: idt77252.c,v 1.2 2001/11/11 08:13:54 ecd Exp $";
-
 
 #include <linux/module.h>
 #include <linux/pci.h>
@@ -48,6 +41,7 @@ static char const rcsid[] =
 #include <linux/wait.h>
 #include <linux/jiffies.h>
 #include <linux/mutex.h>
+#include <linux/slab.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -1121,11 +1115,8 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
 
        rpp = &vc->rcv.rx_pool;
 
+       __skb_queue_tail(&rpp->queue, skb);
        rpp->len += skb->len;
-       if (!rpp->count++)
-               rpp->first = skb;
-       *rpp->last = skb;
-       rpp->last = &skb->next;
 
        if (stat & SAR_RSQE_EPDU) {
                unsigned char *l1l2;
@@ -1152,7 +1143,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
                        atomic_inc(&vcc->stats->rx_err);
                        return;
                }
-               if (rpp->count > 1) {
+               if (skb_queue_len(&rpp->queue) > 1) {
                        struct sk_buff *sb;
 
                        skb = dev_alloc_skb(rpp->len);
@@ -1168,12 +1159,9 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
                                dev_kfree_skb(skb);
                                return;
                        }
-                       sb = rpp->first;
-                       for (i = 0; i < rpp->count; i++) {
+                       skb_queue_walk(&rpp->queue, sb)
                                memcpy(skb_put(skb, sb->len),
                                       sb->data, sb->len);
-                               sb = sb->next;
-                       }
 
                        recycle_rx_pool_skb(card, rpp);
 
@@ -1187,7 +1175,6 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
                        return;
                }
 
-               skb->next = NULL;
                flush_rx_pool(card, rpp);
 
                if (!atm_charge(vcc, skb->truesize)) {
@@ -1925,25 +1912,18 @@ recycle_rx_skb(struct idt77252_dev *card, struct sk_buff *skb)
 static void
 flush_rx_pool(struct idt77252_dev *card, struct rx_pool *rpp)
 {
+       skb_queue_head_init(&rpp->queue);
        rpp->len = 0;
-       rpp->count = 0;
-       rpp->first = NULL;
-       rpp->last = &rpp->first;
 }
 
 static void
 recycle_rx_pool_skb(struct idt77252_dev *card, struct rx_pool *rpp)
 {
-       struct sk_buff *skb, *next;
-       int i;
+       struct sk_buff *skb, *tmp;
 
-       skb = rpp->first;
-       for (i = 0; i < rpp->count; i++) {
-               next = skb->next;
-               skb->next = NULL;
+       skb_queue_walk_safe(&rpp->queue, skb, tmp)
                recycle_rx_skb(card, skb);
-               skb = next;
-       }
+
        flush_rx_pool(card, rpp);
 }
 
@@ -2016,8 +1996,7 @@ idt77252_send_skb(struct atm_vcc *vcc, struct sk_buff *skb, int oam)
        return 0;
 }
 
-int
-idt77252_send(struct atm_vcc *vcc, struct sk_buff *skb)
+static int idt77252_send(struct atm_vcc *vcc, struct sk_buff *skb)
 {
        return idt77252_send_skb(vcc, skb, 0);
 }
@@ -2545,7 +2524,7 @@ idt77252_close(struct atm_vcc *vcc)
                waitfor_idle(card);
                spin_unlock_irqrestore(&card->cmd_lock, flags);
 
-               if (vc->rcv.rx_pool.count) {
+               if (skb_queue_len(&vc->rcv.rx_pool.queue) != 0) {
                        DPRINTK("%s: closing a VC with pending rx buffers.\n",
                                card->name);
 
@@ -2978,7 +2957,7 @@ close_card_oam(struct idt77252_dev *card)
                        waitfor_idle(card);
                        spin_unlock_irqrestore(&card->cmd_lock, flags);
 
-                       if (vc->rcv.rx_pool.count) {
+                       if (skb_queue_len(&vc->rcv.rx_pool.queue) != 0) {
                                DPRINTK("%s: closing a VC "
                                        "with pending rx buffers.\n",
                                        card->name);
@@ -3072,8 +3051,7 @@ idt77252_dev_open(struct idt77252_dev *card)
        return 0;
 }
 
-void
-idt77252_dev_close(struct atm_dev *dev)
+static void idt77252_dev_close(struct atm_dev *dev)
 {
        struct idt77252_dev *card = dev->dev_data;
        u32 conf;
@@ -3580,10 +3558,7 @@ init_card(struct atm_dev *dev)
        if (tmp) {
                memcpy(card->atmdev->esi, tmp->dev_addr, 6);
 
-               printk("%s: ESI %02x:%02x:%02x:%02x:%02x:%02x\n",
-                      card->name, card->atmdev->esi[0], card->atmdev->esi[1],
-                      card->atmdev->esi[2], card->atmdev->esi[3],
-                      card->atmdev->esi[4], card->atmdev->esi[5]);
+               printk("%s: ESI %pM\n", card->name, card->atmdev->esi);
        }
        /*
         * XXX: </hack>