diff mbox series

[iwl-next,v2,2/6] ice: refactor ice_ddp to make functions static

Message ID 20230801115309.697331-3-jan.sokolowski@intel.com
State Changes Requested
Headers show
Series ice: staticization refactor | expand

Commit Message

Jan Sokolowski Aug. 1, 2023, 11:53 a.m. UTC
Refactor ice_ddp.c/h in order to make as many methods
as possible static.

Signed-off-by: Jan Sokolowski <jan.sokolowski@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_ddp.c | 117 ++++++++++++-----------
 drivers/net/ethernet/intel/ice/ice_ddp.h |  10 --
 2 files changed, 59 insertions(+), 68 deletions(-)

Comments

kernel test robot Aug. 1, 2023, 2:05 p.m. UTC | #1
Hi Jan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tnguy-next-queue/dev-queue]

url:    https://github.com/intel-lab-lkp/linux/commits/Jan-Sokolowski/ice-remove-unused-methods/20230801-195105
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git dev-queue
patch link:    https://lore.kernel.org/r/20230801115309.697331-3-jan.sokolowski%40intel.com
patch subject: [Intel-wired-lan] [PATCH iwl-next v2 2/6] ice: refactor ice_ddp to make functions static
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20230801/202308012117.GWpl2IGh-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230801/202308012117.GWpl2IGh-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308012117.GWpl2IGh-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/intel/ice/ice_ddp.c:1474:29: warning: no previous prototype for 'ice_find_seg_in_pkg' [-Wmissing-prototypes]
    1474 | struct ice_generic_seg_hdr *ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
         |                             ^~~~~~~~~~~~~~~~~~~


vim +/ice_find_seg_in_pkg +1474 drivers/net/ethernet/intel/ice/ice_ddp.c

2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1463  
b1e9d9a5d80ff6 Jan Sokolowski     2023-08-01  1464  /*
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1465   * ice_find_seg_in_pkg
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1466   * @hw: pointer to the hardware structure
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1467   * @seg_type: the segment type to search for (i.e., SEGMENT_TYPE_CPK)
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1468   * @pkg_hdr: pointer to the package header to be searched
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1469   *
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1470   * This function searches a package file for a particular segment type. On
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1471   * success it returns a pointer to the segment header, otherwise it will
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1472   * return NULL.
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1473   */
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20 @1474  struct ice_generic_seg_hdr *ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1475  						struct ice_pkg_hdr *pkg_hdr)
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1476  {
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1477  	u32 i;
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1478  
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1479  	ice_debug(hw, ICE_DBG_PKG, "Package format version: %d.%d.%d.%d\n",
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1480  		  pkg_hdr->pkg_format_ver.major, pkg_hdr->pkg_format_ver.minor,
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1481  		  pkg_hdr->pkg_format_ver.update,
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1482  		  pkg_hdr->pkg_format_ver.draft);
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1483  
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1484  	/* Search all package segments for the requested segment type */
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1485  	for (i = 0; i < le32_to_cpu(pkg_hdr->seg_count); i++) {
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1486  		struct ice_generic_seg_hdr *seg;
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1487  
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1488  		seg = (struct ice_generic_seg_hdr
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1489  			       *)((u8 *)pkg_hdr +
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1490  				  le32_to_cpu(pkg_hdr->seg_offset[i]));
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1491  
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1492  		if (le32_to_cpu(seg->seg_type) == seg_type)
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1493  			return seg;
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1494  	}
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1495  
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1496  	return NULL;
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1497  }
2ffd87d38d6b9d Sergey Temerkhanov 2022-12-20  1498
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_ddp.c b/drivers/net/ethernet/intel/ice/ice_ddp.c
index d71ed210f9c4..c43ac8c87a1d 100644
--- a/drivers/net/ethernet/intel/ice/ice_ddp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ddp.c
@@ -30,7 +30,7 @@  static const struct ice_tunnel_type_scan tnls[] = {
  * Verifies various attributes of the package file, including length, format
  * version, and the requirement of at least one segment.
  */
-enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)
+static enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len)
 {
 	u32 seg_count;
 	u32 i;
@@ -118,7 +118,7 @@  static enum ice_ddp_state ice_chk_pkg_version(struct ice_pkg_ver *pkg_ver)
  *
  * This helper function validates a buffer's header.
  */
-struct ice_buf_hdr *ice_pkg_val_buf(struct ice_buf *buf)
+static struct ice_buf_hdr *ice_pkg_val_buf(struct ice_buf *buf)
 {
 	struct ice_buf_hdr *hdr;
 	u16 section_count;
@@ -1152,6 +1152,54 @@  static void ice_release_global_cfg_lock(struct ice_hw *hw)
 	ice_release_res(hw, ICE_GLOBAL_CFG_LOCK_RES_ID);
 }
 
+/**
+ * ice_aq_download_pkg
+ * @hw: pointer to the hardware structure
+ * @pkg_buf: the package buffer to transfer
+ * @buf_size: the size of the package buffer
+ * @last_buf: last buffer indicator
+ * @error_offset: returns error offset
+ * @error_info: returns error information
+ * @cd: pointer to command details structure or NULL
+ *
+ * Download Package (0x0C40)
+ */
+static int
+ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
+		    u16 buf_size, bool last_buf, u32 *error_offset,
+		    u32 *error_info, struct ice_sq_cd *cd)
+{
+	struct ice_aqc_download_pkg *cmd;
+	struct ice_aq_desc desc;
+	int status;
+
+	if (error_offset)
+		*error_offset = 0;
+	if (error_info)
+		*error_info = 0;
+
+	cmd = &desc.params.download_pkg;
+	ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_download_pkg);
+	desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
+
+	if (last_buf)
+		cmd->flags |= ICE_AQC_DOWNLOAD_PKG_LAST_BUF;
+
+	status = ice_aq_send_cmd(hw, &desc, pkg_buf, buf_size, cd);
+	if (status == -EIO) {
+		/* Read error from buffer only when the FW returned an error */
+		struct ice_aqc_download_pkg_resp *resp;
+
+		resp = (struct ice_aqc_download_pkg_resp *)pkg_buf;
+		if (error_offset)
+			*error_offset = le32_to_cpu(resp->error_offset);
+		if (error_info)
+			*error_info = le32_to_cpu(resp->error_info);
+	}
+
+	return status;
+}
+
 /**
  * ice_dwnld_cfg_bufs
  * @hw: pointer to the hardware structure
@@ -1294,20 +1342,20 @@  static enum ice_ddp_state ice_download_pkg(struct ice_hw *hw,
 }
 
 /**
- * ice_aq_download_pkg
+ * ice_aq_update_pkg
  * @hw: pointer to the hardware structure
- * @pkg_buf: the package buffer to transfer
- * @buf_size: the size of the package buffer
+ * @pkg_buf: the package cmd buffer
+ * @buf_size: the size of the package cmd buffer
  * @last_buf: last buffer indicator
  * @error_offset: returns error offset
  * @error_info: returns error information
  * @cd: pointer to command details structure or NULL
  *
- * Download Package (0x0C40)
+ * Update Package (0x0C42)
  */
-int ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
-			u16 buf_size, bool last_buf, u32 *error_offset,
-			u32 *error_info, struct ice_sq_cd *cd)
+static int ice_aq_update_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
+			     u16 buf_size, bool last_buf, u32 *error_offset,
+			     u32 *error_info, struct ice_sq_cd *cd)
 {
 	struct ice_aqc_download_pkg *cmd;
 	struct ice_aq_desc desc;
@@ -1319,7 +1367,7 @@  int ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
 		*error_info = 0;
 
 	cmd = &desc.params.download_pkg;
-	ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_download_pkg);
+	ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_update_pkg);
 	desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
 
 	if (last_buf)
