]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: dsa: Centralise getting switch id
authorAndrew Lunn <andrew@lunn.ch>
Fri, 27 Mar 2015 01:36:40 +0000 (18:36 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 29 Mar 2015 20:23:55 +0000 (13:23 -0700)
Get the switch id and save it away in the private mv88x6xxx structure
in a centralised piece of code, rather than each driver doing it itself.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6352.c
drivers/net/dsa/mv88e6xxx.c

index 7285bd053363520dd03befea23a920bbc327a198..41fe3a6a72d1fa213239f47c68cec5bf34bb92cb 100644 (file)
@@ -369,8 +369,6 @@ static int mv88e6352_setup(struct dsa_switch *ds)
 
        mutex_init(&ps->eeprom_mutex);
 
-       ps->id = REG_READ(REG_PORT(0), 0x03) & 0xfff0;
-
        ret = mv88e6352_switch_reset(ds);
        if (ret < 0)
                return ret;
index 038802229e328572fc7774c565d1c9e644e64cad..13572cc24c6dc42a308e4bc0b660f3c0f673e48d 100644 (file)
@@ -1152,6 +1152,8 @@ int mv88e6xxx_setup_common(struct dsa_switch *ds)
        mutex_init(&ps->stats_mutex);
        mutex_init(&ps->phy_mutex);
 
+       ps->id = REG_READ(REG_PORT(0), 0x03) & 0xfff0;
+
        ps->fid_mask = (1 << DSA_MAX_PORTS) - 1;
 
        INIT_WORK(&ps->bridge_work, mv88e6xxx_bridge_work);