]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/net/dsa/mt7530.c
net: dsa: add dsa_to_port helper
[linux.git] / drivers / net / dsa / mt7530.c
index c142b97add2cd3d3f937b81e5749b4258e66bc80..21431be2831ee2de028df6d5c3bd4827cb8fa8e8 100644 (file)
@@ -564,7 +564,8 @@ static int mt7530_phy_read(struct dsa_switch *ds, int port, int regnum)
        return mdiobus_read_nested(priv->bus, port, regnum);
 }
 
-int mt7530_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val)
+static int mt7530_phy_write(struct dsa_switch *ds, int port, int regnum,
+                           u16 val)
 {
        struct mt7530_priv *priv = ds->priv;
 
@@ -781,7 +782,7 @@ mt7530_port_bridge_join(struct dsa_switch *ds, int port,
                 * and not being setup until the port becomes enabled.
                 */
                if (ds->enabled_port_mask & BIT(i) && i != port) {
-                       if (ds->ports[i].bridge_dev != bridge)
+                       if (dsa_to_port(ds, i)->bridge_dev != bridge)
                                continue;
                        if (priv->ports[i].enable)
                                mt7530_set(priv, MT7530_PCR_P(i),
@@ -818,7 +819,7 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
                 * is kept and not being setup until the port becomes enabled.
                 */
                if (ds->enabled_port_mask & BIT(i) && i != port) {
-                       if (ds->ports[i].bridge_dev != bridge)
+                       if (dsa_to_port(ds, i)->bridge_dev != bridge)
                                continue;
                        if (priv->ports[i].enable)
                                mt7530_clear(priv, MT7530_PCR_P(i),
@@ -928,11 +929,11 @@ mt7530_setup(struct dsa_switch *ds)
        struct device_node *dn;
        struct mt7530_dummy_poll p;
 
-       /* The parent node of cpu_dp->netdev which holds the common system
+       /* The parent node of master netdev which holds the common system
         * controller also is the container for two GMACs nodes representing
         * as two netdev instances.
         */
-       dn = ds->dst->cpu_dp->netdev->dev.of_node->parent;
+       dn = ds->ports[MT7530_CPU_PORT].master->dev.of_node->parent;
        priv->ethernet = syscon_node_to_regmap(dn);
        if (IS_ERR(priv->ethernet))
                return PTR_ERR(priv->ethernet);