Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / net / eth16i.c
index ccae6ba..b67545b 100644 (file)
@@ -161,6 +161,7 @@ static char *version =
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 #include <linux/bitops.h>
+#include <linux/jiffies.h>
 
 #include <asm/system.h>                  
 #include <asm/io.h>              
@@ -473,13 +474,7 @@ struct net_device * __init eth16i_probe(int unit)
        err = do_eth16i_probe(dev);
        if (err)
                goto out;
-       err = register_netdev(dev);
-       if (err)
-               goto out1;
        return dev;
-out1:
-       free_irq(dev->irq, dev);
-       release_region(dev->base_addr, ETH16I_IO_EXTENT);
 out:
        free_netdev(dev);
        return ERR_PTR(err);
@@ -569,7 +564,13 @@ static int __init eth16i_probe1(struct net_device *dev, int ioaddr)
        dev->tx_timeout         = eth16i_timeout;
        dev->watchdog_timeo     = TX_TIMEOUT;
        spin_lock_init(&lp->lock);
+
+       retval = register_netdev(dev);
+       if (retval)
+               goto out1;
        return 0;
+out1:
+       free_irq(dev->irq, dev);
 out:
        release_region(ioaddr, ETH16I_IO_EXTENT);
        return retval;
@@ -754,7 +755,7 @@ static void eth16i_set_port(int ioaddr, int porttype)
 
 static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l)
 {
-       int starttime;
+       unsigned long starttime;
 
        outb(0xff, ioaddr + TX_STATUS_REG);
 
@@ -765,7 +766,7 @@ static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l)
        outb(TX_START | 1, ioaddr + TRANSMIT_START_REG); 
 
        while( (inb(ioaddr + TX_STATUS_REG) & 0x80) == 0) {
-               if( (jiffies - starttime) > TX_TIMEOUT) {
+               if( time_after(jiffies, starttime + TX_TIMEOUT)) {
                        return -1;
                }
        }
@@ -775,18 +776,18 @@ static int eth16i_send_probe_packet(int ioaddr, unsigned char *b, int l)
 
 static int eth16i_receive_probe_packet(int ioaddr)
 {
-       int starttime;
+       unsigned long starttime;
 
        starttime = jiffies;
 
        while((inb(ioaddr + TX_STATUS_REG) & 0x20) == 0) {
-               if( (jiffies - starttime) > TX_TIMEOUT) {
+               if( time_after(jiffies, starttime + TX_TIMEOUT)) {
 
                        if(eth16i_debug > 1)
                                printk(KERN_DEBUG "Timeout occurred waiting transmit packet received\n");
                        starttime = jiffies;
                        while((inb(ioaddr + RX_STATUS_REG) & 0x80) == 0) {
-                               if( (jiffies - starttime) > TX_TIMEOUT) {
+                               if( time_after(jiffies, starttime + TX_TIMEOUT)) {
                                        if(eth16i_debug > 1)
                                                printk(KERN_DEBUG "Timeout occurred waiting receive packet\n");
                                        return -1;
@@ -1462,12 +1463,8 @@ int init_module(void)
                }
 
                if (do_eth16i_probe(dev) == 0) {
-                       if (register_netdev(dev) == 0) {
-                               dev_eth16i[found++] = dev;
-                               continue;
-                       }
-                       free_irq(dev->irq, dev);
-                       release_region(dev->base_addr, ETH16I_IO_EXTENT);
+                       dev_eth16i[found++] = dev;
+                       continue;
                }
                printk(KERN_WARNING "eth16i.c No Eth16i card found (i/o = 0x%x).\n",
                       io[this_dev]);