i40e/base: minor clean up
authorJingjing Wu <jingjing.wu@intel.com>
Sun, 6 Sep 2015 07:11:45 +0000 (15:11 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 1 Oct 2015 23:35:22 +0000 (01:35 +0200)
Use INLINE macro for better cross-platform code management.

Clean up some unnecessary logic jumping and drop a variable.

There was one more __FUNCTION__ reference that wasn't needed.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Huilong Xu <huilongx.xu@intel.com>
drivers/net/i40e/base/i40e_adminq.c
drivers/net/i40e/base/i40e_adminq.h
drivers/net/i40e/base/i40e_hmc.c
drivers/net/i40e/base/i40e_lan_hmc.c
drivers/net/i40e/base/i40e_nvm.c
drivers/net/i40e/base/i40e_type.h

index 4ffb788..998582c 100644 (file)
@@ -747,16 +747,16 @@ u16 i40e_clean_asq(struct i40e_hw *hw)
 
        desc = I40E_ADMINQ_DESC(*asq, ntc);
        details = I40E_ADMINQ_DETAILS(*asq, ntc);
+
        while (rd32(hw, hw->aq.asq.head) != ntc) {
                i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
-                          "%s: ntc %d head %d.\n", __FUNCTION__, ntc,
-                          rd32(hw, hw->aq.asq.head));
+                          "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head));
 
                if (details->callback) {
                        I40E_ADMINQ_CALLBACK cb_func =
                                        (I40E_ADMINQ_CALLBACK)details->callback;
-                       i40e_memcpy(&desc_cb, desc,
-                                   sizeof(struct i40e_aq_desc), I40E_DMA_TO_DMA);
+                       i40e_memcpy(&desc_cb, desc, sizeof(struct i40e_aq_desc),
+                                   I40E_DMA_TO_DMA);
                        cb_func(hw, &desc_cb);
                }
                i40e_memset(desc, 0, sizeof(*desc), I40E_DMA_MEM);
index 434c754..1ac054e 100644 (file)
@@ -119,7 +119,7 @@ struct i40e_adminq_info {
  * aq_ret: AdminQ handler error code can override aq_rc
  * aq_rc: AdminQ firmware error code to convert
  **/
-STATIC inline int i40e_aq_rc_to_posix(int aq_ret, int aq_rc)
+STATIC INLINE int i40e_aq_rc_to_posix(int aq_ret, int aq_rc)
 {
        int aq_to_posix[] = {
                0,           /* I40E_AQ_RC_OK */
index 6ddf8b3..3b29251 100644 (file)
@@ -300,21 +300,15 @@ enum i40e_status_code i40e_remove_sd_bp_new(struct i40e_hw *hw,
                                            u32 idx, bool is_pf)
 {
        struct i40e_hmc_sd_entry *sd_entry;
-       enum i40e_status_code ret_code = I40E_SUCCESS;
+
+       if (!is_pf)
+               return I40E_NOT_SUPPORTED;
 
        /* get the entry and decrease its ref counter */
        sd_entry = &hmc_info->sd_table.sd_entry[idx];
-       if (is_pf) {
-               I40E_CLEAR_PF_SD_ENTRY(hw, idx, I40E_SD_TYPE_DIRECT);
-       } else {
-               ret_code = I40E_NOT_SUPPORTED;
-               goto exit;
-       }
-       ret_code = i40e_free_dma_mem(hw, &(sd_entry->u.bp.addr));
-       if (I40E_SUCCESS != ret_code)
-               goto exit;
-exit:
-       return ret_code;
+       I40E_CLEAR_PF_SD_ENTRY(hw, idx, I40E_SD_TYPE_DIRECT);
+
+       return i40e_free_dma_mem(hw, &(sd_entry->u.bp.addr));
 }
 
 /**
@@ -354,20 +348,13 @@ enum i40e_status_code i40e_remove_pd_page_new(struct i40e_hw *hw,
                                              struct i40e_hmc_info *hmc_info,
                                              u32 idx, bool is_pf)
 {
-       enum i40e_status_code ret_code = I40E_SUCCESS;
        struct i40e_hmc_sd_entry *sd_entry;
 
+       if (!is_pf)
+               return I40E_NOT_SUPPORTED;
+
        sd_entry = &hmc_info->sd_table.sd_entry[idx];
-       if (is_pf) {
-               I40E_CLEAR_PF_SD_ENTRY(hw, idx, I40E_SD_TYPE_PAGED);
-       } else {
-               ret_code = I40E_NOT_SUPPORTED;
-               goto exit;
-       }
-       /* free memory here */
-       ret_code = i40e_free_dma_mem(hw, &(sd_entry->u.pd_table.pd_page_addr));
-       if (I40E_SUCCESS != ret_code)
-               goto exit;
-exit:
-       return ret_code;
+       I40E_CLEAR_PF_SD_ENTRY(hw, idx, I40E_SD_TYPE_PAGED);
+
+       return i40e_free_dma_mem(hw, &(sd_entry->u.pd_table.pd_page_addr));
 }
index 1533a62..3c717d2 100644 (file)
@@ -438,9 +438,8 @@ exit_sd_error:
                        pd_idx1 = max(pd_idx,
                                      ((j - 1) * I40E_HMC_MAX_BP_COUNT));
                        pd_lmt1 = min(pd_lmt, (j * I40E_HMC_MAX_BP_COUNT));
-                       for (i = pd_idx1; i < pd_lmt1; i++) {
+                       for (i = pd_idx1; i < pd_lmt1; i++)
                                i40e_remove_pd_bp(hw, info->hmc_info, i);
-                       }
                        i40e_remove_pd_page(hw, info->hmc_info, (j - 1));
                        break;
                case I40E_SD_TYPE_DIRECT:
index 10c2d77..4b5b852 100644 (file)
@@ -729,11 +729,11 @@ STATIC enum i40e_status_code i40e_nvmupd_exec_aq(struct i40e_hw *hw,
 STATIC enum i40e_status_code i40e_nvmupd_get_aq_result(struct i40e_hw *hw,
                                                    struct i40e_nvm_access *cmd,
                                                    u8 *bytes, int *perrno);
-STATIC inline u8 i40e_nvmupd_get_module(u32 val)
+STATIC INLINE u8 i40e_nvmupd_get_module(u32 val)
 {
        return (u8)(val & I40E_NVM_MOD_PNT_MASK);
 }
-STATIC inline u8 i40e_nvmupd_get_transaction(u32 val)
+STATIC INLINE u8 i40e_nvmupd_get_transaction(u32 val)
 {
        return (u8)((val & I40E_NVM_TRANS_MASK) >> I40E_NVM_TRANS_SHIFT);
 }
index 5dfae62..c95ea49 100644 (file)
@@ -638,7 +638,7 @@ struct i40e_hw {
 #endif /* I40E_NDIS_SUPPORT */
 };
 
-static inline bool i40e_is_vf(struct i40e_hw *hw)
+STATIC INLINE bool i40e_is_vf(struct i40e_hw *hw)
 {
        return hw->mac.type == I40E_MAC_VF;
 }