[PATCH] crypto: hisilicon/zip - Modify some data type and code cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Yang Shen <shenyang39@xxxxxxxxxx>

Improve some inappropriate variable types to make variable expression more
accurate.

Signed-off-by: Yang Shen <shenyang39@xxxxxxxxxx>
Signed-off-by: Chenghai Huang <huangchenghai2@xxxxxxxxxx>
---
 drivers/crypto/hisilicon/zip/zip_main.c | 29 +++++++++++--------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/drivers/crypto/hisilicon/zip/zip_main.c b/drivers/crypto/hisilicon/zip/zip_main.c
index 479ba8a1d6b5..b3e2b58ba7d7 100644
--- a/drivers/crypto/hisilicon/zip/zip_main.c
+++ b/drivers/crypto/hisilicon/zip/zip_main.c
@@ -809,21 +809,20 @@ DEFINE_SHOW_ATTRIBUTE(hisi_zip_regs);
 
 static int hisi_zip_core_debug_init(struct hisi_qm *qm)
 {
-	u32 zip_core_num, zip_comp_core_num;
+	u32 zip_core_num, zip_comp_core_num, i;
 	struct device *dev = &qm->pdev->dev;
 	struct debugfs_regset32 *regset;
 	struct dentry *tmp_d;
 	char buf[HZIP_BUF_SIZE];
-	int i;
 
 	zip_core_num = qm->cap_tables.dev_cap_table[ZIP_CORE_NUM_CAP_IDX].cap_val;
 	zip_comp_core_num = qm->cap_tables.dev_cap_table[ZIP_CLUSTER_COMP_NUM_CAP_IDX].cap_val;
 
 	for (i = 0; i < zip_core_num; i++) {
 		if (i < zip_comp_core_num)
-			scnprintf(buf, sizeof(buf), "comp_core%d", i);
+			scnprintf(buf, sizeof(buf), "comp_core%u", i);
 		else
-			scnprintf(buf, sizeof(buf), "decomp_core%d",
+			scnprintf(buf, sizeof(buf), "decomp_core%u",
 				  i - zip_comp_core_num);
 
 		regset = devm_kzalloc(dev, sizeof(*regset), GFP_KERNEL);
@@ -850,7 +849,7 @@ static void hisi_zip_dfx_debug_init(struct hisi_qm *qm)
 	struct hisi_zip_dfx *dfx = &zip->dfx;
 	struct dentry *tmp_dir;
 	void *data;
-	int i;
+	size_t i;
 
 	tmp_dir = debugfs_create_dir("zip_dfx", qm->debug.debug_root);
 	for (i = 0; i < ARRAY_SIZE(zip_dfx_files); i++) {
@@ -923,7 +922,7 @@ static int hisi_zip_debugfs_init(struct hisi_qm *qm)
 /* hisi_zip_debug_regs_clear() - clear the zip debug regs */
 static void hisi_zip_debug_regs_clear(struct hisi_qm *qm)
 {
-	int i, j;
+	size_t i, j;
 
 	/* enable register read_clear bit */
 	writel(HZIP_RD_CNT_CLR_CE_EN, qm->io_base + HZIP_SOFT_CTRL_CNT_CLR_CE);
@@ -952,12 +951,11 @@ static void hisi_zip_debugfs_exit(struct hisi_qm *qm)
 
 static int hisi_zip_show_last_regs_init(struct hisi_qm *qm)
 {
-	int core_dfx_regs_num =  ARRAY_SIZE(hzip_dump_dfx_regs);
-	int com_dfx_regs_num = ARRAY_SIZE(hzip_com_dfx_regs);
+	u32 core_dfx_regs_num =  ARRAY_SIZE(hzip_dump_dfx_regs);
+	u32 com_dfx_regs_num = ARRAY_SIZE(hzip_com_dfx_regs);
 	struct qm_debug *debug = &qm->debug;
+	u32 zip_core_num, i, j, idx;
 	void __iomem *io_base;
-	u32 zip_core_num;
-	int i, j, idx;
 
 	zip_core_num = qm->cap_tables.dev_cap_table[ZIP_CORE_NUM_CAP_IDX].cap_val;
 
@@ -996,14 +994,13 @@ static void hisi_zip_show_last_regs_uninit(struct hisi_qm *qm)
 
 static void hisi_zip_show_last_dfx_regs(struct hisi_qm *qm)
 {
-	int core_dfx_regs_num =  ARRAY_SIZE(hzip_dump_dfx_regs);
-	int com_dfx_regs_num = ARRAY_SIZE(hzip_com_dfx_regs);
+	u32 core_dfx_regs_num =  ARRAY_SIZE(hzip_dump_dfx_regs);
+	u32 com_dfx_regs_num = ARRAY_SIZE(hzip_com_dfx_regs);
 	u32 zip_core_num, zip_comp_core_num;
 	struct qm_debug *debug = &qm->debug;
 	char buf[HZIP_BUF_SIZE];
 	void __iomem *base;
-	int i, j, idx;
-	u32 val;
+	u32 i, j, idx, val;
 
 	if (qm->fun_type == QM_HW_VF || !debug->last_words)
 		return;
@@ -1020,9 +1017,9 @@ static void hisi_zip_show_last_dfx_regs(struct hisi_qm *qm)
 
 	for (i = 0; i < zip_core_num; i++) {
 		if (i < zip_comp_core_num)
-			scnprintf(buf, sizeof(buf), "Comp_core-%d", i);
+			scnprintf(buf, sizeof(buf), "Comp_core-%u", i);
 		else
-			scnprintf(buf, sizeof(buf), "Decomp_core-%d",
+			scnprintf(buf, sizeof(buf), "Decomp_core-%u",
 				  i - zip_comp_core_num);
 		base = qm->io_base + core_offsets[i];
 
-- 
2.30.0





[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux