omap: i2c: add a timeout to the busy waiting
[safe/jmp/linux-2.6] / drivers / net / bfin_mac.c
index c15fc28..587f93c 100644 (file)
@@ -33,6 +33,7 @@
 #include <asm/dma.h>
 #include <linux/dma-mapping.h>
 
+#include <asm/dpmc.h>
 #include <asm/blackfin.h>
 #include <asm/cacheflush.h>
 #include <asm/portmux.h>
@@ -386,8 +387,8 @@ static int mii_probe(struct net_device *dev)
        u32 sclk, mdc_div;
 
        /* Enable PHY output early */
-       if (!(bfin_read_VR_CTL() & PHYCLKOE))
-               bfin_write_VR_CTL(bfin_read_VR_CTL() | PHYCLKOE);
+       if (!(bfin_read_VR_CTL() & CLKBUFOE))
+               bfin_write_VR_CTL(bfin_read_VR_CTL() | CLKBUFOE);
 
        sclk = get_sclk();
        mdc_div = ((sclk / MDC_CLK) / 2) - 1;
@@ -491,7 +492,7 @@ static void bfin_mac_ethtool_getdrvinfo(struct net_device *dev,
        strcpy(info->bus_info, dev_name(&dev->dev));
 }
 
-static struct ethtool_ops bfin_mac_ethtool_ops = {
+static const struct ethtool_ops bfin_mac_ethtool_ops = {
        .get_settings = bfin_mac_ethtool_getsettings,
        .set_settings = bfin_mac_ethtool_setsettings,
        .get_link = ethtool_op_get_link,
@@ -554,8 +555,8 @@ static void adjust_tx_list(void)
 {
        int timeout_cnt = MAX_TIMEOUT_CNT;
 
-       if (tx_list_head->status.status_word != 0
-           && current_tx_ptr != tx_list_head) {
+       if (tx_list_head->status.status_word != 0 &&
+           current_tx_ptr != tx_list_head) {
                goto adjust_head;       /* released something, just return; */
        }
 
@@ -567,8 +568,8 @@ static void adjust_tx_list(void)
        if (current_tx_ptr->next->next == tx_list_head) {
                while (tx_list_head->status.status_word == 0) {
                        udelay(10);
-                       if (tx_list_head->status.status_word != 0
-                           || !(bfin_read_DMA2_IRQ_STATUS() & DMA_RUN)) {
+                       if (tx_list_head->status.status_word != 0 ||
+                           !(bfin_read_DMA2_IRQ_STATUS() & DMA_RUN)) {
                                goto adjust_head;
                        }
                        if (timeout_cnt-- < 0) {
@@ -596,8 +597,8 @@ adjust_head:
                               ": no sk_buff in a transmitted frame!\n");
                }
                tx_list_head = tx_list_head->next;
-       } while (tx_list_head->status.status_word != 0
-                && current_tx_ptr != tx_list_head);
+       } while (tx_list_head->status.status_word != 0 &&
+                current_tx_ptr != tx_list_head);
        return;
 
 }
@@ -656,7 +657,7 @@ out:
        dev->trans_start = jiffies;
        dev->stats.tx_packets++;
        dev->stats.tx_bytes += (skb->len);
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 static void bfin_mac_rx(struct net_device *dev)
@@ -811,16 +812,14 @@ static void bfin_mac_timeout(struct net_device *dev)
 static void bfin_mac_multicast_hash(struct net_device *dev)
 {
        u32 emac_hashhi, emac_hashlo;
-       struct dev_mc_list *dmi = dev->mc_list;
+       struct dev_mc_list *dmi;
        char *addrs;
-       int i;
        u32 crc;
 
        emac_hashhi = emac_hashlo = 0;
 
-       for (i = 0; i < dev->mc_count; i++) {
+       netdev_for_each_mc_addr(dmi, dev) {
                addrs = dmi->dmi_addr;
-               dmi = dmi->next;
 
                /* skip non-multicast addresses */
                if (!(*addrs & 1))
@@ -861,7 +860,7 @@ static void bfin_mac_set_multicast_list(struct net_device *dev)
                sysctl = bfin_read_EMAC_OPMODE();
                sysctl |= PAM;
                bfin_write_EMAC_OPMODE(sysctl);
-       } else if (dev->mc_count) {
+       } else if (!netdev_mc_empty(dev)) {
                /* set up multicast hash table */
                sysctl = bfin_read_EMAC_OPMODE();
                sysctl |= HM;