Skip to contentSkip to conversation

igb: make local functions static and remove dead code

PATCH In review Stephen Hemminger 3 participants 4 messages Dec 12, 2013 – Dec 17, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igb: make local functions static and remove dead code

Make local functions static, and remove unused e1000_write_sfp_data_byte.

---
 drivers/net/ethernet/intel/igb/e1000_82575.c |    6 +++---
 drivers/net/ethernet/intel/igb/e1000_i210.c  |   18 +++++++++---------
 drivers/net/ethernet/intel/igb/e1000_i210.h  |    9 ---------
 drivers/net/ethernet/intel/igb/e1000_phy.c   |    2 +-
 drivers/net/ethernet/intel/igb/e1000_phy.h   |    1 -
 drivers/net/ethernet/intel/igb/igb.h         |    2 --
 drivers/net/ethernet/intel/igb/igb_ptp.c     |    6 ++++--
 7 files changed, 17 insertions(+), 27 deletions(-)
drivers/net/ethernet/intel/igb/e1000_82575.c +3 -3
@@ -2677,7 +2677,7 @@ out:
  *  Get EEE status by guessing based on whether Tx or Rx LPI indications have
  *  been received.
  **/
-s32 igb_get_eee_status_i354(struct e1000_hw *hw, bool *status)
+static s32 igb_get_eee_status_i354(struct e1000_hw *hw, bool *status)
 {
 	struct e1000_phy_info *phy = &hw->phy;
 	s32 ret_val = 0;
@@ -2720,7 +2720,7 @@ static const u8 e1000_emc_therm_limit[4]
  *
  *  Updates the temperatures in mac.thermal_sensor_data
  **/
-s32 igb_get_thermal_sensor_data_generic(struct e1000_hw *hw)
+static s32 igb_get_thermal_sensor_data_generic(struct e1000_hw *hw)
 {
 	s32 status = E1000_SUCCESS;
 	u16 ets_offset;
@@ -2774,7 +2774,7 @@ s32 igb_get_thermal_sensor_data_generic(
  *  Sets the thermal sensor thresholds according to the NVM map
  *  and save off the threshold and location values into mac.thermal_sensor_data
  **/
-s32 igb_init_thermal_sensor_thresh_generic(struct e1000_hw *hw)
+static s32 igb_init_thermal_sensor_thresh_generic(struct e1000_hw *hw)
 {
 	s32 status = E1000_SUCCESS;
 	u16 ets_offset;
drivers/net/ethernet/intel/igb/e1000_i210.c +11 -9
@@ -35,6 +35,8 @@
 #include "e1000_hw.h"
 #include "e1000_i210.h"
 
+static s32 igb_update_flash_i210(struct e1000_hw *hw);
+
 /**
  * igb_get_hw_semaphore_i210 - Acquire hardware semaphore
  *  @hw: pointer to the HW structure
@@ -111,7 +113,7 @@ static s32 igb_get_hw_semaphore_i210(str
  *  Return successful if access grant bit set, else clear the request for
  *  EEPROM access and return -E1000_ERR_NVM (-1).
  **/
-s32 igb_acquire_nvm_i210(struct e1000_hw *hw)
+static s32 igb_acquire_nvm_i210(struct e1000_hw *hw)
 {
 	return igb_acquire_swfw_sync_i210(hw, E1000_SWFW_EEP_SM);
 }
@@ -123,7 +125,7 @@ s32 igb_acquire_nvm_i210(struct e1000_hw
  *  Stop any current commands to the EEPROM and clear the EEPROM request bit,
  *  then release the semaphores acquired.
  **/
-void igb_release_nvm_i210(struct e1000_hw *hw)
+static void igb_release_nvm_i210(struct e1000_hw *hw)
 {
 	igb_release_swfw_sync_i210(hw, E1000_SWFW_EEP_SM);
 }
@@ -206,8 +208,8 @@ void igb_release_swfw_sync_i210(struct e
  *  Reads a 16 bit word from the Shadow Ram using the EERD register.
  *  Uses necessary synchronization semaphores.
  **/
-s32 igb_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words,
-			     u16 *data)
+static s32 igb_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words,
+				  u16 *data)
 {
 	s32 status = E1000_SUCCESS;
 	u16 i, count;
@@ -306,8 +308,8 @@ out:
  *  If error code is returned, data and Shadow RAM may be inconsistent - buffer
  *  partially written.
  **/
-s32 igb_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words,
-			      u16 *data)
+static s32 igb_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words,
+				   u16 *data)
 {
 	s32 status = E1000_SUCCESS;
 	u16 i, count;
@@ -555,7 +557,7 @@ s32 igb_read_invm_version(struct e1000_h
  *  Calculates the EEPROM checksum by reading/adding each word of the EEPROM
  *  and then verifies that the sum of the EEPROM is equal to 0xBABA.
  **/
-s32 igb_validate_nvm_checksum_i210(struct e1000_hw *hw)
+static s32 igb_validate_nvm_checksum_i210(struct e1000_hw *hw)
 {
 	s32 status = E1000_SUCCESS;
 	s32 (*read_op_ptr)(struct e1000_hw *, u16, u16, u16 *);
@@ -590,7 +592,7 @@ s32 igb_validate_nvm_checksum_i210(struc
  *  up to the checksum.  Then calculates the EEPROM checksum and writes the
  *  value to the EEPROM. Next commit EEPROM data onto the Flash.
  **/
-s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw)
+static s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw)
 {
 	s32 ret_val = E1000_SUCCESS;
 	u16 checksum = 0;
@@ -684,7 +686,7 @@ bool igb_get_flash_presence_i210(struct
  *  @hw: pointer to the HW structure
  *
  **/
-s32 igb_update_flash_i210(struct e1000_hw *hw)
+static s32 igb_update_flash_i210(struct e1000_hw *hw)
 {
 	s32 ret_val = E1000_SUCCESS;
 	u32 flup;
drivers/net/ethernet/intel/igb/e1000_i210.h +0 -9
@@ -28,17 +28,8 @@
 #ifndef _E1000_I210_H_
 #define _E1000_I210_H_
 
-s32 igb_update_flash_i210(struct e1000_hw *hw);
-s32 igb_update_nvm_checksum_i210(struct e1000_hw *hw);
-s32 igb_validate_nvm_checksum_i210(struct e1000_hw *hw);
-s32 igb_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words,
-			    u16 *data);
-s32 igb_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words,
-			   u16 *data);
 s32 igb_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask);
 void igb_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask);
-s32 igb_acquire_nvm_i210(struct e1000_hw *hw);
-void igb_release_nvm_i210(struct e1000_hw *hw);
 s32 igb_valid_led_default_i210(struct e1000_hw *hw, u16 *data);
 s32 igb_read_invm_version(struct e1000_hw *hw,
 			  struct e1000_fw_version *invm_ver);
drivers/net/ethernet/intel/igb/e1000_phy.c +0 -71

77 lines not on this page · raw message

drivers/net/ethernet/intel/igb/e1000_phy.h +0 -1
@@ -70,7 +70,6 @@ s32  igb_write_phy_reg_mdic(struct e1000
 s32  igb_read_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 *data);
 s32  igb_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data);
 s32  igb_read_sfp_data_byte(struct e1000_hw *hw, u16 offset, u8 *data);
-s32  e1000_write_sfp_data_byte(struct e1000_hw *hw, u16 offset, u8 data);
 s32  igb_copper_link_setup_82580(struct e1000_hw *hw);
 s32  igb_get_phy_info_82580(struct e1000_hw *hw);
 s32  igb_phy_force_speed_duplex_82580(struct e1000_hw *hw);
drivers/net/ethernet/intel/igb/igb.h +0 -2
@@ -522,9 +522,7 @@ void igb_set_fw_version(struct igb_adapt
 void igb_ptp_init(struct igb_adapter *adapter);
 void igb_ptp_stop(struct igb_adapter *adapter);
 void igb_ptp_reset(struct igb_adapter *adapter);
-void igb_ptp_tx_work(struct work_struct *work);
 void igb_ptp_rx_hang(struct igb_adapter *adapter);
-void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter);
 void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb);
 void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, unsigned char *va,
 			 struct sk_buff *skb);
drivers/net/ethernet/intel/igb/igb_ptp.c +4 -2
@@ -75,6 +75,8 @@
 #define INCVALUE_82576			(16 << IGB_82576_TSYNC_SHIFT)
 #define IGB_NBITS_82580			40
 
+static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter);
+
 /* SYSTIM read access for the 82576 */
 static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc)
 {
@@ -372,7 +374,7 @@ static int igb_ptp_enable(struct ptp_clo
  * This work function polls the TSYNCTXCTL valid bit to determine when a
  * timestamp has been taken for the current stored skb.
  **/
-void igb_ptp_tx_work(struct work_struct *work)
+static void igb_ptp_tx_work(struct work_struct *work)
 {
 	struct igb_adapter *adapter = container_of(work, struct igb_adapter,
 						   ptp_tx_work);
@@ -466,7 +468,7 @@ void igb_ptp_rx_hang(struct igb_adapter
  * available, then it must have been for this skb here because we only
  * allow only one such packet into the queue.
  **/
-void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter)
+static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter)
 {
 	struct e1000_hw *hw = &adapter->hw;
 	struct skb_shared_hwtstamps shhwtstamps;
#1 lore raw
Quoted 5 lines · Stephen Hemminger

Make local functions static, and remove unused
e1000_write_sfp_data_byte.

Quoted 10 lines
---
 drivers/net/ethernet/intel/igb/e1000_82575.c |    6 +++---
 drivers/net/ethernet/intel/igb/e1000_i210.c  |   18
+++++++++---------
 drivers/net/ethernet/intel/igb/e1000_i210.h  |    9 ---------
 drivers/net/ethernet/intel/igb/e1000_phy.c   |    2 +-
 drivers/net/ethernet/intel/igb/e1000_phy.h   |    1 -
 drivers/net/ethernet/intel/igb/igb.h         |    2 --
 drivers/net/ethernet/intel/igb/igb_ptp.c     |    6 ++++--
 7 files changed, 17 insertions(+), 27 deletions(-)

Thanks Stephen I have added this to my queue.

#2 lore raw
In reply to Stephen Hemminger
Quoted 5 lines · Stephen Hemminger

Make local functions static, and remove unused
e1000_write_sfp_data_byte.

Quoted 10 lines
---
 drivers/net/ethernet/intel/igb/e1000_82575.c |    6 +++---
 drivers/net/ethernet/intel/igb/e1000_i210.c  |   18
+++++++++---------
 drivers/net/ethernet/intel/igb/e1000_i210.h  |    9 ---------
 drivers/net/ethernet/intel/igb/e1000_phy.c   |    2 +-
 drivers/net/ethernet/intel/igb/e1000_phy.h   |    1 -
 drivers/net/ethernet/intel/igb/igb.h         |    2 --
 drivers/net/ethernet/intel/igb/igb_ptp.c     |    6 ++++--
 7 files changed, 17 insertions(+), 27 deletions(-)

Did you compile test this patch? I am guessing no because we got the following compile errors:
drivers/net/ethernet/intel/igb/e1000_82575.c:2723: error: static
declaration of
âigb_get_thermal_sensor_data_genericâ follows non-static declaration drivers/net/ethernet/intel/igb/e1000_82575.h:270: note: previous
declaration
of âigb_get_thermal_sensor_data_genericâ was here drivers/net/ethernet/intel/igb/e1000_82575.c:2777: error: static
declaration of
âigb_init_thermal_sensor_thresh_genericâ follows non-static declaration drivers/net/ethernet/intel/igb/e1000_82575.h:269: note: previous
declaration
of âigb_init_thermal_sensor_thresh_genericâ was here make[5]: *** [drivers/net/ethernet/intel/igb/e1000_82575.o] Error 1 make[5]: *** Waiting for unfinished jobs....
make[4]: *** [drivers/net/ethernet/intel/igb] Error 2 make[4]: *** Waiting for unfinished jobs....
make[3]: *** [drivers/net/ethernet/intel] Error 2
make[2]: *** [drivers/net/ethernet] Error 2
make[1]: *** [drivers/net] Error 2
make: *** [drivers] Error 2

I will work on a v2 to fix up these compiling issues.

#3 lore raw
Quoted 45 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jeff Kirsher
Sent: Monday, December 16, 2013 4:52 PM
To: Stephen Hemminger
Cc: [email protected]; [email protected]
Subject: Re: [PATCH net-next] igb: make local functions static and remove dead code

Quoted 5 lines · Stephen Hemminger

Make local functions static, and remove unused
e1000_write_sfp_data_byte.

Quoted 10 lines
---
 drivers/net/ethernet/intel/igb/e1000_82575.c |    6 +++---
 drivers/net/ethernet/intel/igb/e1000_i210.c  |   18
+++++++++---------
 drivers/net/ethernet/intel/igb/e1000_i210.h  |    9 ---------
 drivers/net/ethernet/intel/igb/e1000_phy.c   |    2 +-
 drivers/net/ethernet/intel/igb/e1000_phy.h   |    1 -
 drivers/net/ethernet/intel/igb/igb.h         |    2 --
 drivers/net/ethernet/intel/igb/igb_ptp.c     |    6 ++++--
 7 files changed, 17 insertions(+), 27 deletions(-)

Did you compile test this patch? I am guessing no because we got the following compile errors:
drivers/net/ethernet/intel/igb/e1000_82575.c:2723: error: static declaration of
âigb_get_thermal_sensor_data_genericâ follows non-static declaration
drivers/net/ethernet/intel/igb/e1000_82575.h:270: note: previous declaration
of âigb_get_thermal_sensor_data_genericâ was here
drivers/net/ethernet/intel/igb/e1000_82575.c:2777: error: static declaration of
âigb_init_thermal_sensor_thresh_genericâ follows non-static declaration
drivers/net/ethernet/intel/igb/e1000_82575.h:269: note: previous declaration
of âigb_init_thermal_sensor_thresh_genericâ was here
make[5]: *** [drivers/net/ethernet/intel/igb/e1000_82575.o] Error 1 make[5]: *** Waiting for unfinished jobs....
make[4]: *** [drivers/net/ethernet/intel/igb] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [drivers/net/ethernet/intel] Error 2
make[2]: *** [drivers/net/ethernet] Error 2
make[1]: *** [drivers/net] Error 2
make: *** [drivers] Error 2

Quoted 1 line

I will work on a v2 to fix up these compiling issues.

Please note that removing the igb_get_eee_status_i354 function is the incorrect fix. There is another bug that is the missing code that uses this function. I'm working on it.

Thanks,

Carolyn