net: dsa: retain a per-port device_node pointer
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 28 Aug 2014 00:04:50 +0000 (17:04 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 28 Aug 2014 05:59:40 +0000 (22:59 -0700)
We will later use the per-port device_node pointer to fetch a bunch of
port-specific properties.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/dsa.h
net/dsa/dsa.c
net/dsa/slave.c

index decc62709acd03773eb751f3c25f65d6ccada881..597875d3f69e1736bd3601505c551cd9cfe79252 100644 (file)
@@ -41,6 +41,7 @@ struct dsa_chip_data {
         * or any other string to indicate this is a physical port.
         */
        char            *port_names[DSA_MAX_PORTS];
+       struct device_node *port_dn[DSA_MAX_PORTS];
 
        /*
         * An array (with nr_chips elements) of which element [a]
index a28ef432d016e7781401d5e0bd7f8ebd004da75f..6a5bae673037f77c1890694010e87fe58c9f9a3c 100644 (file)
@@ -432,6 +432,8 @@ static int dsa_of_probe(struct platform_device *pdev)
                        if (!port_name)
                                continue;
 
+                       cd->port_dn[port_index] = port;
+
                        cd->port_names[port_index] = kstrdup(port_name,
                                        GFP_KERNEL);
                        if (!cd->port_names[port_index]) {
index ad1a913533aa645c82b9cd0794722626d3110965..5688c34253e58e6591e901bb26b9b0a761c505b3 100644 (file)
@@ -354,6 +354,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
        }
 
        SET_NETDEV_DEV(slave_dev, parent);
+       slave_dev->dev.of_node = ds->pd->port_dn[port];
        slave_dev->vlan_features = master->vlan_features;
 
        p = netdev_priv(slave_dev);