V4L/DVB: bttv: remove bogus prio check in g_frequency
[safe/jmp/linux-2.6] / drivers / net / mac89x0.c
index 62c1c62..c0876e9 100644 (file)
@@ -73,8 +73,6 @@ static char *version =
    or override something. */
 #include <linux/module.h>
 
-#define PRINTK(x) printk x
-
 /*
   Sources:
 
@@ -90,7 +88,6 @@ static char *version =
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/in.h>
-#include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/nubus.h>
 #include <linux/errno.h>
@@ -99,9 +96,10 @@ static char *version =
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 #include <linux/delay.h>
+#include <linux/bitops.h>
+#include <linux/gfp.h>
 
 #include <asm/system.h>
-#include <asm/bitops.h>
 #include <asm/io.h>
 #include <asm/hwtest.h>
 #include <asm/macints.h>
@@ -168,6 +166,17 @@ writereg(struct net_device *dev, int portno, int value)
        nubus_writew(swab16(value), dev->mem_start + portno);
 }
 
+static const struct net_device_ops mac89x0_netdev_ops = {
+       .ndo_open               = net_open,
+       .ndo_stop               = net_close,
+       .ndo_start_xmit         = net_send_packet,
+       .ndo_get_stats          = net_get_stats,
+       .ndo_set_multicast_list = set_multicast_list,
+       .ndo_set_mac_address    = set_mac_address,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_change_mtu         = eth_change_mtu,
+};
+
 /* Probe for the CS8900 card in slot E.  We won't bother looking
    anywhere else until we have a really good reason to do so. */
 struct net_device * __init mac89x0_probe(int unit)
@@ -182,6 +191,9 @@ struct net_device * __init mac89x0_probe(int unit)
        unsigned short sig;
        int err = -ENODEV;
 
+       if (!MACH_IS_MAC)
+               return ERR_PTR(-ENODEV);
+
        dev = alloc_etherdev(sizeof(struct net_local));
        if (!dev)
                return ERR_PTR(-ENOMEM);
@@ -191,8 +203,6 @@ struct net_device * __init mac89x0_probe(int unit)
                netdev_boot_setup_check(dev);
        }
 
-       SET_MODULE_OWNER(dev);
-
        if (once_is_enough)
                goto out;
        once_is_enough = 1;
@@ -212,8 +222,8 @@ struct net_device * __init mac89x0_probe(int unit)
                int card_present;
 
                local_irq_save(flags);
-               card_present = hwreg_present((void*) ioaddr+4)
-                 && hwreg_present((void*) ioaddr + DATA_PORT);
+               card_present = (hwreg_present((void*) ioaddr+4) &&
+                               hwreg_present((void*) ioaddr + DATA_PORT));
                local_irq_restore(flags);
 
                if (!card_present)
@@ -274,25 +284,17 @@ struct net_device * __init mac89x0_probe(int unit)
         }
 
        dev->irq = SLOT2IRQ(slot);
-       printk(" IRQ %d ADDR ", dev->irq);
 
-       /* print the ethernet address. */
-       for (i = 0; i < ETH_ALEN; i++)
-               printk("%2.2x%s", dev->dev_addr[i],
-                      ((i < ETH_ALEN-1) ? ":" : ""));
-       printk("\n");
+       /* print the IRQ and ethernet address. */
+
+       printk(" IRQ %d ADDR %pM\n", dev->irq, dev->dev_addr);
 
-       dev->open               = net_open;
-       dev->stop               = net_close;
-       dev->hard_start_xmit = net_send_packet;
-       dev->get_stats  = net_get_stats;
-       dev->set_multicast_list = &set_multicast_list;
-       dev->set_mac_address = &set_mac_address;
+       dev->netdev_ops         = &mac89x0_netdev_ops;
 
        err = register_netdev(dev);
        if (err)
                goto out1;
-       return 0;
+       return NULL;
 out1:
        nubus_writew(0, dev->base_addr + ADD_PORT);
 out:
@@ -335,7 +337,7 @@ net_open(struct net_device *dev)
        writereg(dev, PP_BusCTL, readreg(dev, PP_BusCTL) & ~ENABLE_IRQ);
 
        /* Grab the interrupt */
-       if (request_irq(dev->irq, &net_interrupt, 0, "cs89x0", dev))
+       if (request_irq(dev->irq, net_interrupt, 0, "cs89x0", dev))
                return -EAGAIN;
 
        /* Set up the IRQ - Apparently magic */
@@ -398,7 +400,7 @@ net_send_packet(struct sk_buff *skb, struct net_device *dev)
                /* Gasp!  It hasn't.  But that shouldn't happen since
                   we're waiting for TxOk, so return 1 and requeue this packet. */
                local_irq_restore(flags);
-               return 1;
+               return NETDEV_TX_BUSY;
        }
 
        /* Write the contents of the packet */
@@ -409,7 +411,7 @@ net_send_packet(struct sk_buff *skb, struct net_device *dev)
        dev->trans_start = jiffies;
        dev_kfree_skb (skb);
 
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 /* The typical workload of the driver:
@@ -518,7 +520,6 @@ net_rx(struct net_device *dev)
 
         skb->protocol=eth_type_trans(skb,dev);
        netif_rx(skb);
-       dev->last_rx = jiffies;
        lp->stats.rx_packets++;
        lp->stats.rx_bytes += length;
 }
@@ -567,9 +568,7 @@ static void set_multicast_list(struct net_device *dev)
        if(dev->flags&IFF_PROMISC)
        {
                lp->rx_mode = RX_ALL_ACCEPT;
-       }
-       else if((dev->flags&IFF_ALLMULTI)||dev->mc_list)
-       {
+       } else if ((dev->flags & IFF_ALLMULTI) || !netdev_mc_empty(dev)) {
                /* The multicast-accept list is initialized to accept-all, and we
                   rely on higher-level filtering for now. */
                lp->rx_mode = RX_MULTCAST_ACCEPT;
@@ -628,14 +627,3 @@ cleanup_module(void)
        free_netdev(dev_cs89x0);
 }
 #endif /* MODULE */
-
-/*
- * Local variables:
- *  compile-command: "m68k-linux-gcc -D__KERNEL__ -I../../include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -fno-strength-reduce -ffixed-a2 -DMODULE -DMODVERSIONS -include ../../include/linux/modversions.h   -c -o mac89x0.o mac89x0.c"
- *  version-control: t
- *  kept-new-versions: 5
- *  c-indent-level: 8
- *  tab-width: 8
- * End:
- *
- */