of: Always use 'struct device.of_node' to get device node pointer.
[safe/jmp/linux-2.6] / drivers / net / ibm_newemac / core.c
index af117c6..cda2ba8 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/bitops.h>
 #include <linux/workqueue.h>
 #include <linux/of.h>
+#include <linux/slab.h>
 
 #include <asm/processor.h>
 #include <asm/io.h>
@@ -135,7 +136,8 @@ static inline void emac_report_timeout_error(struct emac_instance *dev,
                                  EMAC_FTR_440EP_PHY_CLK_FIX))
                DBG(dev, "%s" NL, error);
        else if (net_ratelimit())
-               printk(KERN_ERR "%s: %s\n", dev->ofdev->node->full_name, error);
+               printk(KERN_ERR "%s: %s\n", dev->ofdev->dev.of_node->full_name,
+                       error);
 }
 
 /* EMAC PHY clock workaround:
@@ -391,11 +393,11 @@ static void emac_hash_mc(struct emac_instance *dev)
        struct dev_mc_list *dmi;
        int i;
 
-       DBG(dev, "hash_mc %d" NL, dev->ndev->mc_count);
+       DBG(dev, "hash_mc %d" NL, netdev_mc_count(dev->ndev));
 
        memset(gaht_temp, 0, sizeof (gaht_temp));
 
-       for (dmi = dev->ndev->mc_list; dmi; dmi = dmi->next) {
+       netdev_for_each_mc_addr(dmi, dev->ndev) {
                int slot, reg, mask;
                DBG2(dev, "mc %pM" NL, dmi->dmi_addr);
 
@@ -425,9 +427,9 @@ static inline u32 emac_iff2rmr(struct net_device *ndev)
        if (ndev->flags & IFF_PROMISC)
                r |= EMAC_RMR_PME;
        else if (ndev->flags & IFF_ALLMULTI ||
-                        (ndev->mc_count > EMAC_XAHT_SLOTS(dev)))
+                        (netdev_mc_count(ndev) > EMAC_XAHT_SLOTS(dev)))
                r |= EMAC_RMR_PMME;
-       else if (ndev->mc_count > 0)
+       else if (!netdev_mc_empty(ndev))
                r |= EMAC_RMR_MAE;
 
        return r;
@@ -1976,27 +1978,27 @@ static int emac_ethtool_set_settings(struct net_device *ndev,
        if (cmd->autoneg == AUTONEG_DISABLE) {
                switch (cmd->speed) {
                case SPEED_10:
-                       if (cmd->duplex == DUPLEX_HALF
-                           && !(f & SUPPORTED_10baseT_Half))
+                       if (cmd->duplex == DUPLEX_HALF &&
+                           !(f & SUPPORTED_10baseT_Half))
                                return -EINVAL;
-                       if (cmd->duplex == DUPLEX_FULL
-                           && !(f & SUPPORTED_10baseT_Full))
+                       if (cmd->duplex == DUPLEX_FULL &&
+                           !(f & SUPPORTED_10baseT_Full))
                                return -EINVAL;
                        break;
                case SPEED_100:
-                       if (cmd->duplex == DUPLEX_HALF
-                           && !(f & SUPPORTED_100baseT_Half))
+                       if (cmd->duplex == DUPLEX_HALF &&
+                           !(f & SUPPORTED_100baseT_Half))
                                return -EINVAL;
-                       if (cmd->duplex == DUPLEX_FULL
-                           && !(f & SUPPORTED_100baseT_Full))
+                       if (cmd->duplex == DUPLEX_FULL &&
+                           !(f & SUPPORTED_100baseT_Full))
                                return -EINVAL;
                        break;
                case SPEED_1000:
-                       if (cmd->duplex == DUPLEX_HALF
-                           && !(f & SUPPORTED_1000baseT_Half))
+                       if (cmd->duplex == DUPLEX_HALF &&
+                           !(f & SUPPORTED_1000baseT_Half))
                                return -EINVAL;
-                       if (cmd->duplex == DUPLEX_FULL
-                           && !(f & SUPPORTED_1000baseT_Full))
+                       if (cmd->duplex == DUPLEX_FULL &&
+                           !(f & SUPPORTED_1000baseT_Full))
                                return -EINVAL;
                        break;
                default:
@@ -2184,7 +2186,7 @@ static void emac_ethtool_get_drvinfo(struct net_device *ndev,
        strcpy(info->version, DRV_VERSION);
        info->fw_version[0] = '\0';
        sprintf(info->bus_info, "PPC 4xx EMAC-%d %s",
-               dev->cell_index, dev->ofdev->node->full_name);
+               dev->cell_index, dev->ofdev->dev.of_node->full_name);
        info->regdump_len = emac_ethtool_get_regs_len(ndev);
 }
 
@@ -2378,7 +2380,7 @@ static int __devinit emac_read_uint_prop(struct device_node *np, const char *nam
 
 static int __devinit emac_init_phy(struct emac_instance *dev)
 {
-       struct device_node *np = dev->ofdev->node;
+       struct device_node *np = dev->ofdev->dev.of_node;
        struct net_device *ndev = dev->ndev;
        u32 phy_map, adv;
        int i;
@@ -2513,7 +2515,7 @@ static int __devinit emac_init_phy(struct emac_instance *dev)
 
 static int __devinit emac_init_config(struct emac_instance *dev)
 {
-       struct device_node *np = dev->ofdev->node;
+       struct device_node *np = dev->ofdev->dev.of_node;
        const void *p;
        unsigned int plen;
        const char *pm, *phy_modes[] = {
@@ -2722,7 +2724,7 @@ static int __devinit emac_probe(struct of_device *ofdev,
 {
        struct net_device *ndev;
        struct emac_instance *dev;
-       struct device_node *np = ofdev->node;
+       struct device_node *np = ofdev->dev.of_node;
        struct device_node **blist = NULL;
        int err, i;
 
@@ -2809,7 +2811,7 @@ static int __devinit emac_probe(struct of_device *ofdev,
        err = mal_register_commac(dev->mal, &dev->commac);
        if (err) {
                printk(KERN_ERR "%s: failed to register with mal %s!\n",
-                      np->full_name, dev->mal_dev->node->full_name);
+                      np->full_name, dev->mal_dev->dev.of_node->full_name);
                goto err_rel_deps;
        }
        dev->rx_skb_size = emac_rx_skb_size(ndev->mtu);