]> err.no Git - linux-2.6/blobdiff - drivers/atm/iphase.c
atm: [iphase] set drvdata before enabling interrupts
[linux-2.6] / drivers / atm / iphase.c
index ef52452640e0b7f9c89594e6a9195653a1eee1a9..800c09e128eeb40a467ec42837960adc4d7b14d5 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) {
@@ -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);
@@ -3195,6 +3198,8 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
        IF_INIT(printk("dev_id = 0x%x iadev->LineRate = %d \n", (u32)dev,
                iadev->LineRate);)
 
+       pci_set_drvdata(pdev, dev);
+
        ia_dev[iadev_count] = iadev;
        _ia_dev[iadev_count] = dev;
        iadev_count++;
@@ -3216,8 +3221,6 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
        iadev->next_board = ia_boards;  
        ia_boards = dev;  
 
-       pci_set_drvdata(pdev, dev);
-
        return 0;
 
 err_out_deregister_dev: