if (crypto_authenc_extractkeys(&keys, key, keylen) != 0)
                goto badkey;
 
-#ifdef DEBUG
-       printk(KERN_ERR "keylen %d enckeylen %d authkeylen %d\n",
+       dev_dbg(jrdev, "keylen %d enckeylen %d authkeylen %d\n",
               keys.authkeylen + keys.enckeylen, keys.enckeylen,
               keys.authkeylen);
-       print_hex_dump(KERN_ERR, "key in @"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
-#endif
+       print_hex_dump_debug("key in @"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
 
        /*
         * If DKP is supported, use it in the shared descriptor to generate
        memcpy(ctx->key + ctx->adata.keylen_pad, keys.enckey, keys.enckeylen);
        dma_sync_single_for_device(jrdev, ctx->key_dma, ctx->adata.keylen_pad +
                                   keys.enckeylen, ctx->dir);
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "ctx.key@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, ctx->key,
-                      ctx->adata.keylen_pad + keys.enckeylen, 1);
-#endif
+
+       print_hex_dump_debug("ctx.key@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, ctx->key,
+                            ctx->adata.keylen_pad + keys.enckeylen, 1);
 
 skip_split_key:
        ctx->cdata.keylen = keys.enckeylen;
        struct caam_ctx *ctx = crypto_aead_ctx(aead);
        struct device *jrdev = ctx->jrdev;
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "key in @"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
-#endif
+       print_hex_dump_debug("key in @"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
 
        memcpy(ctx->key, key, keylen);
        dma_sync_single_for_device(jrdev, ctx->key_dma, keylen, ctx->dir);
        if (keylen < 4)
                return -EINVAL;
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "key in @"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
-#endif
+       print_hex_dump_debug("key in @"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
 
        memcpy(ctx->key, key, keylen);
 
        if (keylen < 4)
                return -EINVAL;
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "key in @"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
-#endif
+       print_hex_dump_debug("key in @"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
 
        memcpy(ctx->key, key, keylen);
 
                               OP_ALG_AAI_CTR_MOD128);
        const bool is_rfc3686 = alg->caam.rfc3686;
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "key in @"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
-#endif
+       print_hex_dump_debug("key in @"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
        /*
         * AES-CTR needs to load IV in CONTEXT1 reg
         * at an offset of 128bits (16bytes)
        struct aead_request *req = context;
        struct aead_edesc *edesc;
 
-#ifdef DEBUG
-       dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
-#endif
+       dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
 
        edesc = container_of(desc, struct aead_edesc, hw_desc[0]);
 
        struct aead_request *req = context;
        struct aead_edesc *edesc;
 
-#ifdef DEBUG
-       dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
-#endif
+       dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
 
        edesc = container_of(desc, struct aead_edesc, hw_desc[0]);
 
        struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req);
        int ivsize = crypto_skcipher_ivsize(skcipher);
 
-#ifdef DEBUG
-       dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
-#endif
+       dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
 
        edesc = container_of(desc, struct skcipher_edesc, hw_desc[0]);
 
                scatterwalk_map_and_copy(req->iv, req->dst, req->cryptlen -
                                         ivsize, ivsize, 0);
 
-#ifdef DEBUG
        if (ivsize)
-               print_hex_dump(KERN_ERR, "dstiv  @"__stringify(__LINE__)": ",
-                              DUMP_PREFIX_ADDRESS, 16, 4, req->iv,
-                              edesc->src_nents > 1 ? 100 : ivsize, 1);
-#endif
+               print_hex_dump_debug("dstiv  @"__stringify(__LINE__)": ",
+                                    DUMP_PREFIX_ADDRESS, 16, 4, req->iv,
+                                    edesc->src_nents > 1 ? 100 : ivsize, 1);
+
        caam_dump_sg(KERN_ERR, "dst    @" __stringify(__LINE__)": ",
                     DUMP_PREFIX_ADDRESS, 16, 4, req->dst,
                     edesc->dst_nents > 1 ? 100 : req->cryptlen, 1);
 {
        struct skcipher_request *req = context;
        struct skcipher_edesc *edesc;
-#ifdef DEBUG
        struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req);
        int ivsize = crypto_skcipher_ivsize(skcipher);
 
-       dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
-#endif
+       dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
 
        edesc = container_of(desc, struct skcipher_edesc, hw_desc[0]);
        if (err)
 
        skcipher_unmap(jrdev, edesc, req);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "dstiv  @"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, req->iv, ivsize, 1);
-#endif
+       print_hex_dump_debug("dstiv  @"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, req->iv, ivsize, 1);
        caam_dump_sg(KERN_ERR, "dst    @" __stringify(__LINE__)": ",
                     DUMP_PREFIX_ADDRESS, 16, 4, req->dst,
                     edesc->dst_nents > 1 ? 100 : req->cryptlen, 1);
 {
        struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req);
        struct caam_ctx *ctx = crypto_skcipher_ctx(skcipher);
+       struct device *jrdev = ctx->jrdev;
        int ivsize = crypto_skcipher_ivsize(skcipher);
        u32 *desc = edesc->hw_desc;
        u32 *sh_desc;
        dma_addr_t src_dma, dst_dma, ptr;
        int len, sec4_sg_index = 0;
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "presciv@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, req->iv, ivsize, 1);
-       pr_err("asked=%d, cryptlen%d\n",
+       print_hex_dump_debug("presciv@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, req->iv, ivsize, 1);
+       dev_dbg(jrdev, "asked=%d, cryptlen%d\n",
               (int)edesc->src_nents > 1 ? 100 : req->cryptlen, req->cryptlen);
-#endif
+
        caam_dump_sg(KERN_ERR, "src    @" __stringify(__LINE__)": ",
                     DUMP_PREFIX_ADDRESS, 16, 4, req->src,
                     edesc->src_nents > 1 ? 100 : req->cryptlen, 1);
 
        /* Create and submit job descriptor */
        init_gcm_job(req, edesc, all_contig, true);
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "aead jobdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, edesc->hw_desc,
-                      desc_bytes(edesc->hw_desc), 1);
-#endif
+
+       print_hex_dump_debug("aead jobdesc@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, edesc->hw_desc,
+                            desc_bytes(edesc->hw_desc), 1);
 
        desc = edesc->hw_desc;
        ret = caam_jr_enqueue(jrdev, desc, aead_encrypt_done, req);
 
        /* Create and submit job descriptor */
        init_authenc_job(req, edesc, all_contig, true);
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "aead jobdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, edesc->hw_desc,
-                      desc_bytes(edesc->hw_desc), 1);
-#endif
+
+       print_hex_dump_debug("aead jobdesc@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, edesc->hw_desc,
+                            desc_bytes(edesc->hw_desc), 1);
 
        desc = edesc->hw_desc;
        ret = caam_jr_enqueue(jrdev, desc, aead_encrypt_done, req);
 
        /* Create and submit job descriptor*/
        init_gcm_job(req, edesc, all_contig, false);
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "aead jobdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, edesc->hw_desc,
-                      desc_bytes(edesc->hw_desc), 1);
-#endif
+
+       print_hex_dump_debug("aead jobdesc@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, edesc->hw_desc,
+                            desc_bytes(edesc->hw_desc), 1);
 
        desc = edesc->hw_desc;
        ret = caam_jr_enqueue(jrdev, desc, aead_decrypt_done, req);
 
        /* Create and submit job descriptor*/
        init_authenc_job(req, edesc, all_contig, false);
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "aead jobdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, edesc->hw_desc,
-                      desc_bytes(edesc->hw_desc), 1);
-#endif
+
+       print_hex_dump_debug("aead jobdesc@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, edesc->hw_desc,
+                            desc_bytes(edesc->hw_desc), 1);
 
        desc = edesc->hw_desc;
        ret = caam_jr_enqueue(jrdev, desc, aead_decrypt_done, req);
 
        edesc->iv_dma = iv_dma;
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "skcipher sec4_sg@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, edesc->sec4_sg,
-                      sec4_sg_bytes, 1);
-#endif
+       print_hex_dump_debug("skcipher sec4_sg@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, edesc->sec4_sg,
+                            sec4_sg_bytes, 1);
 
        return edesc;
 }
 
        /* Create and submit job descriptor*/
        init_skcipher_job(req, edesc, true);
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "skcipher jobdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, edesc->hw_desc,
-                      desc_bytes(edesc->hw_desc), 1);
-#endif
+
+       print_hex_dump_debug("skcipher jobdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, edesc->hw_desc,
+                            desc_bytes(edesc->hw_desc), 1);
+
        desc = edesc->hw_desc;
        ret = caam_jr_enqueue(jrdev, desc, skcipher_encrypt_done, req);
 
        /* Create and submit job descriptor*/
        init_skcipher_job(req, edesc, false);
        desc = edesc->hw_desc;
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "skcipher jobdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, edesc->hw_desc,
-                      desc_bytes(edesc->hw_desc), 1);
-#endif
+
+       print_hex_dump_debug("skcipher jobdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, edesc->hw_desc,
+                            desc_bytes(edesc->hw_desc), 1);
 
        ret = caam_jr_enqueue(jrdev, desc, skcipher_decrypt_done, req);
        if (!ret) {
 
        append_seq_store(desc, icvsize, LDST_CLASS_2_CCB |
                         LDST_SRCDST_BYTE_CONTEXT);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR,
-                      "aead null enc shdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("aead null enc shdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_aead_null_encap);
 
        append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS2 |
                             FIFOLD_TYPE_LAST2 | FIFOLD_TYPE_ICV);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR,
-                      "aead null dec shdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("aead null dec shdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_aead_null_decap);
 
        append_seq_store(desc, icvsize, LDST_CLASS_2_CCB |
                         LDST_SRCDST_BYTE_CONTEXT);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "aead enc shdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("aead enc shdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_aead_encap);
 
        append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS2 |
                             FIFOLD_TYPE_LAST2 | FIFOLD_TYPE_ICV);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "aead dec shdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("aead dec shdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_aead_decap);
 
        append_seq_store(desc, icvsize, LDST_CLASS_2_CCB |
                         LDST_SRCDST_BYTE_CONTEXT);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR,
-                      "aead givenc shdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("aead givenc shdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_aead_givencap);
 
        append_seq_store(desc, icvsize, LDST_CLASS_1_CCB |
                         LDST_SRCDST_BYTE_CONTEXT);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "gcm enc shdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("gcm enc shdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_gcm_encap);
 
        append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS1 |
                             FIFOLD_TYPE_ICV | FIFOLD_TYPE_LAST1);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "gcm dec shdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("gcm dec shdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_gcm_decap);
 
        append_seq_store(desc, icvsize, LDST_CLASS_1_CCB |
                         LDST_SRCDST_BYTE_CONTEXT);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR,
-                      "rfc4106 enc shdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("rfc4106 enc shdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_rfc4106_encap);
 
        append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS1 |
                             FIFOLD_TYPE_ICV | FIFOLD_TYPE_LAST1);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR,
-                      "rfc4106 dec shdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("rfc4106 dec shdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_rfc4106_decap);
 
        append_seq_store(desc, icvsize, LDST_CLASS_1_CCB |
                         LDST_SRCDST_BYTE_CONTEXT);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR,
-                      "rfc4543 enc shdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("rfc4543 enc shdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_rfc4543_encap);
 
        append_seq_fifo_load(desc, icvsize, FIFOLD_CLASS_CLASS1 |
                             FIFOLD_TYPE_ICV | FIFOLD_TYPE_LAST1);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR,
-                      "rfc4543 dec shdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("rfc4543 dec shdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_rfc4543_decap);
 
        /* Perform operation */
        skcipher_append_src_dst(desc);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR,
-                      "skcipher enc shdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("skcipher enc shdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_skcipher_encap);
 
        /* Perform operation */
        skcipher_append_src_dst(desc);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR,
-                      "skcipher dec shdesc@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("skcipher dec shdesc@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_skcipher_decap);
 
        /* Perform operation */
        skcipher_append_src_dst(desc);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR,
-                      "xts skcipher enc shdesc@" __stringify(__LINE__) ": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("xts skcipher enc shdesc@" __stringify(__LINE__)
+                            ": ", DUMP_PREFIX_ADDRESS, 16, 4,
+                            desc, desc_bytes(desc), 1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_xts_skcipher_encap);
 
        /* Perform operation */
        skcipher_append_src_dst(desc);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR,
-                      "xts skcipher dec shdesc@" __stringify(__LINE__) ": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("xts skcipher dec shdesc@" __stringify(__LINE__)
+                            ": ", DUMP_PREFIX_ADDRESS, 16, 4, desc,
+                            desc_bytes(desc), 1);
 }
 EXPORT_SYMBOL(cnstr_shdsc_xts_skcipher_decap);
 
 
        if (crypto_authenc_extractkeys(&keys, key, keylen) != 0)
                goto badkey;
 
-#ifdef DEBUG
-       dev_err(jrdev, "keylen %d enckeylen %d authkeylen %d\n",
+       dev_dbg(jrdev, "keylen %d enckeylen %d authkeylen %d\n",
                keys.authkeylen + keys.enckeylen, keys.enckeylen,
                keys.authkeylen);
-       print_hex_dump(KERN_ERR, "key in @" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
-#endif
+       print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
 
        /*
         * If DKP is supported, use it in the shared descriptor to generate
        struct device *jrdev = ctx->jrdev;
        int ret;
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "key in @" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
-#endif
+       print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
 
        memcpy(ctx->key, key, keylen);
        dma_sync_single_for_device(jrdev->parent, ctx->key_dma, keylen,
        if (keylen < 4)
                return -EINVAL;
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "key in @" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
-#endif
+       print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
 
        memcpy(ctx->key, key, keylen);
        /*
        if (keylen < 4)
                return -EINVAL;
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "key in @" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
-#endif
+       print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
 
        memcpy(ctx->key, key, keylen);
        /*
        const bool is_rfc3686 = alg->caam.rfc3686;
        int ret = 0;
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "key in @" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
-#endif
+       print_hex_dump_debug("key in @" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
+
        /*
         * AES-CTR needs to load IV in CONTEXT1 reg
         * at an offset of 128bits (16bytes)
        struct device *qidev = caam_ctx->qidev;
        int ivsize = crypto_skcipher_ivsize(skcipher);
 
-#ifdef DEBUG
-       dev_err(qidev, "%s %d: status 0x%x\n", __func__, __LINE__, status);
-#endif
+       dev_dbg(qidev, "%s %d: status 0x%x\n", __func__, __LINE__, status);
 
        edesc = container_of(drv_req, typeof(*edesc), drv_req);
 
        if (status)
                caam_jr_strstatus(qidev, status);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "dstiv  @" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, req->iv,
-                      edesc->src_nents > 1 ? 100 : ivsize, 1);
+       print_hex_dump_debug("dstiv  @" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, req->iv,
+                            edesc->src_nents > 1 ? 100 : ivsize, 1);
        caam_dump_sg(KERN_ERR, "dst    @" __stringify(__LINE__)": ",
                     DUMP_PREFIX_ADDRESS, 16, 4, req->dst,
                     edesc->dst_nents > 1 ? 100 : req->cryptlen, 1);
-#endif
 
        skcipher_unmap(qidev, edesc, req);
 
 
                          ctx->ctx_len, true, ctrlpriv->era);
        dma_sync_single_for_device(jrdev, ctx->sh_desc_update_dma,
                                   desc_bytes(desc), ctx->dir);
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR,
-                      "ahash update shdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+
+       print_hex_dump_debug("ahash update shdesc@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 
        /* ahash_update_first shared descriptor */
        desc = ctx->sh_desc_update_first;
                          ctx->ctx_len, false, ctrlpriv->era);
        dma_sync_single_for_device(jrdev, ctx->sh_desc_update_first_dma,
                                   desc_bytes(desc), ctx->dir);
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR,
-                      "ahash update first shdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("ahash update first shdesc@"__stringify(__LINE__)
+                            ": ", DUMP_PREFIX_ADDRESS, 16, 4, desc,
+                            desc_bytes(desc), 1);
 
        /* ahash_final shared descriptor */
        desc = ctx->sh_desc_fin;
                          ctx->ctx_len, true, ctrlpriv->era);
        dma_sync_single_for_device(jrdev, ctx->sh_desc_fin_dma,
                                   desc_bytes(desc), ctx->dir);
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "ahash final shdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc,
-                      desc_bytes(desc), 1);
-#endif
+
+       print_hex_dump_debug("ahash final shdesc@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc,
+                            desc_bytes(desc), 1);
 
        /* ahash_digest shared descriptor */
        desc = ctx->sh_desc_digest;
                          ctx->ctx_len, false, ctrlpriv->era);
        dma_sync_single_for_device(jrdev, ctx->sh_desc_digest_dma,
                                   desc_bytes(desc), ctx->dir);
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR,
-                      "ahash digest shdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc,
-                      desc_bytes(desc), 1);
-#endif
+
+       print_hex_dump_debug("ahash digest shdesc@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc,
+                            desc_bytes(desc), 1);
 
        return 0;
 }
                            ctx->ctx_len, ctx->key_dma);
        dma_sync_single_for_device(jrdev, ctx->sh_desc_update_first_dma,
                                   desc_bytes(desc), ctx->dir);
