net: pch_gbe: Remove power_{up,down}_phy HAL abstraction

For some reason the pch_gbe driver contains a struct pch_gbe_functions
with pointers used by a HAL abstraction layer, even though there is only
one implementation of each function.

This patch removes the power_up_phy & power_down_phy abstractions in
favor of calling pch_phy_power_up & pch_phy_power_down directly.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Paul Burton 2018-06-22 20:17:41 -07:00 committed by David S. Miller
parent 33bfdeaa76
commit ac6c0e0aa4
4 changed files with 6 additions and 34 deletions

View File

@ -336,8 +336,6 @@ struct pch_gbe_hw;
* @write_phy_reg: for pch_gbe_hal_write_phy_reg * @write_phy_reg: for pch_gbe_hal_write_phy_reg
* @reset_phy: for pch_gbe_hal_phy_hw_reset * @reset_phy: for pch_gbe_hal_phy_hw_reset
* @sw_reset_phy: for pch_gbe_hal_phy_sw_reset * @sw_reset_phy: for pch_gbe_hal_phy_sw_reset
* @power_up_phy: for pch_gbe_hal_power_up_phy
* @power_down_phy: for pch_gbe_hal_power_down_phy
* @read_mac_addr: for pch_gbe_hal_read_mac_addr * @read_mac_addr: for pch_gbe_hal_read_mac_addr
*/ */
struct pch_gbe_functions { struct pch_gbe_functions {
@ -347,8 +345,6 @@ struct pch_gbe_functions {
s32 (*write_phy_reg) (struct pch_gbe_hw *, u32, u16); s32 (*write_phy_reg) (struct pch_gbe_hw *, u32, u16);
void (*reset_phy) (struct pch_gbe_hw *); void (*reset_phy) (struct pch_gbe_hw *);
void (*sw_reset_phy) (struct pch_gbe_hw *); void (*sw_reset_phy) (struct pch_gbe_hw *);
void (*power_up_phy) (struct pch_gbe_hw *hw);
void (*power_down_phy) (struct pch_gbe_hw *hw);
s32 (*read_mac_addr) (struct pch_gbe_hw *); s32 (*read_mac_addr) (struct pch_gbe_hw *);
}; };

View File

@ -90,8 +90,6 @@ static const struct pch_gbe_functions pch_gbe_ops = {
.write_phy_reg = pch_gbe_phy_write_reg_miic, .write_phy_reg = pch_gbe_phy_write_reg_miic,
.reset_phy = pch_gbe_phy_hw_reset, .reset_phy = pch_gbe_phy_hw_reset,
.sw_reset_phy = pch_gbe_phy_sw_reset, .sw_reset_phy = pch_gbe_phy_sw_reset,
.power_up_phy = pch_gbe_phy_power_up,
.power_down_phy = pch_gbe_phy_power_down,
.read_mac_addr = pch_gbe_mac_read_mac_addr .read_mac_addr = pch_gbe_mac_read_mac_addr
}; };
@ -240,23 +238,3 @@ s32 pch_gbe_hal_read_mac_addr(struct pch_gbe_hw *hw)
} }
return hw->func->read_mac_addr(hw); return hw->func->read_mac_addr(hw);
} }
/**
* pch_gbe_hal_power_up_phy - Power up PHY
* @hw: Pointer to the HW structure
*/
void pch_gbe_hal_power_up_phy(struct pch_gbe_hw *hw)
{
if (hw->func->power_up_phy)
hw->func->power_up_phy(hw);
}
/**
* pch_gbe_hal_power_down_phy - Power down PHY
* @hw: Pointer to the HW structure
*/
void pch_gbe_hal_power_down_phy(struct pch_gbe_hw *hw)
{
if (hw->func->power_down_phy)
hw->func->power_down_phy(hw);
}

View File

@ -29,7 +29,5 @@ s32 pch_gbe_hal_write_phy_reg(struct pch_gbe_hw *hw, u32 offset, u16 data);
void pch_gbe_hal_phy_hw_reset(struct pch_gbe_hw *hw); void pch_gbe_hal_phy_hw_reset(struct pch_gbe_hw *hw);
void pch_gbe_hal_phy_sw_reset(struct pch_gbe_hw *hw); void pch_gbe_hal_phy_sw_reset(struct pch_gbe_hw *hw);
s32 pch_gbe_hal_read_mac_addr(struct pch_gbe_hw *hw); s32 pch_gbe_hal_read_mac_addr(struct pch_gbe_hw *hw);
void pch_gbe_hal_power_up_phy(struct pch_gbe_hw *hw);
void pch_gbe_hal_power_down_phy(struct pch_gbe_hw *hw);
#endif #endif

View File

@ -2072,7 +2072,7 @@ static int pch_gbe_open(struct net_device *netdev)
err = pch_gbe_setup_rx_resources(adapter, adapter->rx_ring); err = pch_gbe_setup_rx_resources(adapter, adapter->rx_ring);
if (err) if (err)
goto err_setup_rx; goto err_setup_rx;
pch_gbe_hal_power_up_phy(hw); pch_gbe_phy_power_up(hw);
err = pch_gbe_up(adapter); err = pch_gbe_up(adapter);
if (err) if (err)
goto err_up; goto err_up;
@ -2081,7 +2081,7 @@ static int pch_gbe_open(struct net_device *netdev)
err_up: err_up:
if (!adapter->wake_up_evt) if (!adapter->wake_up_evt)
pch_gbe_hal_power_down_phy(hw); pch_gbe_phy_power_down(hw);
pch_gbe_free_rx_resources(adapter, adapter->rx_ring); pch_gbe_free_rx_resources(adapter, adapter->rx_ring);
err_setup_rx: err_setup_rx:
pch_gbe_free_tx_resources(adapter, adapter->tx_ring); pch_gbe_free_tx_resources(adapter, adapter->tx_ring);
@ -2104,7 +2104,7 @@ static int pch_gbe_stop(struct net_device *netdev)
pch_gbe_down(adapter); pch_gbe_down(adapter);
if (!adapter->wake_up_evt) if (!adapter->wake_up_evt)
pch_gbe_hal_power_down_phy(hw); pch_gbe_phy_power_down(hw);
pch_gbe_free_tx_resources(adapter, adapter->tx_ring); pch_gbe_free_tx_resources(adapter, adapter->tx_ring);
pch_gbe_free_rx_resources(adapter, adapter->rx_ring); pch_gbe_free_rx_resources(adapter, adapter->rx_ring);
return 0; return 0;
@ -2434,7 +2434,7 @@ static pci_ers_result_t pch_gbe_io_slot_reset(struct pci_dev *pdev)
} }
pci_set_master(pdev); pci_set_master(pdev);
pci_enable_wake(pdev, PCI_D0, 0); pci_enable_wake(pdev, PCI_D0, 0);
pch_gbe_hal_power_up_phy(hw); pch_gbe_phy_power_up(hw);
pch_gbe_reset(adapter); pch_gbe_reset(adapter);
/* Clear wake up status */ /* Clear wake up status */
pch_gbe_mac_set_wol_event(hw, 0); pch_gbe_mac_set_wol_event(hw, 0);
@ -2479,7 +2479,7 @@ static int __pch_gbe_suspend(struct pci_dev *pdev)
pch_gbe_mac_set_wol_event(hw, wufc); pch_gbe_mac_set_wol_event(hw, wufc);
pci_disable_device(pdev); pci_disable_device(pdev);
} else { } else {
pch_gbe_hal_power_down_phy(hw); pch_gbe_phy_power_down(hw);
pch_gbe_mac_set_wol_event(hw, wufc); pch_gbe_mac_set_wol_event(hw, wufc);
pci_disable_device(pdev); pci_disable_device(pdev);
} }
@ -2508,7 +2508,7 @@ static int pch_gbe_resume(struct device *device)
return err; return err;
} }
pci_set_master(pdev); pci_set_master(pdev);
pch_gbe_hal_power_up_phy(hw); pch_gbe_phy_power_up(hw);
pch_gbe_reset(adapter); pch_gbe_reset(adapter);
/* Clear wake on lan control and status */ /* Clear wake on lan control and status */
pch_gbe_mac_set_wol_event(hw, 0); pch_gbe_mac_set_wol_event(hw, 0);