fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / net / apne.c
index a94216b..9541911 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
+#include <linux/jiffies.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -87,7 +88,7 @@ static void apne_block_input(struct net_device *dev, int count,
                                                                struct sk_buff *skb, int ring_offset);
 static void apne_block_output(struct net_device *dev, const int count,
                                                        const unsigned char *buf, const int start_page);
-static irqreturn_t apne_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+static irqreturn_t apne_interrupt(int irq, void *dev_id);
 
 static int init_pcmcia(void);
 
@@ -131,9 +132,9 @@ struct net_device * __init apne_probe(int unit)
 
        if ( !(AMIGAHW_PRESENT(PCMCIA)) )
                return ERR_PTR(-ENODEV);
-                                
+
        printk("Looking for PCMCIA ethernet card : ");
-                                        
+
        /* check if a card is inserted */
        if (!(PCMCIA_INSERTED)) {
                printk("NO PCMCIA card inserted\n");
@@ -204,7 +205,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
     int neX000, ctron;
 #endif
     static unsigned version_printed;
+
     if (ei_debug  &&  version_printed++ == 0)
        printk(version);
 
@@ -216,7 +217,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
        outb(inb(ioaddr + NE_RESET), ioaddr + NE_RESET);
 
        while ((inb(ioaddr + NE_EN0_ISR) & ENISR_RESET) == 0)
-               if (jiffies - reset_start_time > 2*HZ/100) {
+               if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
                        printk(" not found (no reset ack).\n");
                        return -ENODEV;
                }
@@ -260,13 +261,13 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
 
     /* At this point, wordlength *only* tells us if the SA_prom is doubled
        up or not because some broken PCI cards don't respect the byte-wide
-       request in program_seq above, and hence don't have doubled up values. 
+       request in program_seq above, and hence don't have doubled up values.
        These broken cards would otherwise be detected as an ne1000.  */
 
     if (wordlength == 2)
        for (i = 0; i < 16; i++)
                SA_prom[i] = SA_prom[i+i];
-    
+
     if (wordlength == 2) {
        /* We must set the 8390 for word mode. */
        outb(0x49, ioaddr + NE_EN0_DCFG);
@@ -310,9 +311,10 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
 #endif
 
     dev->base_addr = ioaddr;
+    dev->irq = IRQ_AMIGA_PORTS;
 
     /* Install the Interrupt handler */
-    i = request_irq(IRQ_AMIGA_PORTS, apne_interrupt, SA_SHIRQ, DRV_NAME, dev);
+    i = request_irq(dev->irq, apne_interrupt, IRQF_SHARED, DRV_NAME, dev);
     if (i) return i;
 
     for(i = 0; i < ETHER_ADDR_LEN; i++) {
@@ -382,7 +384,7 @@ apne_reset_8390(struct net_device *dev)
 
     /* This check _should_not_ be necessary, omit eventually. */
     while ((inb(NE_BASE+NE_EN0_ISR) & ENISR_RESET) == 0)
-       if (jiffies - reset_start_time > 2*HZ/100) {
+       if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
            printk("%s: ne_reset_8390() did not complete.\n", dev->name);
            break;
        }
@@ -530,7 +532,7 @@ apne_block_output(struct net_device *dev, int count,
     dma_start = jiffies;
 
     while ((inb(NE_BASE + NE_EN0_ISR) & ENISR_RDC) == 0)
-       if (jiffies - dma_start > 2*HZ/100) {           /* 20ms */
+       if (time_after(jiffies, dma_start + 2*HZ/100)) {        /* 20ms */
                printk("%s: timeout waiting for Tx RDC.\n", dev->name);
                apne_reset_8390(dev);
                NS8390_init(dev,1);
@@ -542,7 +544,7 @@ apne_block_output(struct net_device *dev, int count,
     return;
 }
 
-static irqreturn_t apne_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t apne_interrupt(int irq, void *dev_id)
 {
     unsigned char pcmcia_intreq;
 
@@ -558,7 +560,7 @@ static irqreturn_t apne_interrupt(int irq, void *dev_id, struct pt_regs *regs)
     if (ei_debug > 3)
         printk("pcmcia intreq = %x\n", pcmcia_intreq);
     pcmcia_disable_irq();                      /* to get rid of the sti() within ei_interrupt */
-    ei_interrupt(irq, dev_id, regs);
+    ei_interrupt(irq, dev_id);
     pcmcia_ack_int(pcmcia_get_intreq());
     pcmcia_enable_irq();
     return IRQ_HANDLED;
@@ -567,7 +569,7 @@ static irqreturn_t apne_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 #ifdef MODULE
 static struct net_device *apne_dev;
 
-int init_module(void)
+int __init init_module(void)
 {
        apne_dev = apne_probe(-1);
        if (IS_ERR(apne_dev))
@@ -575,7 +577,7 @@ int init_module(void)
        return 0;
 }
 
-void cleanup_module(void)
+void __exit cleanup_module(void)
 {
        unregister_netdev(apne_dev);