-       print_hex_dump_debug("axcbc update first shdesc@" __stringify(__LINE__)" : ",
-                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
-                            1);
+       print_hex_dump_debug("axcbc update first shdesc@" __stringify(__LINE__)
+                            " : ", DUMP_PREFIX_ADDRESS, 16, 4, desc,
+                            desc_bytes(desc), 1);
 
        /* shared descriptor for ahash_digest */
        desc = ctx->sh_desc_digest;
                            ctx->ctx_len, 0);
        dma_sync_single_for_device(jrdev, ctx->sh_desc_update_first_dma,
                                   desc_bytes(desc), ctx->dir);
-       print_hex_dump_debug("acmac update first shdesc@" __stringify(__LINE__)" : ",
-                            DUMP_PREFIX_ADDRESS, 16, 4, desc,
+       print_hex_dump_debug("acmac update first shdesc@" __stringify(__LINE__)
+                            " : ", DUMP_PREFIX_ADDRESS, 16, 4, desc,
                             desc_bytes(desc), 1);
 
        /* shared descriptor for ahash_digest */
        append_seq_store(desc, digestsize, LDST_CLASS_2_CCB |
                         LDST_SRCDST_BYTE_CONTEXT);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "key_in@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, key, *keylen, 1);
-       print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("key_in@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, key, *keylen, 1);
+       print_hex_dump_debug("jobdesc@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 
        result.err = 0;
        init_completion(&result.completion);
                /* in progress */
                wait_for_completion(&result.completion);
                ret = result.err;
-#ifdef DEBUG
-               print_hex_dump(KERN_ERR,
-                              "digested key@"__stringify(__LINE__)": ",
-                              DUMP_PREFIX_ADDRESS, 16, 4, key, digestsize, 1);
-#endif
+
+               print_hex_dump_debug("digested key@"__stringify(__LINE__)": ",
+                                    DUMP_PREFIX_ADDRESS, 16, 4, key,
+                                    digestsize, 1);
        }
        dma_unmap_single(jrdev, key_dma, *keylen, DMA_BIDIRECTIONAL);
 
                        const u8 *key, unsigned int keylen)
 {
        struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
+       struct device *jrdev = ctx->jrdev;
        int blocksize = crypto_tfm_alg_blocksize(&ahash->base);
        int digestsize = crypto_ahash_digestsize(ahash);
        struct caam_drv_private *ctrlpriv = dev_get_drvdata(ctx->jrdev->parent);
        int ret;
        u8 *hashed_key = NULL;
 
-#ifdef DEBUG
-       printk(KERN_ERR "keylen %d\n", keylen);
-#endif
+       dev_dbg(jrdev, "keylen %d\n", keylen);
 
        if (keylen > blocksize) {
                hashed_key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA);
        struct crypto_ahash *ahash = crypto_ahash_reqtfm(req);
        int digestsize = crypto_ahash_digestsize(ahash);
        struct caam_hash_state *state = ahash_request_ctx(req);
-#ifdef DEBUG
        struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
 
-       dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
-#endif
+       dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
 
        edesc = container_of(desc, struct ahash_edesc, hw_desc[0]);
        if (err)
        memcpy(req->result, state->caam_ctx, digestsize);
        kfree(edesc);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "ctx@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx,
-                      ctx->ctx_len, 1);
-#endif
+       print_hex_dump_debug("ctx@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx,
+                            ctx->ctx_len, 1);
 
        req->base.complete(&req->base, err);
 }
        struct crypto_ahash *ahash = crypto_ahash_reqtfm(req);
        struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
        struct caam_hash_state *state = ahash_request_ctx(req);
