From: Alexander Couzens Date: Wed, 2 Jun 2021 00:01:53 +0000 (+0000) Subject: ramips: ethernet: ralink: allow to return EPROBE_DEFER on switch_init X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=74c58c9d5844d52e23a7fc52f4d45a5fedd06a2b;p=openwrt%2Fstaging%2Frmilecki.git ramips: ethernet: ralink: allow to return EPROBE_DEFER on switch_init For rt3050 the switch needs to be initialized before the ethernet start sending packets. Allow switch_init to return -EPROBE_DEFER. Signed-off-by: Alexander Couzens --- diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c index 8a088bd5cea..cf6d4806eda 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c @@ -1376,11 +1376,16 @@ static int __init fe_init(struct net_device *dev) else fe_reset_fe(priv); - if (priv->soc->switch_init) - if (priv->soc->switch_init(priv)) { + if (priv->soc->switch_init) { + err = priv->soc->switch_init(priv); + if (err) { + if (err == -EPROBE_DEFER) + return err; + netdev_err(dev, "failed to initialize switch core\n"); return -ENODEV; } + } fe_reset_phy(priv);