return ret;
 }
 
-static int mv88e6xxx_setup_port(struct dsa_switch *ds, int port)
+static int mv88e6xxx_setup_port(struct mv88e6xxx_priv_state *ps, int port)
 {
-       struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
+       struct dsa_switch *ds = ps->ds;
        int ret;
        u16 reg;
 
-       mutex_lock(&ps->smi_mutex);
-
        if (mv88e6xxx_6352_family(ps) || mv88e6xxx_6351_family(ps) ||
            mv88e6xxx_6165_family(ps) || mv88e6xxx_6097_family(ps) ||
            mv88e6xxx_6185_family(ps) || mv88e6xxx_6095_family(ps) ||
                ret = _mv88e6xxx_reg_write(ps, REG_PORT(port),
                                           PORT_PCS_CTRL, reg);
                if (ret)
-                       goto abort;
+                       return ret;
        }
 
        /* Port Control: disable Drop-on-Unlock, disable Drop-on-Lock,
                ret = _mv88e6xxx_reg_write(ps, REG_PORT(port),
                                           PORT_CONTROL, reg);
                if (ret)
-                       goto abort;
+                       return ret;
        }
 
        /* If this port is connected to a SerDes, make sure the SerDes is not
        if (mv88e6xxx_6352_family(ps)) {
                ret = _mv88e6xxx_reg_read(ps, REG_PORT(port), PORT_STATUS);
                if (ret < 0)
-                       goto abort;
+                       return ret;
                ret &= PORT_STATUS_CMODE_MASK;
                if ((ret == PORT_STATUS_CMODE_100BASE_X) ||
                    (ret == PORT_STATUS_CMODE_1000BASE_X) ||
                    (ret == PORT_STATUS_CMODE_SGMII)) {
                        ret = mv88e6xxx_power_on_serdes(ps);
                        if (ret < 0)
-                               goto abort;
+                               return ret;
                }
        }
 
                ret = _mv88e6xxx_reg_write(ps, REG_PORT(port),
                                           PORT_CONTROL_2, reg);
                if (ret)
-                       goto abort;
+                       return ret;
        }
 
        /* Port Association Vector: when learning source addresses
 
        ret = _mv88e6xxx_reg_write(ps, REG_PORT(port), PORT_ASSOC_VECTOR, reg);
        if (ret)
-               goto abort;
+               return ret;
 
        /* Egress rate control 2: disable egress rate control. */
        ret = _mv88e6xxx_reg_write(ps, REG_PORT(port), PORT_RATE_CONTROL_2,
                                   0x0000);
        if (ret)
-               goto abort;
+               return ret;
 
        if (mv88e6xxx_6352_family(ps) || mv88e6xxx_6351_family(ps) ||
            mv88e6xxx_6165_family(ps) || mv88e6xxx_6097_family(ps) ||
                ret = _mv88e6xxx_reg_write(ps, REG_PORT(port),
                                           PORT_PAUSE_CTRL, 0x0000);
                if (ret)
-                       goto abort;
+                       return ret;
 
                /* Port ATU control: disable limiting the number of
                 * address database entries that this port is allowed
                ret = _mv88e6xxx_reg_write(ps, REG_PORT(port),
                                           PORT_PRI_OVERRIDE, 0x0000);
                if (ret)
-                       goto abort;
+                       return ret;
 
                /* Port Ethertype: use the Ethertype DSA Ethertype
                 * value.
                ret = _mv88e6xxx_reg_write(ps, REG_PORT(port),
                                           PORT_ETH_TYPE, ETH_P_EDSA);
                if (ret)
-                       goto abort;
+                       return ret;
                /* Tag Remap: use an identity 802.1p prio -> switch
                 * prio mapping.
                 */
                ret = _mv88e6xxx_reg_write(ps, REG_PORT(port),
                                           PORT_TAG_REGMAP_0123, 0x3210);
                if (ret)
-                       goto abort;
+                       return ret;
 
                /* Tag Remap 2: use an identity 802.1p prio -> switch
                 * prio mapping.
                ret = _mv88e6xxx_reg_write(ps, REG_PORT(port),
                                           PORT_TAG_REGMAP_4567, 0x7654);
                if (ret)
-                       goto abort;
+                       return ret;
        }
 
        if (mv88e6xxx_6352_family(ps) || mv88e6xxx_6351_family(ps) ||
                ret = _mv88e6xxx_reg_write(ps, REG_PORT(port),
                                           PORT_RATE_CONTROL, 0x0001);
                if (ret)
-                       goto abort;
+                       return ret;
        }
 
        /* Port Control 1: disable trunking, disable sending
         */
        ret = _mv88e6xxx_reg_write(ps, REG_PORT(port), PORT_CONTROL_1, 0x0000);
        if (ret)
-               goto abort;
+               return ret;
 
        /* Port based VLAN map: give each port the same default address
         * database, and allow bidirectional communication between the
         */
        ret = _mv88e6xxx_port_fid_set(ps, port, 0);
        if (ret)
-               goto abort;
+               return ret;
 
        ret = _mv88e6xxx_port_based_vlan_map(ps, port);
        if (ret)
-               goto abort;
+               return ret;
 
        /* Default VLAN ID and priority: don't set a default VLAN
         * ID, and set the default packet priority to zero.
         */
        ret = _mv88e6xxx_reg_write(ps, REG_PORT(port), PORT_DEFAULT_VLAN,
                                   0x0000);
-abort:
-       mutex_unlock(&ps->smi_mutex);
-       return ret;
-}
-
-int mv88e6xxx_setup_ports(struct dsa_switch *ds)
-{
-       struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
-       int ret;
-       int i;
+       if (ret)
+               return ret;
 
-       for (i = 0; i < ps->info->num_ports; i++) {
-               ret = mv88e6xxx_setup_port(ds, i);
-               if (ret < 0)
-                       return ret;
-       }
        return 0;
 }
 
        return err;
 }
 
-int mv88e6xxx_setup_common(struct mv88e6xxx_priv_state *ps)
+int mv88e6xxx_setup(struct dsa_switch *ds)
 {
+       struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
        int err;
+       int i;
+
+       ps->ds = ds;
 
        mutex_init(&ps->smi_mutex);
 
                goto unlock;
 
        err = mv88e6xxx_setup_global(ps);
+       if (err)
+               goto unlock;
+
+       for (i = 0; i < ps->info->num_ports; i++) {
+               err = mv88e6xxx_setup_port(ps, i);
+               if (err)
+                       goto unlock;
+       }
 
 unlock:
        mutex_unlock(&ps->smi_mutex);