drivers/atm/eni.c: Remove multiple uses of KERN_<level>
[linux-2.6.git] / drivers / atm / eni.c
index 10da369..97c5898 100644 (file)
@@ -4,7 +4,6 @@
  
 
 #include <linux/module.h>
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/pci.h>
@@ -19,6 +18,7 @@
 #include <linux/init.h>
 #include <linux/atm_eni.h>
 #include <linux/bitops.h>
+#include <linux/slab.h>
 #include <asm/system.h>
 #include <asm/io.h>
 #include <asm/atomic.h>
@@ -537,7 +537,7 @@ static int rx_aal0(struct atm_vcc *vcc)
                return 0;
        }
        skb_put(skb,length);
-       skb->stamp = eni_vcc->timestamp;
+       skb->tstamp = eni_vcc->timestamp;
        DPRINTK("got len %ld\n",length);
        if (do_rx_dma(vcc,skb,1,length >> 2,length >> 2)) return 1;
        eni_vcc->rxing++;
@@ -702,7 +702,7 @@ static void get_service(struct atm_dev *dev)
                        DPRINTK("Grr, servicing VCC %ld twice\n",vci);
                        continue;
                }
-               do_gettimeofday(&ENI_VCC(vcc)->timestamp);
+               ENI_VCC(vcc)->timestamp = ktime_get_real();
                ENI_VCC(vcc)->next = NULL;
                if (vcc->qos.rxtp.traffic_class == ATM_CBR) {
                        if (eni_dev->fast)
@@ -913,7 +913,6 @@ static int start_rx(struct atm_dev *dev)
                free_page((unsigned long) eni_dev->free_list);
                return -ENOMEM;
        }
-       memset(eni_dev->rx_map,0,PAGE_SIZE);
        eni_dev->rx_mult = DEFAULT_RX_MULT;
        eni_dev->fast = eni_dev->last_fast = NULL;
        eni_dev->slow = eni_dev->last_slow = NULL;
@@ -1132,7 +1131,7 @@ DPRINTK("doing direct send\n"); /* @@@ well, this doesn't work anyway */
                        if (i == -1)
                                put_dma(tx->index,eni_dev->dma,&j,(unsigned long)
                                    skb->data,
-                                   skb->len - skb->data_len);
+                                   skb_headlen(skb));
                        else
                                put_dma(tx->index,eni_dev->dma,&j,(unsigned long)
                                    skb_shinfo(skb)->frags[i].page + skb_shinfo(skb)->frags[i].page_offset,
@@ -1272,7 +1271,7 @@ static int comp_tx(struct eni_dev *eni_dev,int *pcr,int reserved,int *pre,
                        if (*pre < 3) (*pre)++; /* else fail later */
                        div = pre_div[*pre]*-*pcr;
                        DPRINTK("max div %d\n",div);
-                       *res = (TS_CLOCK+div-1)/div-1;
+                       *res = DIV_ROUND_UP(TS_CLOCK, div)-1;
                }
                if (*res < 0) *res = 0;
                if (*res > MID_SEG_MAX_RATE) *res = MID_SEG_MAX_RATE;
@@ -1489,7 +1488,7 @@ static void bug_int(struct atm_dev *dev,unsigned long reason)
 }
 
 
-static irqreturn_t eni_int(int irq,void *dev_id,struct pt_regs *regs)
+static irqreturn_t eni_int(int irq,void *dev_id)
 {
        struct atm_dev *dev;
        struct eni_dev *eni_dev;
@@ -1706,7 +1705,6 @@ static int __devinit eni_do_init(struct atm_dev *dev)
        struct pci_dev *pci_dev;
        unsigned long real_base;
        void __iomem *base;
-       unsigned char revision;
        int error,i,last;
 
        DPRINTK(">eni_init\n");
@@ -1717,12 +1715,6 @@ static int __devinit eni_do_init(struct atm_dev *dev)
        pci_dev = eni_dev->pci_dev;
        real_base = pci_resource_start(pci_dev, 0);
        eni_dev->irq = pci_dev->irq;
-       error = pci_read_config_byte(pci_dev,PCI_REVISION_ID,&revision);
-       if (error) {
-               printk(KERN_ERR DEV_LABEL "(itf %d): init error 0x%02x\n",
-                   dev->number,error);
-               return -EINVAL;
-       }
        if ((error = pci_write_config_word(pci_dev,PCI_COMMAND,
            PCI_COMMAND_MEMORY |
            (eni_dev->asic ? PCI_COMMAND_PARITY | PCI_COMMAND_SERR : 0)))) {
@@ -1731,7 +1723,7 @@ static int __devinit eni_do_init(struct atm_dev *dev)
                return -EIO;
        }
        printk(KERN_NOTICE DEV_LABEL "(itf %d): rev.%d,base=0x%lx,irq=%d,",
-           dev->number,revision,real_base,eni_dev->irq);
+           dev->number,pci_dev->revision,real_base,eni_dev->irq);
        if (!(base = ioremap_nocache(real_base,MAP_MAX_SIZE))) {
                printk("\n");
                printk(KERN_ERR DEV_LABEL "(itf %d): can't set up page "
@@ -1744,10 +1736,12 @@ static int __devinit eni_do_init(struct atm_dev *dev)
                eprom = (base+EPROM_SIZE-sizeof(struct midway_eprom));
                if (readl(&eprom->magic) != ENI155_MAGIC) {
                        printk("\n");
-                       printk(KERN_ERR KERN_ERR DEV_LABEL "(itf %d): bad "
-                           "magic - expected 0x%x, got 0x%x\n",dev->number,
-                           ENI155_MAGIC,(unsigned) readl(&eprom->magic));
-                       return -EINVAL;
+                       printk(KERN_ERR DEV_LABEL
+                              "(itf %d): bad magic - expected 0x%x, got 0x%x\n",
+                              dev->number, ENI155_MAGIC,
+                              (unsigned)readl(&eprom->magic));
+                       error = -EINVAL;
+                       goto unmap;
                }
        }
        eni_dev->phy = base+PHY_BASE;
@@ -1774,17 +1768,27 @@ static int __devinit eni_do_init(struct atm_dev *dev)
                printk(")\n");
                printk(KERN_ERR DEV_LABEL "(itf %d): ERROR - wrong id 0x%x\n",
                    dev->number,(unsigned) eni_in(MID_RES_ID_MCON));
-               return -EINVAL;
+               error = -EINVAL;
+               goto unmap;
        }
        error = eni_dev->asic ? get_esi_asic(dev) : get_esi_fpga(dev,base);
-       if (error) return error;
+       if (error)
+               goto unmap;
        for (i = 0; i < ESI_LEN; i++)
                printk("%s%02X",i ? "-" : "",dev->esi[i]);
        printk(")\n");
        printk(KERN_NOTICE DEV_LABEL "(itf %d): %s,%s\n",dev->number,
            eni_in(MID_RES_ID_MCON) & 0x200 ? "ASIC" : "FPGA",
            media_name[eni_in(MID_RES_ID_MCON) & DAUGTHER_ID]);
-       return suni_init(dev);
+
+       error = suni_init(dev);
+       if (error)
+               goto unmap;
+out:
+       return error;
+unmap:
+       iounmap(base);
+       goto out;
 }
 
 
@@ -1798,7 +1802,7 @@ static int __devinit eni_start(struct atm_dev *dev)
 
        DPRINTK(">eni_start\n");
        eni_dev = ENI_DEV(dev);
-       if (request_irq(eni_dev->irq,&eni_int,SA_SHIRQ,DEV_LABEL,dev)) {
+       if (request_irq(eni_dev->irq,&eni_int,IRQF_SHARED,DEV_LABEL,dev)) {
                printk(KERN_ERR DEV_LABEL "(itf %d): IRQ%d is already in use\n",
                    dev->number,eni_dev->irq);
                error = -EAGAIN;
@@ -1833,7 +1837,7 @@ static int __devinit eni_start(struct atm_dev *dev)
        /* initialize memory management */
        buffer_mem = eni_dev->mem - (buf - eni_dev->ram);
        eni_dev->free_list_size = buffer_mem/MID_MIN_BUF_SIZE/2;
-       eni_dev->free_list = (struct eni_free *) kmalloc(
+       eni_dev->free_list = kmalloc(
            sizeof(struct eni_free)*(eni_dev->free_list_size+1),GFP_KERNEL);
        if (!eni_dev->free_list) {
                printk(KERN_ERR DEV_LABEL "(itf %d): couldn't get free page\n",
@@ -2029,7 +2033,7 @@ static int eni_getsockopt(struct atm_vcc *vcc,int level,int optname,
 
 
 static int eni_setsockopt(struct atm_vcc *vcc,int level,int optname,
-    void __user *optval,int optlen)
+    void __user *optval,unsigned int optlen)
 {
        return -EINVAL;
 }
@@ -2233,7 +2237,7 @@ static int __devinit eni_init_one(struct pci_dev *pci_dev,
                goto out0;
        }
 
-       eni_dev = (struct eni_dev *) kmalloc(sizeof(struct eni_dev),GFP_KERNEL);
+       eni_dev = kmalloc(sizeof(struct eni_dev),GFP_KERNEL);
        if (!eni_dev) goto out0;
        if (!cpu_zeroes) {
                cpu_zeroes = pci_alloc_consistent(pci_dev,ENI_ZEROES_SIZE,
@@ -2266,10 +2270,8 @@ out0:
 
 
 static struct pci_device_id eni_pci_tbl[] = {
-       { PCI_VENDOR_ID_EF, PCI_DEVICE_ID_EF_ATM_FPGA, PCI_ANY_ID, PCI_ANY_ID,
-         0, 0, 0 /* FPGA */ },
-       { PCI_VENDOR_ID_EF, PCI_DEVICE_ID_EF_ATM_ASIC, PCI_ANY_ID, PCI_ANY_ID,
-         0, 0, 1 /* ASIC */ },
+       { PCI_VDEVICE(EF, PCI_DEVICE_ID_EF_ATM_FPGA), 0 /* FPGA */ },
+       { PCI_VDEVICE(EF, PCI_DEVICE_ID_EF_ATM_ASIC), 1 /* ASIC */ },
        { 0, }
 };
 MODULE_DEVICE_TABLE(pci,eni_pci_tbl);