au1000-eth: fix checkpatch errors.
[pandora-kernel.git] / drivers / net / au1000_eth.c
index 4da191b..49f56b4 100644 (file)
@@ -83,6 +83,7 @@ static int au1000_debug = 3;
 MODULE_AUTHOR(DRV_AUTHOR);
 MODULE_DESCRIPTION(DRV_DESC);
 MODULE_LICENSE("GPL");
+MODULE_VERSION(DRV_VERSION);
 
 /*
  * Theory of operation
@@ -148,7 +149,7 @@ struct au1000_private *au_macs[NUM_ETH_INTERFACES];
  * specific irq-map
  */
 
-static void enable_mac(struct net_device *dev, int force_reset)
+static void au1000_enable_mac(struct net_device *dev, int force_reset)
 {
        unsigned long flags;
        struct au1000_private *aup = netdev_priv(dev);
@@ -236,7 +237,7 @@ static int au1000_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
         * _NOT_ hold (e.g. when PHY is accessed through other MAC's MII bus) */
        struct net_device *const dev = bus->priv;
 
-       enable_mac(dev, 0); /* make sure the MAC associated with this
+       au1000_enable_mac(dev, 0); /* make sure the MAC associated with this
                             * mii_bus is enabled */
        return au1000_mdio_read(dev, phy_addr, regnum);
 }
@@ -246,7 +247,7 @@ static int au1000_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum,
 {
        struct net_device *const dev = bus->priv;
 
-       enable_mac(dev, 0); /* make sure the MAC associated with this
+       au1000_enable_mac(dev, 0); /* make sure the MAC associated with this
                             * mii_bus is enabled */
        au1000_mdio_write(dev, phy_addr, regnum, value);
        return 0;
@@ -256,12 +257,12 @@ static int au1000_mdiobus_reset(struct mii_bus *bus)
 {
        struct net_device *const dev = bus->priv;
 
-       enable_mac(dev, 0); /* make sure the MAC associated with this
+       au1000_enable_mac(dev, 0); /* make sure the MAC associated with this
                             * mii_bus is enabled */
        return 0;
 }
 
-static void hard_stop(struct net_device *dev)
+static void au1000_hard_stop(struct net_device *dev)
 {
        struct au1000_private *aup = netdev_priv(dev);
 
@@ -272,7 +273,7 @@ static void hard_stop(struct net_device *dev)
        au_sync_delay(10);
 }
 
-static void enable_rx_tx(struct net_device *dev)
+static void au1000_enable_rx_tx(struct net_device *dev)
 {
        struct au1000_private *aup = netdev_priv(dev);
 
@@ -297,9 +298,9 @@ au1000_adjust_link(struct net_device *dev)
        spin_lock_irqsave(&aup->lock, flags);
 
        if (phydev->link && (aup->old_speed != phydev->speed)) {
-               // speed changed
+               /* speed changed */
 
-               switch(phydev->speed) {
+               switch (phydev->speed) {
                case SPEED_10:
                case SPEED_100:
                        break;
@@ -316,10 +317,10 @@ au1000_adjust_link(struct net_device *dev)
        }
 
        if (phydev->link && (aup->old_duplex != phydev->duplex)) {
-               // duplex mode changed
+               /* duplex mode changed */
 
                /* switching duplex mode requires to disable rx and tx! */
-               hard_stop(dev);
+               au1000_hard_stop(dev);
 
                if (DUPLEX_FULL == phydev->duplex)
                        aup->mac->control = ((aup->mac->control
@@ -331,14 +332,14 @@ au1000_adjust_link(struct net_device *dev)
                                             | MAC_DISABLE_RX_OWN);
                au_sync_delay(1);
 
-               enable_rx_tx(dev);
+               au1000_enable_rx_tx(dev);
                aup->old_duplex = phydev->duplex;
 
                status_change = 1;
        }
 
-       if(phydev->link != aup->old_link) {
-               // link state changed
+       if (phydev->link != aup->old_link) {
+               /* link state changed */
 
                if (!phydev->link) {
                        /* link went down */
@@ -362,7 +363,7 @@ au1000_adjust_link(struct net_device *dev)
        }
 }
 
-static int mii_probe (struct net_device *dev)
+static int au1000_mii_probe (struct net_device *dev)
 {
        struct au1000_private *const aup = netdev_priv(dev);
        struct phy_device *phydev = NULL;
@@ -462,7 +463,7 @@ static int mii_probe (struct net_device *dev)
  * has the virtual and dma address of a buffer suitable for
  * both, receive and transmit operations.
  */
-static db_dest_t *GetFreeDB(struct au1000_private *aup)
+static db_dest_t *au1000_GetFreeDB(struct au1000_private *aup)
 {
        db_dest_t *pDB;
        pDB = aup->pDBfree;
@@ -473,7 +474,7 @@ static db_dest_t *GetFreeDB(struct au1000_private *aup)
        return pDB;
 }
 
-void ReleaseDB(struct au1000_private *aup, db_dest_t *pDB)
+void au1000_ReleaseDB(struct au1000_private *aup, db_dest_t *pDB)
 {
        db_dest_t *pDBfree = aup->pDBfree;
        if (pDBfree)
@@ -481,12 +482,12 @@ void ReleaseDB(struct au1000_private *aup, db_dest_t *pDB)
        aup->pDBfree = pDB;
 }
 
-static void reset_mac_unlocked(struct net_device *dev)
+static void au1000_reset_mac_unlocked(struct net_device *dev)
 {
        struct au1000_private *const aup = netdev_priv(dev);
        int i;
 
-       hard_stop(dev);
+       au1000_hard_stop(dev);
 
        *aup->enable = MAC_EN_CLOCK_ENABLE;
        au_sync_delay(2);
@@ -507,7 +508,7 @@ static void reset_mac_unlocked(struct net_device *dev)
 
 }
 
-static void reset_mac(struct net_device *dev)
+static void au1000_reset_mac(struct net_device *dev)
 {
        struct au1000_private *const aup = netdev_priv(dev);
        unsigned long flags;
@@ -518,7 +519,7 @@ static void reset_mac(struct net_device *dev)
 
        spin_lock_irqsave(&aup->lock, flags);
 
-       reset_mac_unlocked (dev);
+       au1000_reset_mac_unlocked (dev);
 
        spin_unlock_irqrestore(&aup->lock, flags);
 }
@@ -529,7 +530,7 @@ static void reset_mac(struct net_device *dev)
  * these are not descriptors sitting in memory.
  */
 static void
-setup_hw_rings(struct au1000_private *aup, u32 rx_base, u32 tx_base)
+au1000_setup_hw_rings(struct au1000_private *aup, u32 rx_base, u32 tx_base)
 {
        int i;
 
@@ -610,7 +611,7 @@ static int au1000_init(struct net_device *dev)
                printk("%s: au1000_init\n", dev->name);
 
        /* bring the device out of reset */
-       enable_mac(dev, 1);
+       au1000_enable_mac(dev, 1);
 
        spin_lock_irqsave(&aup->lock, flags);
 
@@ -649,7 +650,7 @@ static int au1000_init(struct net_device *dev)
        return 0;
 }
 
-static inline void update_rx_stats(struct net_device *dev, u32 status)
+static inline void au1000_update_rx_stats(struct net_device *dev, u32 status)
 {
        struct net_device_stats *ps = &dev->stats;
 
@@ -667,8 +668,7 @@ static inline void update_rx_stats(struct net_device *dev, u32 status)
                        ps->rx_crc_errors++;
                if (status & RX_COLL)
                        ps->collisions++;
-       }
-       else
+       } else
                ps->rx_bytes += status & RX_FRAME_LEN_MASK;
 
 }
@@ -693,7 +693,7 @@ static int au1000_rx(struct net_device *dev)
        while (buff_stat & RX_T_DONE)  {
                status = prxd->status;
                pDB = aup->rx_db_inuse[aup->rx_head];
-               update_rx_stats(dev, status);
+               au1000_update_rx_stats(dev, status);
                if (!(status & RX_ERROR))  {
 
                        /* good frame */
@@ -713,8 +713,7 @@ static int au1000_rx(struct net_device *dev)
                        skb_put(skb, frmlen);
                        skb->protocol = eth_type_trans(skb, dev);
                        netif_rx(skb);  /* pass the packet to upper layers */
-               }
-               else {
+               } else {
                        if (au1000_debug > 4) {
                                if (status & RX_MISSED_FRAME)
                                        printk("rx miss\n");
@@ -747,7 +746,7 @@ static int au1000_rx(struct net_device *dev)
        return 0;
 }
 
-static void update_tx_stats(struct net_device *dev, u32 status)
+static void au1000_update_tx_stats(struct net_device *dev, u32 status)
 {
        struct au1000_private *aup = netdev_priv(dev);
        struct net_device_stats *ps = &dev->stats;
@@ -760,8 +759,7 @@ static void update_tx_stats(struct net_device *dev, u32 status)
                                ps->tx_errors++;
                                ps->tx_aborted_errors++;
                        }
-               }
-               else {
+               } else {
                        ps->tx_errors++;
                        ps->tx_aborted_errors++;
                        if (status & (TX_NO_CARRIER | TX_LOSS_CARRIER))
@@ -783,7 +781,7 @@ static void au1000_tx_ack(struct net_device *dev)
        ptxd = aup->tx_dma_ring[aup->tx_tail];
 
        while (ptxd->buff_stat & TX_T_DONE) {
-               update_tx_stats(dev, ptxd->status);
+               au1000_update_tx_stats(dev, ptxd->status);
                ptxd->buff_stat &= ~TX_T_DONE;
                ptxd->len = 0;
                au_sync();
@@ -820,14 +818,16 @@ static int au1000_open(struct net_device *dev)
        if (au1000_debug > 4)
                printk("%s: open: dev=%p\n", dev->name, dev);
 
-       if ((retval = request_irq(dev->irq, au1000_interrupt, 0,
-                                       dev->name, dev))) {
+       retval = request_irq(dev->irq, au1000_interrupt, 0,
+                                       dev->name, dev);
+       if (retval) {
                printk(KERN_ERR "%s: unable to get IRQ %d\n",
                                dev->name, dev->irq);
                return retval;
        }
 
-       if ((retval = au1000_init(dev))) {
+       retval = au1000_init(dev);
+       if (retval) {
                printk(KERN_ERR "%s: error in au1000_init\n", dev->name);
                free_irq(dev->irq, dev);
                return retval;
@@ -860,7 +860,7 @@ static int au1000_close(struct net_device *dev)
 
        spin_lock_irqsave(&aup->lock, flags);
 
-       reset_mac_unlocked (dev);
+       au1000_reset_mac_unlocked (dev);
 
        /* stop the device */
        netif_stop_queue(dev);
@@ -896,9 +896,8 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
                netif_stop_queue(dev);
                aup->tx_full = 1;
                return NETDEV_TX_BUSY;
-       }
-       else if (buff_stat & TX_T_DONE) {
-               update_tx_stats(dev, ptxd->status);
+       } else if (buff_stat & TX_T_DONE) {
+               au1000_update_tx_stats(dev, ptxd->status);
                ptxd->len = 0;
        }
 
@@ -910,12 +909,11 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
        pDB = aup->tx_db_inuse[aup->tx_head];
        skb_copy_from_linear_data(skb, (void *)pDB->vaddr, skb->len);
        if (skb->len < ETH_ZLEN) {
-               for (i=skb->len; i<ETH_ZLEN; i++) {
+               for (i = skb->len; i < ETH_ZLEN; i++) {
                        ((char *)pDB->vaddr)[i] = 0;
                }
                ptxd->len = ETH_ZLEN;
-       }
-       else
+       } else
                ptxd->len = skb->len;
 
        ps->tx_packets++;
@@ -936,7 +934,7 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
 static void au1000_tx_timeout(struct net_device *dev)
 {
        printk(KERN_ERR "%s: au1000_tx_timeout: dev=%p\n", dev->name, dev);
-       reset_mac(dev);
+       au1000_reset_mac(dev);
        au1000_init(dev);
        dev->trans_start = jiffies;
        netif_wake_queue(dev);
@@ -957,12 +955,12 @@ static void au1000_multicast_list(struct net_device *dev)
                aup->mac->control &= ~MAC_PROMISCUOUS;
                printk(KERN_INFO "%s: Pass all multicast\n", dev->name);
        } else {
-               struct dev_mc_list *mclist;
+               struct netdev_hw_addr *ha;
                u32 mc_filter[2];       /* Multicast hash filter */
 
                mc_filter[1] = mc_filter[0] = 0;
-               netdev_for_each_mc_addr(mclist, dev)
-                       set_bit(ether_crc(ETH_ALEN, mclist->dmi_addr)>>26,
+               netdev_for_each_mc_addr(ha, dev)
+                       set_bit(ether_crc(ETH_ALEN, ha->addr)>>26,
                                        (long *)mc_filter);
                aup->mac->multi_hash_high = mc_filter[1];
                aup->mac->multi_hash_low = mc_filter[0];
@@ -975,9 +973,11 @@ static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
        struct au1000_private *aup = netdev_priv(dev);
 
-       if (!netif_running(dev)) return -EINVAL;
+       if (!netif_running(dev))
+               return -EINVAL;
 
-       if (!aup->phy_dev) return -EINVAL; // PHY not controllable
+       if (!aup->phy_dev)
+               return -EINVAL; /* PHY not controllable */
 
        return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd);
 }
@@ -996,7 +996,7 @@ static const struct net_device_ops au1000_netdev_ops = {
 
 static int __devinit au1000_probe(struct platform_device *pdev)
 {
-       static unsigned version_printed = 0;
+       static unsigned version_printed;
        struct au1000_private *aup = NULL;
        struct au1000_eth_platform_data *pd;
        struct net_device *dev = NULL;
@@ -1088,9 +1088,9 @@ static int __devinit au1000_probe(struct platform_device *pdev)
                                /* Use the hard coded MAC addresses */
                }
 
-               setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR);
+               au1000_setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR);
        } else if (pdev->id == 1)
-               setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR);
+               au1000_setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR);
 
        /*
         * Assign to the Ethernet ports two consecutive MAC addresses
@@ -1139,7 +1139,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
        if (aup->mii_bus->irq == NULL)
                goto err_out;
 
-       for(i = 0; i < PHY_MAX_ADDR; ++i)
+       for (i = 0; i < PHY_MAX_ADDR; ++i)
                aup->mii_bus->irq[i] = PHY_POLL;
        /* if known, set corresponding PHY IRQs */
        if (aup->phy_static_config)
@@ -1152,7 +1152,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
                goto err_mdiobus_reg;
        }
 
-       if (mii_probe(dev) != 0)
+       if (au1000_mii_probe(dev) != 0)
                goto err_out;
 
        pDBfree = NULL;
@@ -1168,7 +1168,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
        aup->pDBfree = pDBfree;
 
        for (i = 0; i < NUM_RX_DMA; i++) {
-               pDB = GetFreeDB(aup);
+               pDB = au1000_GetFreeDB(aup);
                if (!pDB) {
                        goto err_out;
                }
@@ -1176,7 +1176,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
                aup->rx_db_inuse[i] = pDB;
        }
        for (i = 0; i < NUM_TX_DMA; i++) {
-               pDB = GetFreeDB(aup);
+               pDB = au1000_GetFreeDB(aup);
                if (!pDB) {
                        goto err_out;
                }
@@ -1195,7 +1195,7 @@ static int __devinit au1000_probe(struct platform_device *pdev)
         * The boot code uses the ethernet controller, so reset it to start
         * fresh.  au1000_init() expects that the device is in reset state.
         */
-       reset_mac(dev);
+       au1000_reset_mac(dev);
 
        err = register_netdev(dev);
        if (err) {
@@ -1217,15 +1217,15 @@ err_out:
 
        /* here we should have a valid dev plus aup-> register addresses
         * so we can reset the mac properly.*/
-       reset_mac(dev);
+       au1000_reset_mac(dev);
 
        for (i = 0; i < NUM_RX_DMA; i++) {
                if (aup->rx_db_inuse[i])
-                       ReleaseDB(aup, aup->rx_db_inuse[i]);
+                       au1000_ReleaseDB(aup, aup->rx_db_inuse[i]);
        }
        for (i = 0; i < NUM_TX_DMA; i++) {
                if (aup->tx_db_inuse[i])
-                       ReleaseDB(aup, aup->tx_db_inuse[i]);
+                       au1000_ReleaseDB(aup, aup->tx_db_inuse[i]);
        }
 err_mdiobus_reg:
        mdiobus_free(aup->mii_bus);
@@ -1261,11 +1261,11 @@ static int __devexit au1000_remove(struct platform_device *pdev)
 
        for (i = 0; i < NUM_RX_DMA; i++)
                if (aup->rx_db_inuse[i])
-                       ReleaseDB(aup, aup->rx_db_inuse[i]);
+                       au1000_ReleaseDB(aup, aup->rx_db_inuse[i]);
 
        for (i = 0; i < NUM_TX_DMA; i++)
                if (aup->tx_db_inuse[i])
-                       ReleaseDB(aup, aup->tx_db_inuse[i]);
+                       au1000_ReleaseDB(aup, aup->tx_db_inuse[i]);
 
        dma_free_noncoherent(NULL, MAX_BUF_SIZE *
                        (NUM_TX_BUFFS + NUM_RX_BUFFS),