omap: i2c: add a timeout to the busy waiting
[safe/jmp/linux-2.6] / drivers / net / apne.c
index b073810..1437f5d 100644 (file)
@@ -78,9 +78,6 @@
 struct net_device * __init apne_probe(int unit);
 static int apne_probe1(struct net_device *dev, int ioaddr);
 
-static int apne_open(struct net_device *dev);
-static int apne_close(struct net_device *dev);
-
 static void apne_reset_8390(struct net_device *dev);
 static void apne_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
                          int ring_page);
@@ -127,6 +124,9 @@ struct net_device * __init apne_probe(int unit)
 #endif
        int err;
 
+       if (!MACH_IS_AMIGA)
+               return ERR_PTR(-ENODEV);
+
        if (apne_owned)
                return ERR_PTR(-ENODEV);
 
@@ -246,7 +246,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
            {0x00,      NE_EN0_RSARHI},
            {E8390_RREAD+E8390_START, NE_CMD},
        };
-       for (i = 0; i < sizeof(program_seq)/sizeof(program_seq[0]); i++) {
+       for (i = 0; i < ARRAY_SIZE(program_seq); i++) {
            outb(program_seq[i].value, ioaddr + program_seq[i].offset);
        }
 
@@ -311,17 +311,18 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
 
     dev->base_addr = ioaddr;
     dev->irq = IRQ_AMIGA_PORTS;
+    dev->netdev_ops = &ei_netdev_ops;
 
     /* Install the Interrupt handler */
     i = request_irq(dev->irq, apne_interrupt, IRQF_SHARED, DRV_NAME, dev);
     if (i) return i;
 
-    for(i = 0; i < ETHER_ADDR_LEN; i++) {
-       printk(" %2.2x", SA_prom[i]);
+    for(i = 0; i < ETHER_ADDR_LEN; i++)
        dev->dev_addr[i] = SA_prom[i];
-    }
 
-    printk("\n%s: %s found.\n", dev->name, name);
+    printk(" %pM\n", dev->dev_addr);
+
+    printk("%s: %s found.\n", dev->name, name);
 
     ei_status.name = name;
     ei_status.tx_start_page = start_page;
@@ -334,11 +335,7 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
     ei_status.block_input = &apne_block_input;
     ei_status.block_output = &apne_block_output;
     ei_status.get_8390_hdr = &apne_get_8390_hdr;
-    dev->open = &apne_open;
-    dev->stop = &apne_close;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-    dev->poll_controller = ei_poll;
-#endif
+
     NS8390_init(dev, 0);
 
     pcmcia_ack_int(pcmcia_get_intreq());               /* ack PCMCIA int req */
@@ -349,22 +346,6 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
     return 0;
 }
 
-static int
-apne_open(struct net_device *dev)
-{
-    ei_open(dev);
-    return 0;
-}
-
-static int
-apne_close(struct net_device *dev)
-{
-    if (ei_debug > 1)
-       printk("%s: Shutting down ethercard.\n", dev->name);
-    ei_close(dev);
-    return 0;
-}
-
 /* Hard reset the card.  This used to pause for the same period that a
    8390 reset command required, but that shouldn't be necessary. */
 static void
@@ -568,7 +549,7 @@ static irqreturn_t apne_interrupt(int irq, void *dev_id)
 #ifdef MODULE
 static struct net_device *apne_dev;
 
-int __init init_module(void)
+static int __init apne_module_init(void)
 {
        apne_dev = apne_probe(-1);
        if (IS_ERR(apne_dev))
@@ -576,7 +557,7 @@ int __init init_module(void)
        return 0;
 }
 
-void __exit cleanup_module(void)
+static void __exit apne_module_exit(void)
 {
        unregister_netdev(apne_dev);
 
@@ -590,7 +571,8 @@ void __exit cleanup_module(void)
 
        free_netdev(apne_dev);
 }
-
+module_init(apne_module_init);
+module_exit(apne_module_exit);
 #endif
 
 static int init_pcmcia(void)