tree-wide: fix comment/printk typos
[linux-flexiantxendom0-natty.git] / drivers / net / sis900.c
index a9a897b..5976d1d 100644 (file)
@@ -36,7 +36,7 @@
    Rev 1.07.06 Nov.  7 2000 Jeff Garzik <jgarzik@pobox.com> some bug fix and cleaning
    Rev 1.07.05 Nov.  6 2000 metapirat<metapirat@gmx.de> contribute media type select by ifconfig
    Rev 1.07.04 Sep.  6 2000 Lei-Chun Chang added ICS1893 PHY support
-   Rev 1.07.03 Aug. 24 2000 Lei-Chun Chang (lcchang@sis.com.tw) modified 630E eqaulizer workaround rule
+   Rev 1.07.03 Aug. 24 2000 Lei-Chun Chang (lcchang@sis.com.tw) modified 630E equalizer workaround rule
    Rev 1.07.01 Aug. 08 2000 Ollie Lho minor update for SiS 630E and SiS 630E A1
    Rev 1.07    Mar. 07 2000 Ollie Lho bug fix in Rx buffer ring
    Rev 1.06.04 Feb. 11 2000 Jeff Garzik <jgarzik@pobox.com> softnet and init for kernel 2.4
@@ -52,6 +52,7 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/kernel.h>
+#include <linux/sched.h>
 #include <linux/string.h>
 #include <linux/timer.h>
 #include <linux/errno.h>
@@ -105,7 +106,7 @@ static const char * card_names[] = {
        "SiS 900 PCI Fast Ethernet",
        "SiS 7016 PCI Fast Ethernet"
 };
-static struct pci_device_id sis900_pci_tbl [] = {
+static DEFINE_PCI_DEVICE_TABLE(sis900_pci_tbl) = {
        {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_900,
         PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_900},
        {PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_7016,
@@ -214,7 +215,8 @@ static void sis900_check_mode (struct net_device *net_dev, struct mii_phy *mii_p
 static void sis900_tx_timeout(struct net_device *net_dev);
 static void sis900_init_tx_ring(struct net_device *net_dev);
 static void sis900_init_rx_ring(struct net_device *net_dev);
-static int sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev);
+static netdev_tx_t sis900_start_xmit(struct sk_buff *skb,
+                                    struct net_device *net_dev);
 static int sis900_rx(struct net_device *net_dev);
 static void sis900_finish_xmit (struct net_device *net_dev);
 static irqreturn_t sis900_interrupt(int irq, void *dev_instance);
@@ -830,7 +832,7 @@ static u16 __devinit read_eeprom(long ioaddr, int location)
        outl(0, ee_addr);
        eeprom_delay();
 
-       return (retval);
+       return retval;
 }
 
 /* Read and write the MII management registers using software-generated
@@ -856,7 +858,6 @@ static void mdio_reset(long mdio_addr)
                outl(MDDIR | MDIO | MDC, mdio_addr);
                mdio_delay();
        }
-       return;
 }
 
 /**
@@ -951,8 +952,6 @@ static void mdio_write(struct net_device *net_dev, int phy_id, int location,
                mdio_delay();
        }
        outl(0x00, mdio_addr);
-
-       return;
 }
 
 
@@ -1014,7 +1013,7 @@ sis900_open(struct net_device *net_dev)
        /* Equalizer workaround Rule */
        sis630_set_eq(net_dev, sis_priv->chipset_rev);
 
-       ret = request_irq(net_dev->irq, &sis900_interrupt, IRQF_SHARED,
+       ret = request_irq(net_dev->irq, sis900_interrupt, IRQF_SHARED,
                                                net_dev->name, net_dev);
        if (ret)
                return ret;
@@ -1043,7 +1042,7 @@ sis900_open(struct net_device *net_dev)
        init_timer(&sis_priv->timer);
        sis_priv->timer.expires = jiffies + HZ;
        sis_priv->timer.data = (unsigned long)net_dev;
-       sis_priv->timer.function = &sis900_timer;
+       sis_priv->timer.function = sis900_timer;
        add_timer(&sis_priv->timer);
 
        return 0;
@@ -1262,7 +1261,6 @@ static void sis630_set_eq(struct net_device *net_dev, u8 revision)
                        mdio_write(net_dev, sis_priv->cur_phy, MII_RESV,
                                                (reg14h | 0x2000) & 0xBFFF);
        }
-       return;
 }
 
 /**
@@ -1497,7 +1495,7 @@ static void sis900_read_mode(struct net_device *net_dev, int *speed, int *duplex
        }
 
        if(netif_msg_link(sis_priv))
-               printk(KERN_INFO "%s: Media Link On %s %s-duplex \n",
+               printk(KERN_INFO "%s: Media Link On %s %s-duplex\n",
                                        net_dev->name,
                                        *speed == HW_SPEED_100_MBPS ?
                                                "100mbps" : "10mbps",
@@ -1521,7 +1519,7 @@ static void sis900_tx_timeout(struct net_device *net_dev)
        int i;
 
        if(netif_msg_tx_err(sis_priv))
-               printk(KERN_INFO "%s: Transmit timeout, status %8.8x %8.8x \n",
+               printk(KERN_INFO "%s: Transmit timeout, status %8.8x %8.8x\n",
                        net_dev->name, inl(ioaddr + cr), inl(ioaddr + isr));
 
        /* Disable interrupts by clearing the interrupt mask. */
@@ -1551,14 +1549,13 @@ static void sis900_tx_timeout(struct net_device *net_dev)
 
        spin_unlock_irqrestore(&sis_priv->lock, flags);
 
-       net_dev->trans_start = jiffies;
+       net_dev->trans_start = jiffies; /* prevent tx timeout */
 
        /* load Transmit Descriptor Register */
        outl(sis_priv->tx_ring_dma, ioaddr + txdp);
 
        /* Enable all known interrupts by setting the interrupt mask. */
        outl((RxSOVR|RxORN|RxERR|RxOK|TxURN|TxERR|TxIDLE), ioaddr + imr);
-       return;
 }
 
 /**
@@ -1571,7 +1568,7 @@ static void sis900_tx_timeout(struct net_device *net_dev)
  *     tell upper layer if the buffer is full
  */
 
