Move the delayed work initialization of the per-port MIB polling from yt921x_mdio_probe() into the DSA .setup() callback, changing its lifetime from once per probe() to once per DSA .setup(). Signed-off-by: Kyle Switch --- drivers/net/dsa/motorcomm/chip.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c index 13fc286d4194..c7cfaf244274 100644 --- a/drivers/net/dsa/motorcomm/chip.c +++ b/drivers/net/dsa/motorcomm/chip.c @@ -4251,6 +4251,14 @@ static int yt921x_dsa_setup(struct dsa_switch *ds) int port; int res; + /* mib polling init */ + for (size_t i = 0; i < ARRAY_SIZE(priv->ports); i++) { + struct yt921x_port *pp = &priv->ports[i]; + + pp->index = i; + INIT_DELAYED_WORK(&pp->mib_read, yt921x_poll_mib); + } + mutex_lock(&priv->reg_lock); res = yt921x_chip_reset(priv); mutex_unlock(&priv->reg_lock); @@ -4525,13 +4533,6 @@ static int yt921x_mdio_probe(struct mdio_device *mdiodev) priv->reg_ops = &yt921x_reg_ops_mdio; priv->reg_ctx = mdio; - for (size_t i = 0; i < ARRAY_SIZE(priv->ports); i++) { - struct yt921x_port *pp = &priv->ports[i]; - - pp->index = i; - INIT_DELAYED_WORK(&pp->mib_read, yt921x_poll_mib); - } - ds = &priv->ds; ds->dev = dev; ds->priv = priv; -- 2.25.1