From: Maxim Uvarov Date: Thu, 10 Aug 2017 07:47:46 +0000 (+0300) Subject: drivers: net: davinci_mdio: remove busy loop on wait user access X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=2e1c80847b9983a8c93a678f6de2dc3c42f19661;p=openwrt%2Fstaging%2Fblogic.git drivers: net: davinci_mdio: remove busy loop on wait user access Polling 14 mdio devices on single mdio bus eats 30% of 1Ghz cpu time due to busy loop in wait(). Add small delay to relax cpu. Signed-off-by: Max Uvarov Reviewed-by: Andrew Lunn Reviewed-by: Grygorii Strashko Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c index 33df340db1f1..611e7cc5f07b 100644 --- a/drivers/net/ethernet/ti/davinci_mdio.c +++ b/drivers/net/ethernet/ti/davinci_mdio.c @@ -198,8 +198,10 @@ static inline int wait_for_user_access(struct davinci_mdio_data *data) return 0; reg = __raw_readl(®s->control); - if ((reg & CONTROL_IDLE) == 0) + if ((reg & CONTROL_IDLE) == 0) { + usleep_range(100, 200); continue; + } /* * An emac soft_reset may have clobbered the mdio controller's