net: dsa: Rename DSA probe function.
[deliverable/linux.git] / drivers / net / dsa / bcm_sf2.c
index 95944d5e3e22a1a333fdbd5a4576b0f4f949c705..50caa525cda37f21fc51ecf5747f032fb76bfedb 100644 (file)
@@ -135,8 +135,17 @@ static int bcm_sf2_sw_get_sset_count(struct dsa_switch *ds)
        return BCM_SF2_STATS_SIZE;
 }
 
-static char *bcm_sf2_sw_probe(struct device *host_dev, int sw_addr)
+static char *bcm_sf2_sw_drv_probe(struct device *dsa_dev,
+                                 struct device *host_dev,
+                                 int sw_addr, void **_priv)
 {
+       struct bcm_sf2_priv *priv;
+
+       priv = devm_kzalloc(dsa_dev, sizeof(*priv), GFP_KERNEL);
+       if (!priv)
+               return NULL;
+       *_priv = priv;
+
        return "Broadcom Starfighter 2";
 }
 
@@ -545,12 +554,11 @@ static void bcm_sf2_sw_br_leave(struct dsa_switch *ds, int port)
        priv->port_sts[port].bridge_dev = NULL;
 }
 
-static int bcm_sf2_sw_br_set_stp_state(struct dsa_switch *ds, int port,
-                                      u8 state)
+static void bcm_sf2_sw_br_set_stp_state(struct dsa_switch *ds, int port,
+                                       u8 state)
 {
        struct bcm_sf2_priv *priv = ds_to_priv(ds);
        u8 hw_state, cur_hw_state;
-       int ret = 0;
        u32 reg;
 
        reg = core_readl(priv, CORE_G_PCTL_PORT(port));
@@ -574,7 +582,7 @@ static int bcm_sf2_sw_br_set_stp_state(struct dsa_switch *ds, int port,
                break;
        default:
                pr_err("%s: invalid STP state: %d\n", __func__, state);
-               return -EINVAL;
+               return;
        }
 
        /* Fast-age ARL entries if we are moving a port from Learning or
@@ -584,10 +592,9 @@ static int bcm_sf2_sw_br_set_stp_state(struct dsa_switch *ds, int port,
        if (cur_hw_state != hw_state) {
                if (cur_hw_state >= G_MISTP_LEARN_STATE &&
                    hw_state <= G_MISTP_LISTEN_STATE) {
-                       ret = bcm_sf2_sw_fast_age_port(ds, port);
-                       if (ret) {
+                       if (bcm_sf2_sw_fast_age_port(ds, port)) {
                                pr_err("%s: fast-ageing failed\n", __func__);
-                               return ret;
+                               return;
                        }
                }
        }
@@ -596,8 +603,6 @@ static int bcm_sf2_sw_br_set_stp_state(struct dsa_switch *ds, int port,
        reg &= ~(G_MISTP_STATE_MASK << G_MISTP_STATE_SHIFT);
        reg |= hw_state;
        core_writel(priv, reg, CORE_G_PCTL_PORT(port));
-
-       return 0;
 }
 
 /* Address Resolution Logic routines */
@@ -728,13 +733,14 @@ static int bcm_sf2_sw_fdb_prepare(struct dsa_switch *ds, int port,
        return 0;
 }
 
-static int bcm_sf2_sw_fdb_add(struct dsa_switch *ds, int port,
-                             const struct switchdev_obj_port_fdb *fdb,
-                             struct switchdev_trans *trans)
+static void bcm_sf2_sw_fdb_add(struct dsa_switch *ds, int port,
+                              const struct switchdev_obj_port_fdb *fdb,
+                              struct switchdev_trans *trans)
 {
        struct bcm_sf2_priv *priv = ds_to_priv(ds);
 
-       return bcm_sf2_arl_op(priv, 0, port, fdb->addr, fdb->vid, true);
+       if (bcm_sf2_arl_op(priv, 0, port, fdb->addr, fdb->vid, true))
+               pr_err("%s: failed to add MAC address\n", __func__);
 }
 
 static int bcm_sf2_sw_fdb_del(struct dsa_switch *ds, int port,
@@ -1365,8 +1371,7 @@ static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port,
 
 static struct dsa_switch_driver bcm_sf2_switch_driver = {
        .tag_protocol           = DSA_TAG_PROTO_BRCM,
-       .priv_size              = sizeof(struct bcm_sf2_priv),
-       .probe                  = bcm_sf2_sw_probe,
+       .probe                  = bcm_sf2_sw_drv_probe,
        .setup                  = bcm_sf2_sw_setup,
        .set_addr               = bcm_sf2_sw_set_addr,
        .get_phy_flags          = bcm_sf2_sw_get_phy_flags,
@@ -1387,7 +1392,7 @@ static struct dsa_switch_driver bcm_sf2_switch_driver = {
        .set_eee                = bcm_sf2_sw_set_eee,
        .port_bridge_join       = bcm_sf2_sw_br_join,
        .port_bridge_leave      = bcm_sf2_sw_br_leave,
-       .port_stp_update        = bcm_sf2_sw_br_set_stp_state,
+       .port_stp_state_set     = bcm_sf2_sw_br_set_stp_state,
        .port_fdb_prepare       = bcm_sf2_sw_fdb_prepare,
        .port_fdb_add           = bcm_sf2_sw_fdb_add,
        .port_fdb_del           = bcm_sf2_sw_fdb_del,
This page took 0.028351 seconds and 5 git commands to generate.