Commit 2ca73193 authored by Yang Shen's avatar Yang Shen Committed by Herbert Xu

crypto: hisilicon/zip - fix some coding styles

1.Unified alignment styles
2.Remove unnecessary goto branch
3.Remove address printf
Signed-off-by: default avatarYang Shen <shenyang39@huawei.com>
Reviewed-by: default avatarZhou Wang <wangzhou1@hisilicon.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 2a928693
...@@ -38,8 +38,10 @@ ...@@ -38,8 +38,10 @@
#define HZIP_SGL_SGE_NR 10 #define HZIP_SGL_SGE_NR 10
static const u8 zlib_head[HZIP_ZLIB_HEAD_SIZE] = {0x78, 0x9c}; static const u8 zlib_head[HZIP_ZLIB_HEAD_SIZE] = {0x78, 0x9c};
static const u8 gzip_head[HZIP_GZIP_HEAD_SIZE] = {0x1f, 0x8b, 0x08, 0x0, 0x0, static const u8 gzip_head[HZIP_GZIP_HEAD_SIZE] = {
0x0, 0x0, 0x0, 0x0, 0x03}; 0x1f, 0x8b, 0x08, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x03
};
enum hisi_zip_alg_type { enum hisi_zip_alg_type {
HZIP_ALG_TYPE_COMP = 0, HZIP_ALG_TYPE_COMP = 0,
HZIP_ALG_TYPE_DECOMP = 1, HZIP_ALG_TYPE_DECOMP = 1,
...@@ -359,7 +361,6 @@ static void hisi_zip_acomp_cb(struct hisi_qp *qp, void *data) ...@@ -359,7 +361,6 @@ static void hisi_zip_acomp_cb(struct hisi_qp *qp, void *data)
atomic64_inc(&dfx->recv_cnt); atomic64_inc(&dfx->recv_cnt);
status = sqe->dw3 & HZIP_BD_STATUS_M; status = sqe->dw3 & HZIP_BD_STATUS_M;
if (status != 0 && status != HZIP_NC_ERR) { if (status != 0 && status != HZIP_NC_ERR) {
dev_err(dev, "%scompress fail in qp%u: %u, output: %u\n", dev_err(dev, "%scompress fail in qp%u: %u, output: %u\n",
(qp->alg_type == 0) ? "" : "de", qp->qp_id, status, (qp->alg_type == 0) ? "" : "de", qp->qp_id, status,
...@@ -520,8 +521,7 @@ static int hisi_zip_do_work(struct hisi_zip_req *req, ...@@ -520,8 +521,7 @@ static int hisi_zip_do_work(struct hisi_zip_req *req,
struct hisi_acc_sgl_pool *pool = qp_ctx->sgl_pool; struct hisi_acc_sgl_pool *pool = qp_ctx->sgl_pool;
struct hisi_zip_dfx *dfx = &qp_ctx->zip_dev->dfx; struct hisi_zip_dfx *dfx = &qp_ctx->zip_dev->dfx;
struct hisi_zip_sqe zip_sqe; struct hisi_zip_sqe zip_sqe;
dma_addr_t input; dma_addr_t input, output;
dma_addr_t output;
int ret; int ret;
if (!a_req->src || !a_req->slen || !a_req->dst || !a_req->dlen) if (!a_req->src || !a_req->slen || !a_req->dst || !a_req->dlen)
...@@ -540,9 +540,9 @@ static int hisi_zip_do_work(struct hisi_zip_req *req, ...@@ -540,9 +540,9 @@ static int hisi_zip_do_work(struct hisi_zip_req *req,
(req->req_id << 1) + 1, (req->req_id << 1) + 1,
&output); &output);
if (IS_ERR(req->hw_dst)) { if (IS_ERR(req->hw_dst)) {
dev_err(dev, "failed to map the dst buffer to hw slg (%ld)!\n",
PTR_ERR(req->hw_dst));
ret = PTR_ERR(req->hw_dst); ret = PTR_ERR(req->hw_dst);
dev_err(dev, "failed to map the dst buffer to hw slg (%d)!\n",
ret);
goto err_unmap_input; goto err_unmap_input;
} }
req->dma_dst = output; req->dma_dst = output;
......
...@@ -258,6 +258,7 @@ static int hisi_zip_set_user_domain_and_cache(struct hisi_qm *qm) ...@@ -258,6 +258,7 @@ static int hisi_zip_set_user_domain_and_cache(struct hisi_qm *qm)
/* qm cache */ /* qm cache */
writel(AXI_M_CFG, base + QM_AXI_M_CFG); writel(AXI_M_CFG, base + QM_AXI_M_CFG);
writel(AXI_M_CFG_ENABLE, base + QM_AXI_M_CFG_ENABLE); writel(AXI_M_CFG_ENABLE, base + QM_AXI_M_CFG_ENABLE);
/* disable FLR triggered by BME(bus master enable) */ /* disable FLR triggered by BME(bus master enable) */
writel(PEH_AXUSER_CFG, base + QM_PEH_AXUSER_CFG); writel(PEH_AXUSER_CFG, base + QM_PEH_AXUSER_CFG);
writel(PEH_AXUSER_CFG_ENABLE, base + QM_PEH_AXUSER_CFG_ENABLE); writel(PEH_AXUSER_CFG_ENABLE, base + QM_PEH_AXUSER_CFG_ENABLE);
...@@ -311,7 +312,7 @@ static void hisi_zip_hw_error_enable(struct hisi_qm *qm) ...@@ -311,7 +312,7 @@ static void hisi_zip_hw_error_enable(struct hisi_qm *qm)
writel(0x1, qm->io_base + HZIP_CORE_INT_RAS_CE_ENB); writel(0x1, qm->io_base + HZIP_CORE_INT_RAS_CE_ENB);
writel(0x0, qm->io_base + HZIP_CORE_INT_RAS_FE_ENB); writel(0x0, qm->io_base + HZIP_CORE_INT_RAS_FE_ENB);
writel(HZIP_CORE_INT_RAS_NFE_ENABLE, writel(HZIP_CORE_INT_RAS_NFE_ENABLE,
qm->io_base + HZIP_CORE_INT_RAS_NFE_ENB); qm->io_base + HZIP_CORE_INT_RAS_NFE_ENB);
/* enable ZIP hw error interrupts */ /* enable ZIP hw error interrupts */
writel(0, qm->io_base + HZIP_CORE_INT_MASK_REG); writel(0, qm->io_base + HZIP_CORE_INT_MASK_REG);
...@@ -487,7 +488,6 @@ static const struct file_operations ctrl_debug_fops = { ...@@ -487,7 +488,6 @@ static const struct file_operations ctrl_debug_fops = {
.write = hisi_zip_ctrl_debug_write, .write = hisi_zip_ctrl_debug_write,
}; };
static int zip_debugfs_atomic64_set(void *data, u64 val) static int zip_debugfs_atomic64_set(void *data, u64 val)
{ {
if (val) if (val)
...@@ -632,7 +632,7 @@ static void hisi_zip_log_hw_error(struct hisi_qm *qm, u32 err_sts) ...@@ -632,7 +632,7 @@ static void hisi_zip_log_hw_error(struct hisi_qm *qm, u32 err_sts)
while (err->msg) { while (err->msg) {
if (err->int_msk & err_sts) { if (err->int_msk & err_sts) {
dev_err(dev, "%s [error status=0x%x] found\n", dev_err(dev, "%s [error status=0x%x] found\n",
err->msg, err->int_msk); err->msg, err->int_msk);
if (err->int_msk & HZIP_CORE_INT_STATUS_M_ECC) { if (err->int_msk & HZIP_CORE_INT_STATUS_M_ECC) {
err_val = readl(qm->io_base + err_val = readl(qm->io_base +
...@@ -640,9 +640,6 @@ static void hisi_zip_log_hw_error(struct hisi_qm *qm, u32 err_sts) ...@@ -640,9 +640,6 @@ static void hisi_zip_log_hw_error(struct hisi_qm *qm, u32 err_sts)
dev_err(dev, "hisi-zip multi ecc sram num=0x%x\n", dev_err(dev, "hisi-zip multi ecc sram num=0x%x\n",
((err_val >> ((err_val >>
HZIP_SRAM_ECC_ERR_NUM_SHIFT) & 0xFF)); HZIP_SRAM_ECC_ERR_NUM_SHIFT) & 0xFF));
dev_err(dev, "hisi-zip multi ecc sram addr=0x%x\n",
(err_val >>
HZIP_SRAM_ECC_ERR_ADDR_SHIFT));
} }
} }
err++; err++;
...@@ -902,15 +899,10 @@ static int __init hisi_zip_init(void) ...@@ -902,15 +899,10 @@ static int __init hisi_zip_init(void)
ret = pci_register_driver(&hisi_zip_pci_driver); ret = pci_register_driver(&hisi_zip_pci_driver);
if (ret < 0) { if (ret < 0) {
hisi_zip_unregister_debugfs();
pr_err("Failed to register pci driver.\n"); pr_err("Failed to register pci driver.\n");
goto err_pci;
} }
return 0;
err_pci:
hisi_zip_unregister_debugfs();
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment