Skip to content

Commit

Permalink
net: dsa: retain a per-port device_node pointer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ffainelli authored and davem330 committed Aug 28, 2014
1 parent fa981d9 commit bd47497
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/net/dsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 2 additions & 0 deletions net/dsa/dsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down
1 change: 1 addition & 0 deletions net/dsa/slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bd47497

Please sign in to comment.