mediatek: fix mdio schedule while atomic error
[openwrt/openwrt.git] / target / linux / mediatek / patches-4.9 / 0062-mdio-atomic.patch
1 Index: linux-4.9.47/drivers/net/ethernet/mediatek/mtk_eth_soc.c
2 ===================================================================
3 --- linux-4.9.47.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.c
4 +++ linux-4.9.47/drivers/net/ethernet/mediatek/mtk_eth_soc.c
5 @@ -97,7 +97,10 @@ static int mtk_mdio_busy_wait(struct mtk
6 return 0;
7 if (time_after(jiffies, t_start + PHY_IAC_TIMEOUT))
8 break;
9 - usleep_range(10, 20);
10 + if (in_atomic())
11 + udelay(10);
12 + else
13 + usleep_range(10, 20);
14 }
15
16 dev_err(eth->dev, "mdio: MDIO timeout\n");