fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / atm / zatm.c
index f484747..756d4f7 100644 (file)
@@ -3,7 +3,6 @@
 /* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
 
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -604,9 +603,8 @@ static int start_rx(struct atm_dev *dev)
 DPRINTK("start_rx\n");
        zatm_dev = ZATM_DEV(dev);
        size = sizeof(struct atm_vcc *)*zatm_dev->chans;
-       zatm_dev->rx_map = (struct atm_vcc **) kmalloc(size,GFP_KERNEL);
+       zatm_dev->rx_map =  kzalloc(size,GFP_KERNEL);
        if (!zatm_dev->rx_map) return -ENOMEM;
-       memset(zatm_dev->rx_map,0,size);
        /* set VPI/VCI split (use all VCIs and give what's left to VPIs) */
        zpokel(zatm_dev,(1 << dev->ci_range.vci_bits)-1,uPD98401_VRR);
        /* prepare free buffer pools */
@@ -802,6 +800,7 @@ static int alloc_shaper(struct atm_dev *dev,int *pcr,int min,int max,int ubr)
                i = m = 1;
                zatm_dev->ubr_ref_cnt++;
                zatm_dev->ubr = shaper;
+               *pcr = 0;
        }
        else {
                if (min) {
@@ -952,9 +951,8 @@ static int open_tx_first(struct atm_vcc *vcc)
        skb_queue_head_init(&zatm_vcc->tx_queue);
        init_waitqueue_head(&zatm_vcc->tx_wait);
        /* initialize ring */
-       zatm_vcc->ring = kmalloc(RING_SIZE,GFP_KERNEL);
+       zatm_vcc->ring = kzalloc(RING_SIZE,GFP_KERNEL);
        if (!zatm_vcc->ring) return -ENOMEM;
-       memset(zatm_vcc->ring,0,RING_SIZE);
        loop = zatm_vcc->ring+RING_ENTRIES*RING_WORDS;
        loop[0] = uPD98401_TXPD_V;
        loop[1] = loop[2] = 0;
@@ -998,7 +996,7 @@ static int start_tx(struct atm_dev *dev)
 
        DPRINTK("start_tx\n");
        zatm_dev = ZATM_DEV(dev);
-       zatm_dev->tx_map = (struct atm_vcc **) kmalloc(sizeof(struct atm_vcc *)*
+       zatm_dev->tx_map = kmalloc(sizeof(struct atm_vcc *)*
            zatm_dev->chans,GFP_KERNEL);
        if (!zatm_dev->tx_map) return -ENOMEM;
        zatm_dev->tx_bw = ATM_OC3_PCR;
@@ -1014,7 +1012,7 @@ static int start_tx(struct atm_dev *dev)
 /*------------------------------- interrupts --------------------------------*/
 
 
-static irqreturn_t zatm_int(int irq,void *dev_id,struct pt_regs *regs)
+static irqreturn_t zatm_int(int irq,void *dev_id)
 {
        struct atm_dev *dev;
        struct zatm_dev *zatm_dev;
@@ -1271,7 +1269,7 @@ static int __init zatm_start(struct atm_dev *dev)
        zatm_dev->rx_map = zatm_dev->tx_map = NULL;
        for (i = 0; i < NR_MBX; i++)
                zatm_dev->mbx_start[i] = 0;
-       error = request_irq(zatm_dev->irq, zatm_int, SA_SHIRQ, DEV_LABEL, dev);
+       error = request_irq(zatm_dev->irq, zatm_int, IRQF_SHARED, DEV_LABEL, dev);
        if (error < 0) {
                printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n",
                    dev->number,zatm_dev->irq);
@@ -1593,7 +1591,7 @@ static int __devinit zatm_init_one(struct pci_dev *pci_dev,
        struct zatm_dev *zatm_dev;
        int ret = -ENOMEM;
 
-       zatm_dev = (struct zatm_dev *) kmalloc(sizeof(*zatm_dev), GFP_KERNEL);
+       zatm_dev = kmalloc(sizeof(*zatm_dev), GFP_KERNEL);
        if (!zatm_dev) {
                printk(KERN_EMERG "%s: memory shortage\n", DEV_LABEL);
                goto out;