Merge ../linux-2.6-watchdog-mm
[linux-drm-fsl-dcu.git] / drivers / atm / he.c
index a486eb1f1640207c29351a99cddd38ae4684fdca..c7314a79da0fffcedeb9e40ecef63ec14c994b9e 100644 (file)
@@ -55,7 +55,6 @@
 
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/skbuff.h>
@@ -110,7 +109,7 @@ static int he_open(struct atm_vcc *vcc);
 static void he_close(struct atm_vcc *vcc);
 static int he_send(struct atm_vcc *vcc, struct sk_buff *skb);
 static int he_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg);
-static irqreturn_t he_irq_handler(int irq, void *dev_id, struct pt_regs *regs);
+static irqreturn_t he_irq_handler(int irq, void *dev_id);
 static void he_tasklet(unsigned long data);
 static int he_proc_read(struct atm_dev *dev,loff_t *pos,char *page);
 static int he_start(struct atm_dev *dev);
@@ -384,14 +383,12 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent)
        }
        pci_set_drvdata(pci_dev, atm_dev);
 
-       he_dev = (struct he_dev *) kmalloc(sizeof(struct he_dev),
+       he_dev = kzalloc(sizeof(struct he_dev),
                                                        GFP_KERNEL);
        if (!he_dev) {
                err = -ENOMEM;
                goto init_one_failure;
        }
-       memset(he_dev, 0, sizeof(struct he_dev));
-
        he_dev->pci_dev = pci_dev;
        he_dev->atm_dev = atm_dev;
        he_dev->atm_dev->dev_data = he_dev;
@@ -455,7 +452,7 @@ rate_to_atmf(unsigned rate)         /* cps to atm forum format */
        return (NONZERO | (exp << 9) | (rate & 0x1ff));
 }
 
-static void __init
+static void __devinit
 he_init_rx_lbfp0(struct he_dev *he_dev)
 {
        unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
@@ -486,7 +483,7 @@ he_init_rx_lbfp0(struct he_dev *he_dev)
        he_writel(he_dev, he_dev->r0_numbuffs, RLBF0_C);
 }
 
-static void __init
+static void __devinit
 he_init_rx_lbfp1(struct he_dev *he_dev)
 {
        unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
@@ -517,7 +514,7 @@ he_init_rx_lbfp1(struct he_dev *he_dev)
        he_writel(he_dev, he_dev->r1_numbuffs, RLBF1_C);
 }
 
-static void __init
+static void __devinit
 he_init_tx_lbfp(struct he_dev *he_dev)
 {
        unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
@@ -547,7 +544,7 @@ he_init_tx_lbfp(struct he_dev *he_dev)
        he_writel(he_dev, lbufd_index - 1, TLBF_T);
 }
 
-static int __init
+static int __devinit
 he_init_tpdrq(struct he_dev *he_dev)
 {
        he_dev->tpdrq_base = pci_alloc_consistent(he_dev->pci_dev,
@@ -569,7 +566,7 @@ he_init_tpdrq(struct he_dev *he_dev)
        return 0;
 }
 
-static void __init
+static void __devinit
 he_init_cs_block(struct he_dev *he_dev)
 {
        unsigned clock, rate, delta;
@@ -665,7 +662,7 @@ he_init_cs_block(struct he_dev *he_dev)
 
 }
 
-static int __init
+static int __devinit
 he_init_cs_block_rcm(struct he_dev *he_dev)
 {
        unsigned (*rategrid)[16][16];
@@ -786,7 +783,7 @@ he_init_cs_block_rcm(struct he_dev *he_dev)
        return 0;
 }
 
-static int __init
+static int __devinit
 he_init_group(struct he_dev *he_dev, int group)
 {
        int i;
@@ -956,7 +953,7 @@ he_init_group(struct he_dev *he_dev, int group)
        return 0;
 }
 
-static int __init
+static int __devinit
 he_init_irq(struct he_dev *he_dev)
 {
        int i;
@@ -1008,7 +1005,7 @@ he_init_irq(struct he_dev *he_dev)
        he_writel(he_dev, 0x0, GRP_54_MAP);
        he_writel(he_dev, 0x0, GRP_76_MAP);
 
-       if (request_irq(he_dev->pci_dev->irq, he_irq_handler, SA_INTERRUPT|SA_SHIRQ, DEV_LABEL, he_dev)) {
+       if (request_irq(he_dev->pci_dev->irq, he_irq_handler, IRQF_DISABLED|IRQF_SHARED, DEV_LABEL, he_dev)) {
                hprintk("irq %d already in use\n", he_dev->pci_dev->irq);
                return -EINVAL;
        }   
@@ -1913,7 +1910,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
                                skb->tail = skb->data + skb->len;
 #ifdef USE_CHECKSUM_HW
                                if (vcc->vpi == 0 && vcc->vci >= ATM_NOT_RSV_VCI) {
-                                       skb->ip_summed = CHECKSUM_HW;
+                                       skb->ip_summed = CHECKSUM_COMPLETE;
                                        skb->csum = TCP_CKSUM(skb->data,
                                                        he_vcc->pdu_len);
                                }
@@ -1929,7 +1926,9 @@ he_service_rbrq(struct he_dev *he_dev, int group)
 #ifdef notdef
                ATM_SKB(skb)->vcc = vcc;
 #endif
+               spin_unlock(&he_dev->global_lock);
                vcc->push(vcc, skb);
+               spin_lock(&he_dev->global_lock);
 
                atomic_inc(&vcc->stats->rx);
 
@@ -2217,7 +2216,7 @@ he_tasklet(unsigned long data)
 }
 
 static irqreturn_t
-he_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
+he_irq_handler(int irq, void *dev_id)
 {
        unsigned long flags;
        struct he_dev *he_dev = (struct he_dev * )dev_id;
@@ -2283,6 +2282,8 @@ __enqueue_tpd(struct he_dev *he_dev, struct he_tpd *tpd, unsigned cid)
                                TPDRQ_MASK(he_readl(he_dev, TPDRQ_B_H)));
 
                if (new_tail == he_dev->tpdrq_head) {
+                       int slot;
+
                        hprintk("tpdrq full (cid 0x%x)\n", cid);
                        /*
                         * FIXME
@@ -2290,6 +2291,13 @@ __enqueue_tpd(struct he_dev *he_dev, struct he_tpd *tpd, unsigned cid)
                         * after service_tbrq, service the backlog
                         * for now, we just drop the pdu
                         */
+                       for (slot = 0; slot < TPD_MAXIOV; ++slot) {
+                               if (tpd->iovec[slot].addr)
+                                       pci_unmap_single(he_dev->pci_dev,
+                                               tpd->iovec[slot].addr,
+                                               tpd->iovec[slot].len & TPD_LEN_MASK,
+                                                               PCI_DMA_TODEVICE);
+                       }
                        if (tpd->skb) {
                                if (tpd->vcc->pop)
                                        tpd->vcc->pop(tpd->vcc, tpd->skb);