net: pch_gbe: Remove read_mac_addr HAL abstraction
authorPaul Burton <paul.burton@mips.com>
Sat, 23 Jun 2018 03:17:42 +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 read_mac_addr abstraction in favor of calling
pch_gbe_mac_read_mac_addr directly. Since this is defined in the same
translation unit as all of its callers, we can make it static & remove
it from the pch_gbe.h header.

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 8dc40faef720d30aaa667240b9b1857b6d2c3b14..5dbfcd55efa8647f0b4c0ead2732958ab5e905fe 100644 (file)
@@ -336,7 +336,6 @@ struct pch_gbe_hw;
  * @write_phy_reg:     for pch_gbe_hal_write_phy_reg
  * @reset_phy:         for pch_gbe_hal_phy_hw_reset
  * @sw_reset_phy:      for pch_gbe_hal_phy_sw_reset
- * @read_mac_addr:     for pch_gbe_hal_read_mac_addr
  */
 struct pch_gbe_functions {
        void (*get_bus_info) (struct pch_gbe_hw *);
@@ -345,7 +344,6 @@ struct pch_gbe_functions {
        s32 (*write_phy_reg) (struct pch_gbe_hw *, u32, u16);
        void (*reset_phy) (struct pch_gbe_hw *);
        void (*sw_reset_phy) (struct pch_gbe_hw *);
-       s32 (*read_mac_addr) (struct pch_gbe_hw *);
 };
 
 /**
@@ -676,7 +674,6 @@ void pch_gbe_set_ethtool_ops(struct net_device *netdev);
 
 /* pch_gbe_mac.c */
 s32 pch_gbe_mac_force_mac_fc(struct pch_gbe_hw *hw);
-s32 pch_gbe_mac_read_mac_addr(struct pch_gbe_hw *hw);
 u16 pch_gbe_mac_ctrl_miim(struct pch_gbe_hw *hw, u32 addr, u32 dir, u32 reg,
                          u16 data);
 #endif /* _PCH_GBE_H_ */
index d66933b6893470e5f5924d10e598412d77f40995..3c6e009955ab12a51c815a225988c54203c31e00 100644 (file)
@@ -90,7 +90,6 @@ static const struct pch_gbe_functions pch_gbe_ops = {
        .write_phy_reg     = pch_gbe_phy_write_reg_miic,
        .reset_phy         = pch_gbe_phy_hw_reset,
        .sw_reset_phy      = pch_gbe_phy_sw_reset,
-       .read_mac_addr     = pch_gbe_mac_read_mac_addr
 };
 
 /**
@@ -220,21 +219,3 @@ void pch_gbe_hal_phy_sw_reset(struct pch_gbe_hw *hw)
        }
        hw->func->sw_reset_phy(hw);
 }
-
-/**
- * pch_gbe_hal_read_mac_addr - Reads MAC address
- * @hw:        Pointer to the HW structure
- * Returns:
- *     0:      Successfully
- *     ENOSYS: Function is not registered
- */
-s32 pch_gbe_hal_read_mac_addr(struct pch_gbe_hw *hw)
-{
-       if (!hw->func->read_mac_addr) {
-               struct pch_gbe_adapter *adapter = pch_gbe_hw_to_adapter(hw);
-
-               netdev_err(adapter->netdev, "ERROR: configuration\n");
-               return -ENOSYS;
-       }
-       return hw->func->read_mac_addr(hw);
-}
index be2f202c26c4c8e08c8bdddb580d879afb670a57..13fcdfb4a94dd08d92ff304d7b0963cb7efce391 100644 (file)
@@ -28,6 +28,5 @@ s32 pch_gbe_hal_read_phy_reg(struct pch_gbe_hw *hw, u32 offset, u16 *data);
 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_sw_reset(struct pch_gbe_hw *hw);
-s32 pch_gbe_hal_read_mac_addr(struct pch_gbe_hw *hw);
 
 #endif
index 13fc828c7fd3db8d25d06a9ef07d17094464e776..fc5079fa01e838b46238e0ba1b2d0ef82cf43878 100644 (file)
@@ -287,7 +287,7 @@ static inline void pch_gbe_mac_load_mac_addr(struct pch_gbe_hw *hw)
  * Returns:
  *     0:                      Successful.
  */
-s32 pch_gbe_mac_read_mac_addr(struct pch_gbe_hw *hw)
+static s32 pch_gbe_mac_read_mac_addr(struct pch_gbe_hw *hw)
 {
        struct pch_gbe_adapter *adapter = pch_gbe_hw_to_adapter(hw);
        u32  adr1a, adr1b;
@@ -2627,7 +2627,7 @@ static int pch_gbe_probe(struct pci_dev *pdev,
        pch_gbe_hal_get_bus_info(&adapter->hw);
 
        /* Read the MAC address. and store to the private data */
-       ret = pch_gbe_hal_read_mac_addr(&adapter->hw);
+       ret = pch_gbe_mac_read_mac_addr(&adapter->hw);
        if (ret) {
                dev_err(&pdev->dev, "MAC address Read Error\n");
                goto err_free_adapter;