Commit b96ab7cc authored by Mark Einon's avatar Mark Einon Committed by Greg Kroah-Hartman

staging: et131x: improve indenting in et131x_adjust_link()

Negate some 'if' checks to return early, allowing a large block of code
to be un-indented.
Signed-off-by: default avatarMark Einon <mark.einon@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 58b179dc
...@@ -3754,97 +3754,99 @@ static void et131x_adjust_link(struct net_device *netdev) ...@@ -3754,97 +3754,99 @@ static void et131x_adjust_link(struct net_device *netdev)
struct et131x_adapter *adapter = netdev_priv(netdev); struct et131x_adapter *adapter = netdev_priv(netdev);
struct phy_device *phydev = adapter->phydev; struct phy_device *phydev = adapter->phydev;
if (phydev && phydev->link != adapter->link) { if (!phydev)
/* Check to see if we are in coma mode and if return;
* so, disable it because we will not be able if (phydev->link == adapter->link)
* to read PHY values until we are out. return;
*/
if (et1310_in_phy_coma(adapter))
et1310_disable_phy_coma(adapter);
adapter->link = phydev->link;
phy_print_status(phydev);
if (phydev->link) {
adapter->boot_coma = 20;
if (phydev && phydev->speed == SPEED_10) {
/* NOTE - Is there a way to query this without
* TruePHY?
* && TRU_QueryCoreType(adapter->hTruePhy, 0)==
* EMI_TRUEPHY_A13O) {
*/
u16 register18;
et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG,
&register18);
et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
register18 | 0x4);
et131x_mii_write(adapter, PHY_INDEX_REG,
register18 | 0x8402);
et131x_mii_write(adapter, PHY_DATA_REG,
register18 | 511);
et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
register18);
}
et1310_config_flow_control(adapter); /* Check to see if we are in coma mode and if
* so, disable it because we will not be able
* to read PHY values until we are out.
*/
if (et1310_in_phy_coma(adapter))
et1310_disable_phy_coma(adapter);
if (phydev && phydev->speed == SPEED_1000 && adapter->link = phydev->link;
adapter->registry_jumbo_packet > 2048) { phy_print_status(phydev);
u16 reg;
et131x_mii_read(adapter, PHY_CONFIG, &reg); if (phydev->link) {
reg &= ~ET_PHY_CONFIG_TX_FIFO_DEPTH; adapter->boot_coma = 20;
reg |= ET_PHY_CONFIG_FIFO_DEPTH_32; if (phydev && phydev->speed == SPEED_10) {
et131x_mii_write(adapter, PHY_CONFIG, reg); /* NOTE - Is there a way to query this without
} * TruePHY?
* && TRU_QueryCoreType(adapter->hTruePhy, 0)==
* EMI_TRUEPHY_A13O) {
*/
u16 register18;
et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG,
&register18);
et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
register18 | 0x4);
et131x_mii_write(adapter, PHY_INDEX_REG,
register18 | 0x8402);
et131x_mii_write(adapter, PHY_DATA_REG,
register18 | 511);
et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
register18);
}
et131x_set_rx_dma_timer(adapter); et1310_config_flow_control(adapter);
et1310_config_mac_regs2(adapter);
} else {
adapter->boot_coma = 0;
if (phydev->speed == SPEED_10) { if (phydev && phydev->speed == SPEED_1000 &&
/* NOTE - Is there a way to query this without adapter->registry_jumbo_packet > 2048) {
* TruePHY? u16 reg;
* && TRU_QueryCoreType(adapter->hTruePhy, 0) ==
* EMI_TRUEPHY_A13O)
*/
u16 register18;
et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG,
&register18);
et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
register18 | 0x4);
et131x_mii_write(adapter, PHY_INDEX_REG,
register18 | 0x8402);
et131x_mii_write(adapter, PHY_DATA_REG,
register18 | 511);
et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
register18);
}
/* Free the packets being actively sent & stopped */ et131x_mii_read(adapter, PHY_CONFIG, &reg);
et131x_free_busy_send_packets(adapter); reg &= ~ET_PHY_CONFIG_TX_FIFO_DEPTH;
reg |= ET_PHY_CONFIG_FIFO_DEPTH_32;
et131x_mii_write(adapter, PHY_CONFIG, reg);
}
/* Re-initialize the send structures */ et131x_set_rx_dma_timer(adapter);
et131x_init_send(adapter); et1310_config_mac_regs2(adapter);
} else {
adapter->boot_coma = 0;
/* Bring the device back to the state it was during if (phydev->speed == SPEED_10) {
* init prior to autonegotiation being complete. This /* NOTE - Is there a way to query this without
* way, when we get the auto-neg complete interrupt, * TruePHY?
* we can complete init by calling config_mac_regs2. * && TRU_QueryCoreType(adapter->hTruePhy, 0) ==
* EMI_TRUEPHY_A13O)
*/ */
et131x_soft_reset(adapter); u16 register18;
et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG,
&register18);
et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
register18 | 0x4);
et131x_mii_write(adapter, PHY_INDEX_REG,
register18 | 0x8402);
et131x_mii_write(adapter, PHY_DATA_REG,
register18 | 511);
et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG,
register18);
}
/* Setup ET1310 as per the documentation */ /* Free the packets being actively sent & stopped */
et131x_adapter_setup(adapter); et131x_free_busy_send_packets(adapter);
/* perform reset of tx/rx */ /* Re-initialize the send structures */
et131x_disable_txrx(netdev); et131x_init_send(adapter);
et131x_enable_txrx(netdev);
} /* Bring the device back to the state it was during
* init prior to autonegotiation being complete. This
* way, when we get the auto-neg complete interrupt,
* we can complete init by calling config_mac_regs2.
*/
et131x_soft_reset(adapter);
/* Setup ET1310 as per the documentation */
et131x_adapter_setup(adapter);
/* perform reset of tx/rx */
et131x_disable_txrx(netdev);
et131x_enable_txrx(netdev);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment