net: pch_gbe: Remove init_hw HAL abstraction
authorPaul Burton <paul.burton@mips.com>
Sat, 23 Jun 2018 03:17:46 +0000 (20:17 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 23 Jun 2018 11:52:08 +0000 (20:52 +0900)
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 init_hw abstraction in favor of inlining its
single implementation (pch_gbe_plat_init_hw) into its single caller
(pch_gbe_reset).

Signed-off-by: Paul Burton <paul.burton@mips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_api.c
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_api.h
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c

index 728e876bffc6ad32b82cee7df21d87d78a588d08..2e824baff9d74e95dff00f4de8d879e9574773f3 100644 (file)
@@ -331,11 +331,9 @@ struct pch_gbe_hw;
 /**
  * struct  pch_gbe_functions - HAL APi function pointer
  * @get_bus_info:      for pch_gbe_hal_get_bus_info
- * @init_hw:           for pch_gbe_hal_init_hw
  */
 struct pch_gbe_functions {
        void (*get_bus_info) (struct pch_gbe_hw *);
-       s32 (*init_hw) (struct pch_gbe_hw *);
 };
 
 /**
index 484be422535282ead23a48c68677dd7796c4154f..03fbd4752d4f658e3970da712f1b9b0e48633dbf 100644 (file)
@@ -57,35 +57,8 @@ static void pch_gbe_plat_get_bus_info(struct pch_gbe_hw *hw)
        hw->bus.width = pch_gbe_bus_width_pcie_x1;
 }
 
-/**
- * pch_gbe_plat_init_hw - Initialize hardware
- * @hw:        Pointer to the HW structure
- * Returns:
- *     0:              Successfully
- *     Negative value: Failed-EBUSY
- */
-static s32 pch_gbe_plat_init_hw(struct pch_gbe_hw *hw)
-{
-       s32 ret_val;
-
-       ret_val = pch_gbe_phy_get_id(hw);
-       if (ret_val) {
-               struct pch_gbe_adapter *adapter = pch_gbe_hw_to_adapter(hw);
-
-               netdev_err(adapter->netdev, "pch_gbe_phy_get_id error\n");
-               return ret_val;
-       }
-       pch_gbe_phy_init_setting(hw);
-       /* Setup Mac interface option RGMII */
-#ifdef PCH_GBE_MAC_IFOP_RGMII
-       pch_gbe_phy_set_rgmii(hw);
-#endif
-       return ret_val;
-}
-
 static const struct pch_gbe_functions pch_gbe_ops = {
        .get_bus_info      = pch_gbe_plat_get_bus_info,
-       .init_hw           = pch_gbe_plat_init_hw,
 };
 
 /**
@@ -133,21 +106,3 @@ void pch_gbe_hal_get_bus_info(struct pch_gbe_hw *hw)
        }
        hw->func->get_bus_info(hw);
 }
-
-/**
- * pch_gbe_hal_init_hw - Initialize hardware
- * @hw:        Pointer to the HW structure
- * Returns:
- *     0:      Successfully
- *     ENOSYS: Function is not registered
- */
-s32 pch_gbe_hal_init_hw(struct pch_gbe_hw *hw)
-{
-       if (!hw->func->init_hw) {
-               struct pch_gbe_adapter *adapter = pch_gbe_hw_to_adapter(hw);
-
-               netdev_err(adapter->netdev, "ERROR: configuration\n");
-               return -ENOSYS;
-       }
-       return hw->func->init_hw(hw);
-}
index 9cd19605f4ff257fce67e4f2acb1973e729a69ae..56cae9cfb5c518b3e1161aee90472bd159ea8c4d 100644 (file)
@@ -23,6 +23,5 @@
 
 s32 pch_gbe_hal_setup_init_funcs(struct pch_gbe_hw *hw);
 void pch_gbe_hal_get_bus_info(struct pch_gbe_hw *hw);
-s32 pch_gbe_hal_init_hw(struct pch_gbe_hw *hw);
 
 #endif
index 175d6608bdb904116fe478a0fadbf114bf2e09e1..9297a94df999325d56390951069a69759748fde3 100644 (file)
@@ -760,14 +760,25 @@ void pch_gbe_reinit_locked(struct pch_gbe_adapter *adapter)
 void pch_gbe_reset(struct pch_gbe_adapter *adapter)
 {
        struct net_device *netdev = adapter->netdev;
+       struct pch_gbe_hw *hw = &adapter->hw;
+       s32 ret_val;
 
-       pch_gbe_mac_reset_hw(&adapter->hw);
+       pch_gbe_mac_reset_hw(hw);
        /* reprogram multicast address register after reset */
        pch_gbe_set_multi(netdev);
        /* Setup the receive address. */
-       pch_gbe_mac_init_rx_addrs(&adapter->hw, PCH_GBE_MAR_ENTRIES);
-       if (pch_gbe_hal_init_hw(&adapter->hw))
-               netdev_err(netdev, "Hardware Error\n");
+       pch_gbe_mac_init_rx_addrs(hw, PCH_GBE_MAR_ENTRIES);
+
+       ret_val = pch_gbe_phy_get_id(hw);
+       if (ret_val) {
+               netdev_err(adapter->netdev, "pch_gbe_phy_get_id error\n");
+               return;
+       }
+       pch_gbe_phy_init_setting(hw);
+       /* Setup Mac interface option RGMII */
+#ifdef PCH_GBE_MAC_IFOP_RGMII
+       pch_gbe_phy_set_rgmii(hw);
+#endif
 }
 
 /**