-static int
+static netdev_tx_t
 sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
 {
        struct sis900_private *sis_priv = netdev_priv(net_dev);
@@ -1621,14 +1618,12 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev)
 
        spin_unlock_irqrestore(&sis_priv->lock, flags);
 
-       net_dev->trans_start = jiffies;
-
        if (netif_msg_tx_queued(sis_priv))
                printk(KERN_DEBUG "%s: Queued Tx packet at %p size %d "
                       "to slot %d.\n",
                       net_dev->name, skb->data, (int)skb->len, entry);
 
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 /**
@@ -1758,7 +1753,7 @@ static int sis900_rx(struct net_device *net_dev)
                                sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE,
                                PCI_DMA_FROMDEVICE);
 
-                       /* refill the Rx buffer, what if there is not enought
+                       /* refill the Rx buffer, what if there is not enough
                         * memory for new socket buffer ?? */
                        if ((skb = dev_alloc_skb(RX_BUF_SIZE)) == NULL) {
                                /*
@@ -1773,7 +1768,7 @@ static int sis900_rx(struct net_device *net_dev)
                        }
 
                        /* This situation should never happen, but due to
-                          some unknow bugs, it is possible that
+                          some unknown bugs, it is possible that
                           we are working on NULL sk_buff :-( */
                        if (sis_priv->rx_skbuff[entry] == NULL) {
                                if (netif_msg_rx_err(sis_priv))
@@ -2127,8 +2122,6 @@ static int mii_ioctl(struct net_device *net_dev, struct ifreq *rq, int cmd)
                return 0;
 
        case SIOCSMIIREG:               /* Write MII PHY register. */
-               if (!capable(CAP_NET_ADMIN))
-                       return -EPERM;
                mdio_write(net_dev, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
                return 0;
        default:
@@ -2254,9 +2247,9 @@ static inline u16 sis900_mcast_bitnr(u8 *addr, u8 revision)
 
        /* leave 8 or 7 most siginifant bits */
        if ((revision >= SIS635A_900_REV) || (revision == SIS900B_900_REV))
-               return ((int)(crc >> 24));
+               return (int)(crc >> 24);
        else
-               return ((int)(crc >> 25));
+               return (int)(crc >> 25);
 }
 
 /**
@@ -2288,7 +2281,7 @@ static void set_rx_mode(struct net_device *net_dev)
                rx_mode = RFPromiscuous;
                for (i = 0; i < table_entries; i++)
                        mc_filter[i] = 0xffff;
-       } else if ((net_dev->mc_count > multicast_filter_limit) ||
+       } else if ((netdev_mc_count(net_dev) > multicast_filter_limit) ||
                   (net_dev->flags & IFF_ALLMULTI)) {
                /* too many multicast addresses or accept all multicast packet */
                rx_mode = RFAAB | RFAAM;
@@ -2298,13 +2291,14 @@ static void set_rx_mode(struct net_device *net_dev)
                /* Accept Broadcast packet, destination address matchs our
                 * MAC address, use Receive Filter to reject unwanted MCAST
                 * packets */
-               struct dev_mc_list *mclist;
+               struct netdev_hw_addr *ha;
                rx_mode = RFAAB;
-               for (i = 0, mclist = net_dev->mc_list;
-                       mclist && i < net_dev->mc_count;
-                       i++, mclist = mclist->next) {
-                       unsigned int bit_nr =
-                               sis900_mcast_bitnr(mclist->dmi_addr, sis_priv->chipset_rev);
+
+               netdev_for_each_mc_addr(ha, net_dev) {
+                       unsigned int bit_nr;
+
+                       bit_nr = sis900_mcast_bitnr(ha->addr,
+                                                   sis_priv->chipset_rev);
                        mc_filter[bit_nr >> 4] |= (1 << (bit_nr & 0xf));
                }
        }
@@ -2331,8 +2325,6 @@ static void set_rx_mode(struct net_device *net_dev)
                /* restore cr */
                outl(cr_saved, ioaddr + cr);
        }
-
-       return;
 }
 
 /**