-#ifdef DEBUG
        int digestsize = crypto_ahash_digestsize(ahash);
 
-       dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
-#endif
+       dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
 
        edesc = container_of(desc, struct ahash_edesc, hw_desc[0]);
        if (err)
        switch_buf(state);
        kfree(edesc);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "ctx@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx,
-                      ctx->ctx_len, 1);
+       print_hex_dump_debug("ctx@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx,
+                            ctx->ctx_len, 1);
        if (req->result)
-               print_hex_dump(KERN_ERR, "result@"__stringify(__LINE__)": ",
-                              DUMP_PREFIX_ADDRESS, 16, 4, req->result,
-                              digestsize, 1);
-#endif
+               print_hex_dump_debug("result@"__stringify(__LINE__)": ",
+                                    DUMP_PREFIX_ADDRESS, 16, 4, req->result,
+                                    digestsize, 1);
 
        req->base.complete(&req->base, err);
 }
        struct crypto_ahash *ahash = crypto_ahash_reqtfm(req);
        int digestsize = crypto_ahash_digestsize(ahash);
        struct caam_hash_state *state = ahash_request_ctx(req);
-#ifdef DEBUG
        struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
 
-       dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
-#endif
+       dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
 
        edesc = container_of(desc, struct ahash_edesc, hw_desc[0]);
        if (err)
        memcpy(req->result, state->caam_ctx, digestsize);
        kfree(edesc);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "ctx@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx,
-                      ctx->ctx_len, 1);
-#endif
+       print_hex_dump_debug("ctx@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx,
+                            ctx->ctx_len, 1);
 
        req->base.complete(&req->base, err);
 }
        struct crypto_ahash *ahash = crypto_ahash_reqtfm(req);
        struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
        struct caam_hash_state *state = ahash_request_ctx(req);
-#ifdef DEBUG
        int digestsize = crypto_ahash_digestsize(ahash);
 
-       dev_err(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
-#endif
+       dev_dbg(jrdev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
 
        edesc = container_of(desc, struct ahash_edesc, hw_desc[0]);
        if (err)
        switch_buf(state);
        kfree(edesc);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "ctx@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx,
-                      ctx->ctx_len, 1);
+       print_hex_dump_debug("ctx@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, state->caam_ctx,
+                            ctx->ctx_len, 1);
        if (req->result)
-               print_hex_dump(KERN_ERR, "result@"__stringify(__LINE__)": ",
-                              DUMP_PREFIX_ADDRESS, 16, 4, req->result,
-                              digestsize, 1);
-#endif
+               print_hex_dump_debug("result@"__stringify(__LINE__)": ",
+                                    DUMP_PREFIX_ADDRESS, 16, 4, req->result,
+                                    digestsize, 1);
 
        req->base.complete(&req->base, err);
 }
 
                append_seq_out_ptr(desc, state->ctx_dma, ctx->ctx_len, 0);
 
-#ifdef DEBUG
-               print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
-                              DUMP_PREFIX_ADDRESS, 16, 4, desc,
-                              desc_bytes(desc), 1);
-#endif
+               print_hex_dump_debug("jobdesc@"__stringify(__LINE__)": ",
+                                    DUMP_PREFIX_ADDRESS, 16, 4, desc,
+                                    desc_bytes(desc), 1);
 
                ret = caam_jr_enqueue(jrdev, desc, ahash_done_bi, req);
                if (ret)
                *buflen = *next_buflen;
                *next_buflen = last_buflen;
        }
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "buf@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, buf, *buflen, 1);
-       print_hex_dump(KERN_ERR, "next buf@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, next_buf,
-                      *next_buflen, 1);
-#endif
+
+       print_hex_dump_debug("buf@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, buf, *buflen, 1);
+       print_hex_dump_debug("next buf@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, next_buf,
+                            *next_buflen, 1);
 
        return ret;
 unmap_ctx:
                          LDST_SGF);
        append_seq_out_ptr(desc, state->ctx_dma, digestsize, 0);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("jobdesc@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 
        ret = caam_jr_enqueue(jrdev, desc, ahash_done_ctx_src, req);
        if (ret)
 
        append_seq_out_ptr(desc, state->ctx_dma, digestsize, 0);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("jobdesc@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 
        ret = caam_jr_enqueue(jrdev, desc, ahash_done_ctx_src, req);
        if (ret)
                return -ENOMEM;
        }
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("jobdesc@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 
        ret = caam_jr_enqueue(jrdev, desc, ahash_done, req);
        if (!ret) {
        if (ret)
                goto unmap;
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("jobdesc@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 
        ret = caam_jr_enqueue(jrdev, desc, ahash_done, req);
        if (!ret) {
                if (ret)
                        goto unmap_ctx;
 
-#ifdef DEBUG
-               print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
-                              DUMP_PREFIX_ADDRESS, 16, 4, desc,
-                              desc_bytes(desc), 1);
-#endif
+               print_hex_dump_debug("jobdesc@"__stringify(__LINE__)": ",
+                                    DUMP_PREFIX_ADDRESS, 16, 4, desc,
+                                    desc_bytes(desc), 1);
 
                ret = caam_jr_enqueue(jrdev, desc, ahash_done_ctx_dst, req);
                if (ret)
                *buflen = *next_buflen;
                *next_buflen = 0;
        }
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "buf@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, buf, *buflen, 1);
-       print_hex_dump(KERN_ERR, "next buf@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, next_buf,
-                      *next_buflen, 1);
-#endif
+
+       print_hex_dump_debug("buf@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, buf, *buflen, 1);
+       print_hex_dump_debug("next buf@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, next_buf, *next_buflen,
+                            1);
 
        return ret;
  unmap_ctx:
        if (ret)
                goto unmap;
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("jobdesc@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 
        ret = caam_jr_enqueue(jrdev, desc, ahash_done, req);
        if (!ret) {
                if (ret)
                        goto unmap_ctx;
 
-#ifdef DEBUG
-               print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
-                              DUMP_PREFIX_ADDRESS, 16, 4, desc,
-                              desc_bytes(desc), 1);
-#endif
+               print_hex_dump_debug("jobdesc@"__stringify(__LINE__)": ",
+                                    DUMP_PREFIX_ADDRESS, 16, 4, desc,
+                                    desc_bytes(desc), 1);
 
                ret = caam_jr_enqueue(jrdev, desc, ahash_done_ctx_dst, req);
                if (ret)
                                         req->nbytes, 0);
                switch_buf(state);
        }
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "next buf@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, next_buf,
-                      *next_buflen, 1);
-#endif
+
+       print_hex_dump_debug("next buf@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, next_buf, *next_buflen,
+                            1);
 
        return ret;
  unmap_ctx:
 
        /* Buffer refilled, invalidate cache */
        dma_sync_single_for_cpu(jrdev, bd->addr, RN_BUF_SIZE, DMA_FROM_DEVICE);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "rng refreshed buf@: ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, bd->buf, RN_BUF_SIZE, 1);
-#endif
+       print_hex_dump_debug("rng refreshed buf@: ", DUMP_PREFIX_ADDRESS, 16, 4,
+                            bd->buf, RN_BUF_SIZE, 1);
 }
 
 static inline int submit_job(struct caam_rng_ctx *ctx, int to_current)
                dev_err(jrdev, "unable to map shared descriptor\n");
                return -ENOMEM;
        }
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "rng shdesc@: ", DUMP_PREFIX_ADDRESS, 16, 4,
-                      desc, desc_bytes(desc), 1);
-#endif
+
+       print_hex_dump_debug("rng shdesc@: ", DUMP_PREFIX_ADDRESS, 16, 4,
+                            desc, desc_bytes(desc), 1);
+
        return 0;
 }
 
        }
 
        append_seq_out_ptr_intlen(desc, bd->addr, RN_BUF_SIZE, 0);
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "rng job desc@: ", DUMP_PREFIX_ADDRESS, 16, 4,
-                      desc, desc_bytes(desc), 1);
-#endif
+
+       print_hex_dump_debug("rng job desc@: ", DUMP_PREFIX_ADDRESS, 16, 4,
+                            desc, desc_bytes(desc), 1);
+
        return 0;
 }
 
 
 {
        struct split_key_result *res = context;
 
-#ifdef DEBUG
-       dev_err(dev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
-#endif
+       dev_dbg(dev, "%s %d: err 0x%x\n", __func__, __LINE__, err);
 
        if (err)
                caam_jr_strstatus(dev, err);
        adata->keylen_pad = split_key_pad_len(adata->algtype &
                                              OP_ALG_ALGSEL_MASK);
 
-#ifdef DEBUG
-       dev_err(jrdev, "split keylen %d split keylen padded %d\n",
+       dev_dbg(jrdev, "split keylen %d split keylen padded %d\n",
                adata->keylen, adata->keylen_pad);
-       print_hex_dump(KERN_ERR, "ctx.key@" __stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, key_in, keylen, 1);
-#endif
+       print_hex_dump_debug("ctx.key@" __stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, key_in, keylen, 1);
 
        if (adata->keylen_pad > max_keylen)
                return -EINVAL;
        append_fifo_store(desc, dma_addr, adata->keylen,
                          LDST_CLASS_2_CCB | FIFOST_TYPE_SPLIT_KEK);
 
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "jobdesc@"__stringify(__LINE__)": ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc), 1);
-#endif
+       print_hex_dump_debug("jobdesc@"__stringify(__LINE__)": ",
+                            DUMP_PREFIX_ADDRESS, 16, 4, desc, desc_bytes(desc),
+                            1);
 
        result.err = 0;
        init_completion(&result.completion);
                /* in progress */
                wait_for_completion(&result.completion);
                ret = result.err;
-#ifdef DEBUG
-               print_hex_dump(KERN_ERR, "ctx.key@"__stringify(__LINE__)": ",
-                              DUMP_PREFIX_ADDRESS, 16, 4, key_out,
-                              adata->keylen_pad, 1);
-#endif
+
+               print_hex_dump_debug("ctx.key@"__stringify(__LINE__)": ",
+                                    DUMP_PREFIX_ADDRESS, 16, 4, key_out,
+                                    adata->keylen_pad, 1);
        }
 
        dma_unmap_single(jrdev, dma_addr, adata->keylen_pad, DMA_BIDIRECTIONAL);
 
                sec4_sg_ptr->bpid_offset = cpu_to_caam32(offset &
                                                         SEC4_SG_OFFSET_MASK);
        }
-#ifdef DEBUG
-       print_hex_dump(KERN_ERR, "sec4_sg_ptr@: ",
-                      DUMP_PREFIX_ADDRESS, 16, 4, sec4_sg_ptr,
-                      sizeof(struct sec4_sg_entry), 1);
-#endif
+
+       print_hex_dump_debug("sec4_sg_ptr@: ", DUMP_PREFIX_ADDRESS, 16, 4,
+                            sec4_sg_ptr, sizeof(struct sec4_sg_entry), 1);
 }
 
 /*