mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	net: phy: avoid unneeded MDIO reads in genphy_read_status
Considering that in polling mode each link drop will be latched, settings can't have changed if link was up and is up. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									c1a92c0a6c
								
							
						
					
					
						commit
						88d6272aca
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1739,13 +1739,17 @@ EXPORT_SYMBOL(genphy_update_link);
 | 
			
		|||
 */
 | 
			
		||||
int genphy_read_status(struct phy_device *phydev)
 | 
			
		||||
{
 | 
			
		||||
	int adv, lpa, lpagb, err;
 | 
			
		||||
	int adv, lpa, lpagb, err, old_link = phydev->link;
 | 
			
		||||
 | 
			
		||||
	/* Update the link, but return if there was an error */
 | 
			
		||||
	err = genphy_update_link(phydev);
 | 
			
		||||
	if (err)
 | 
			
		||||
		return err;
 | 
			
		||||
 | 
			
		||||
	/* why bother the PHY if nothing can have changed */
 | 
			
		||||
	if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	phydev->speed = SPEED_UNKNOWN;
 | 
			
		||||
	phydev->duplex = DUPLEX_UNKNOWN;
 | 
			
		||||
	phydev->pause = 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue