Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: phy: smsc: simplify config_init callback

Exit the driver specific config_init hook early if energy detection is
disabled. We can do this because we don't need to clear the interrupt
status here. Clearing the status should be removed anyway since this is
handled by the phy_enable_interrupts().

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Marco Felsch and committed by
David S. Miller
436e3800 73654945

+10 -8
+10 -8
drivers/net/phy/smsc.c
··· 73 73 static int smsc_phy_config_init(struct phy_device *phydev) 74 74 { 75 75 struct smsc_phy_priv *priv = phydev->priv; 76 + int rc; 76 77 77 - int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); 78 + if (!priv->energy_enable) 79 + return 0; 80 + 81 + rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); 78 82 79 83 if (rc < 0) 80 84 return rc; 81 85 82 - if (priv->energy_enable) { 83 - /* Enable energy detect mode for this SMSC Transceivers */ 84 - rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, 85 - rc | MII_LAN83C185_EDPWRDOWN); 86 - if (rc < 0) 87 - return rc; 88 - } 86 + /* Enable energy detect mode for this SMSC Transceivers */ 87 + rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, 88 + rc | MII_LAN83C185_EDPWRDOWN); 89 + if (rc < 0) 90 + return rc; 89 91 90 92 return smsc_phy_ack_interrupt(phydev); 91 93 }