drivers: atm, char fix integer as NULL pointer warnings
[safe/jmp/linux-2.6] / drivers / atm / iphase.c
index 9ed1c60..5c28ca7 100644 (file)
@@ -60,7 +60,8 @@
 #include <asm/uaccess.h>  
 #include <asm/string.h>  
 #include <asm/byteorder.h>  
-#include <linux/vmalloc.h>  
+#include <linux/vmalloc.h>
+#include <linux/jiffies.h>
 #include "iphase.h"              
 #include "suni.h"                
 #define swap(x) (((x & 0xff) << 8) | ((x & 0xff00) >> 8))  
@@ -189,7 +190,7 @@ static u16 get_desc (IADEV *dev, struct ia_vcc *iavcc) {
   int ltimeout;
 
   ia_hack_tcq (dev);
-  if(((jiffies - timer)>50)||((dev->ffL.tcq_rd==dev->host_tcq_wr))){      
+  if((time_after(jiffies,timer+50)) || ((dev->ffL.tcq_rd==dev->host_tcq_wr))) {
      timer = jiffies; 
      i=0;
      while (i < dev->num_tx_desc) {
@@ -305,7 +306,7 @@ static void clear_lockup (struct atm_vcc *vcc, IADEV *dev) {
 **  |  R | NZ |  5-bit exponent  |        9-bit mantissa         |
 **  +----+----+------------------+-------------------------------+
 ** 
-**    R = reserverd (written as 0)
+**    R = reserved (written as 0)
 **    NZ = 0 if 0 cells/sec; 1 otherwise
 **
 **    if NZ = 1, rate = 1.mmmmmmmmm x 2^(eeeee) cells/sec
@@ -958,6 +959,7 @@ static void ia_suni_pm7345_init (IADEV *iadev)
 
 /***************************** IA_LIB END *****************************/
     
+#ifdef CONFIG_ATM_IA_DEBUG
 static int tcnter = 0;
 static void xdump( u_char*  cp, int  length, char*  prefix )
 {
@@ -992,6 +994,7 @@ static void xdump( u_char*  cp, int  length, char*  prefix )
     }
 
 }  /* close xdump(... */
+#endif /* CONFIG_ATM_IA_DEBUG */
 
   
 static struct atm_dev *ia_boards = NULL;  
@@ -1223,7 +1226,7 @@ static void rx_intr(struct atm_dev *dev)
         iadev->rx_tmp_jif = jiffies; 
         iadev->rxing = 0;
      } 
-     else if (((jiffies - iadev->rx_tmp_jif) > 50) && 
+     else if ((time_after(jiffies, iadev->rx_tmp_jif + 50)) &&
                ((iadev->rx_pkt_cnt - iadev->rx_tmp_cnt) == 0)) {
         for (i = 1; i <= iadev->num_rx_desc; i++)
                free_desc(dev, i);
@@ -1601,14 +1604,14 @@ static int rx_init(struct atm_dev *dev)
   
        skb_queue_head_init(&iadev->rx_dma_q);  
        iadev->rx_free_desc_qhead = NULL;   
-       iadev->rx_open = kmalloc(4*iadev->num_vc,GFP_KERNEL);
-       if (!iadev->rx_open)  
-       {  
+
+       iadev->rx_open = kzalloc(4 * iadev->num_vc, GFP_KERNEL);
+       if (!iadev->rx_open) {
                printk(KERN_ERR DEV_LABEL "itf %d couldn't get free page\n",
                dev->number);  
                goto err_free_dle;
        }  
-       memset(iadev->rx_open, 0, 4*iadev->num_vc);  
+
         iadev->rxing = 1;
         iadev->rx_pkt_cnt = 0;
        /* Mode Register */  
@@ -2290,7 +2293,6 @@ static int __devinit ia_init(struct atm_dev *dev)
        unsigned long real_base;
        void __iomem *base;
        unsigned short command;  
-       unsigned char revision;  
        int error, i; 
          
        /* The device has been identified and registered. Now we read   
@@ -2305,16 +2307,14 @@ static int __devinit ia_init(struct atm_dev *dev)
        real_base = pci_resource_start (iadev->pci, 0);
        iadev->irq = iadev->pci->irq;
                  
-       if ((error = pci_read_config_word(iadev->pci, PCI_COMMAND,&command))   
-                   || (error = pci_read_config_byte(iadev->pci,   
-                               PCI_REVISION_ID,&revision)))   
-       {  
+       error = pci_read_config_word(iadev->pci, PCI_COMMAND, &command);
+       if (error) {
                printk(KERN_ERR DEV_LABEL "(itf %d): init error 0x%x\n",  
                                dev->number,error);  
                return -EINVAL;  
        }  
        IF_INIT(printk(DEV_LABEL "(itf %d): rev.%d,realbase=0x%lx,irq=%d\n",  
-                       dev->number, revision, real_base, iadev->irq);)  
+                       dev->number, iadev->pci->revision, real_base, iadev->irq);)
          
        /* find mapping size of board */  
          
@@ -2353,7 +2353,7 @@ static int __devinit ia_init(struct atm_dev *dev)
                return error;  
        }  
        IF_INIT(printk(DEV_LABEL " (itf %d): rev.%d,base=%p,irq=%d\n",  
-                       dev->number, revision, base, iadev->irq);)  
+                       dev->number, iadev->pci->revision, base, iadev->irq);)
          
        /* filling the iphase dev structure */  
        iadev->mem = iadev->pci_map_size /2;  
@@ -3174,12 +3174,12 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
         unsigned long flags;
        int ret;
 
-       iadev = kmalloc(sizeof(*iadev), GFP_KERNEL); 
+       iadev = kzalloc(sizeof(*iadev), GFP_KERNEL);
        if (!iadev) {
                ret = -ENOMEM;
                goto err_out;
        }
-       memset(iadev, 0, sizeof(*iadev));
+
        iadev->pci = pdev;
 
        IF_INIT(printk("ia detected at bus:%d dev: %d function:%d\n",