@@ -1360,53 +1408,6 @@  int ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
 	return ice_aq_send_cmd(hw, &desc, pkg_buf, buf_size, cd);
 }
 
-/**
- * ice_aq_update_pkg
- * @hw: pointer to the hardware structure
- * @pkg_buf: the package cmd buffer
- * @buf_size: the size of the package cmd buffer
- * @last_buf: last buffer indicator
- * @error_offset: returns error offset
- * @error_info: returns error information
- * @cd: pointer to command details structure or NULL
- *
- * Update Package (0x0C42)
- */
-static int ice_aq_update_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
-			     u16 buf_size, bool last_buf, u32 *error_offset,
-			     u32 *error_info, struct ice_sq_cd *cd)
-{
-	struct ice_aqc_download_pkg *cmd;
-	struct ice_aq_desc desc;
-	int status;
-
-	if (error_offset)
-		*error_offset = 0;
-	if (error_info)
-		*error_info = 0;
-
-	cmd = &desc.params.download_pkg;
-	ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_update_pkg);
-	desc.flags |= cpu_to_le16(ICE_AQ_FLAG_RD);
-
-	if (last_buf)
-		cmd->flags |= ICE_AQC_DOWNLOAD_PKG_LAST_BUF;
-
-	status = ice_aq_send_cmd(hw, &desc, pkg_buf, buf_size, cd);
-	if (status == -EIO) {
-		/* Read error from buffer only when the FW returned an error */
-		struct ice_aqc_download_pkg_resp *resp;
-
-		resp = (struct ice_aqc_download_pkg_resp *)pkg_buf;
-		if (error_offset)
-			*error_offset = le32_to_cpu(resp->error_offset);
-		if (error_info)
-			*error_info = le32_to_cpu(resp->error_info);
-	}
-
-	return status;
-}
-
 /**
  * ice_update_pkg_no_lock
  * @hw: pointer to the hardware structure
@@ -1460,7 +1461,7 @@  int ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count)
 	return status;
 }
 
-/**
+/*
  * ice_find_seg_in_pkg
  * @hw: pointer to the hardware structure
  * @seg_type: the segment type to search for (i.e., SEGMENT_TYPE_CPK)
diff --git a/drivers/net/ethernet/intel/ice/ice_ddp.h b/drivers/net/ethernet/intel/ice/ice_ddp.h
index 41acfe26df1c..abb5f32f2ef4 100644
--- a/drivers/net/ethernet/intel/ice/ice_ddp.h
+++ b/drivers/net/ethernet/intel/ice/ice_ddp.h
@@ -416,21 +416,13 @@  struct ice_pkg_enum {
 	void *(*handler)(u32 sect_type, void *section, u32 index, u32 *offset);
 };
 
-int ice_aq_download_pkg(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
-			u16 buf_size, bool last_buf, u32 *error_offset,
-			u32 *error_info, struct ice_sq_cd *cd);
 int ice_aq_upload_section(struct ice_hw *hw, struct ice_buf_hdr *pkg_buf,
 			  u16 buf_size, struct ice_sq_cd *cd);
 
 void *ice_pkg_buf_alloc_section(struct ice_buf_build *bld, u32 type, u16 size);
 
-enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len);
-
 struct ice_buf_build *ice_pkg_buf_alloc(struct ice_hw *hw);
 
-struct ice_generic_seg_hdr *ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type,
-						struct ice_pkg_hdr *pkg_hdr);
-
 int ice_update_pkg_no_lock(struct ice_hw *hw, struct ice_buf *bufs, u32 count);
 int ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count);
 
@@ -439,6 +431,4 @@  u16 ice_pkg_buf_get_active_sections(struct ice_buf_build *bld);
 void *ice_pkg_enum_section(struct ice_seg *ice_seg, struct ice_pkg_enum *state,
 			   u32 sect_type);
 
-struct ice_buf_hdr *ice_pkg_val_buf(struct ice_buf *buf);
-
 #endif