OSDN Git Service

net: dsa: use port's cpu_dp when creating a slave
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Mon, 16 Oct 2017 15:12:13 +0000 (11:12 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Oct 2017 11:24:33 +0000 (12:24 +0100)
When dsa_slave_create is called, the related port already has a CPU port
assigned to it, available in its cpu_dp member. Use it instead of the
unique tree cpu_dp.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/slave.c

index 45f4ea8..c6f4829 100644 (file)
@@ -1117,16 +1117,13 @@ int dsa_slave_resume(struct net_device *slave_dev)
 int dsa_slave_create(struct dsa_port *port, const char *name)
 {
        struct dsa_notifier_register_info rinfo = { };
+       struct dsa_port *cpu_dp = port->cpu_dp;
+       struct net_device *master = cpu_dp->netdev;
        struct dsa_switch *ds = port->ds;
-       struct net_device *master;
        struct net_device *slave_dev;
        struct dsa_slave_priv *p;
-       struct dsa_port *cpu_dp;
        int ret;
 
-       cpu_dp = ds->dst->cpu_dp;
-       master = cpu_dp->netdev;
-
        if (!ds->num_tx_queues)
                ds->num_tx_queues = 1;