of: Always use 'struct device.of_node' to get device node pointer.
[safe/jmp/linux-2.6] / drivers / net / ll_temac_main.c
index d7eb24c..9c7395c 100644 (file)
@@ -49,6 +49,7 @@
 #include <linux/in.h>
 #include <linux/io.h>
 #include <linux/ip.h>
+#include <linux/slab.h>
 
 #include "ll_temac.h"
 
@@ -224,6 +225,13 @@ static int temac_set_mac_address(struct net_device *ndev, void *address)
        return 0;
 }
 
+static int netdev_set_mac_address(struct net_device *ndev, void *p)
+{
+       struct sockaddr *addr = p;
+
+       return temac_set_mac_address(ndev, addr->sa_data);
+}
+
 static void temac_set_multicast_list(struct net_device *ndev)
 {
        struct temac_local *lp = netdev_priv(ndev);
@@ -243,9 +251,10 @@ static void temac_set_multicast_list(struct net_device *ndev)
                temac_indirect_out32(lp, XTE_AFM_OFFSET, XTE_AFM_EPPRM_MASK);
                dev_info(&ndev->dev, "Promiscuous mode enabled.\n");
        } else if (!netdev_mc_empty(ndev)) {
-               struct dev_mc_list *mclist = ndev->mc_list;
-               for (i = 0; mclist && i < netdev_mc_count(ndev); i++) {
+               struct dev_mc_list *mclist;
 
+               i = 0;
+               netdev_for_each_mc_addr(mclist, ndev) {
                        if (i >= MULTICAST_CAM_TABLE_NUM)
                                break;
                        multi_addr_msw = ((mclist->dmi_addr[3] << 24) |
@@ -258,7 +267,7 @@ static void temac_set_multicast_list(struct net_device *ndev)
                                          (mclist->dmi_addr[4]) | (i << 16));
                        temac_indirect_out32(lp, XTE_MAW1_OFFSET,
                                             multi_addr_lsw);
-                       mclist = mclist->next;
+                       i++;
                }
        } else {
                val = temac_indirect_in32(lp, XTE_AFM_OFFSET);
@@ -768,7 +777,7 @@ static const struct net_device_ops temac_netdev_ops = {
        .ndo_open = temac_open,
        .ndo_stop = temac_stop,
        .ndo_start_xmit = temac_start_xmit,
-       .ndo_set_mac_address = temac_set_mac_address,
+       .ndo_set_mac_address = netdev_set_mac_address,
        //.ndo_set_multicast_list = temac_set_multicast_list,
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller = temac_poll_controller,
@@ -849,14 +858,14 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
        mutex_init(&lp->indirect_mutex);
 
        /* map device registers */
-       lp->regs = of_iomap(op->node, 0);
+       lp->regs = of_iomap(op->dev.of_node, 0);
        if (!lp->regs) {
                dev_err(&op->dev, "could not map temac regs.\n");
                goto nodev;
        }
 
        /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */
-       np = of_parse_phandle(op->node, "llink-connected", 0);
+       np = of_parse_phandle(op->dev.of_node, "llink-connected", 0);
        if (!np) {
                dev_err(&op->dev, "could not find DMA node\n");
                goto nodev;
@@ -881,7 +890,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
        of_node_put(np); /* Finished with the DMA node; drop the reference */
 
        /* Retrieve the MAC address */
-       addr = of_get_property(op->node, "local-mac-address", &size);
+       addr = of_get_property(op->dev.of_node, "local-mac-address", &size);
        if ((!addr) || (size != 6)) {
                dev_err(&op->dev, "could not find MAC address\n");
                rc = -ENODEV;
@@ -889,11 +898,11 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
        }
        temac_set_mac_address(ndev, (void *)addr);
 
-       rc = temac_mdio_setup(lp, op->node);
+       rc = temac_mdio_setup(lp, op->dev.of_node);
        if (rc)
                dev_warn(&op->dev, "error registering MDIO bus\n");
 
-       lp->phy_node = of_parse_phandle(op->node, "phy-handle", 0);
+       lp->phy_node = of_parse_phandle(op->dev.of_node, "phy-handle", 0);
        if (lp->phy_node)
                dev_dbg(lp->dev, "using PHY node %s (%p)\n", np->full_name, np);