Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: sun8i-ce-cipher - use IS_ENABLED() checks for debugfs stats

Add IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG) checks before the
fallback counter updates to make sure the code is not included when
debugfs statistics support is not enabled.

Also, drop the existing ifdef guards, since 'struct sun8i_ce_alg_template'
is always defined, even with CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG disabled.

Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
Tested-by: Corentin LABBE <clabbe.montjoie@gmail.com>
Acked-by: Corentin LABBE <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Ovidiu Panait and committed by
Herbert Xu
031bc3e8 8e379e8f

+30 -16
+30 -16
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
··· 33 33 34 34 if (sg_nents_for_len(areq->src, areq->cryptlen) > MAX_SG || 35 35 sg_nents_for_len(areq->dst, areq->cryptlen) > MAX_SG) { 36 - algt->stat_fb_maxsg++; 36 + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) 37 + algt->stat_fb_maxsg++; 38 + 37 39 return true; 38 40 } 39 41 40 42 if (areq->cryptlen < crypto_skcipher_ivsize(tfm)) { 41 - algt->stat_fb_leniv++; 43 + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) 44 + algt->stat_fb_leniv++; 45 + 42 46 return true; 43 47 } 44 48 45 49 if (areq->cryptlen == 0) { 46 - algt->stat_fb_len0++; 50 + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) 51 + algt->stat_fb_len0++; 52 + 47 53 return true; 48 54 } 49 55 50 56 if (areq->cryptlen % 16) { 51 - algt->stat_fb_mod16++; 57 + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) 58 + algt->stat_fb_mod16++; 59 + 52 60 return true; 53 61 } 54 62 ··· 64 56 sg = areq->src; 65 57 while (sg) { 66 58 if (!IS_ALIGNED(sg->offset, sizeof(u32))) { 67 - algt->stat_fb_srcali++; 59 + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) 60 + algt->stat_fb_srcali++; 61 + 68 62 return true; 69 63 } 70 64 todo = min(len, sg->length); 71 65 if (todo % 4) { 72 - algt->stat_fb_srclen++; 66 + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) 67 + algt->stat_fb_srclen++; 68 + 73 69 return true; 74 70 } 75 71 len -= todo; ··· 84 72 sg = areq->dst; 85 73 while (sg) { 86 74 if (!IS_ALIGNED(sg->offset, sizeof(u32))) { 87 - algt->stat_fb_dstali++; 75 + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) 76 + algt->stat_fb_dstali++; 77 + 88 78 return true; 89 79 } 90 80 todo = min(len, sg->length); 91 81 if (todo % 4) { 92 - algt->stat_fb_dstlen++; 82 + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) 83 + algt->stat_fb_dstlen++; 84 + 93 85 return true; 94 86 } 95 87 len -= todo; ··· 116 100 algt = container_of(alg, struct sun8i_ce_alg_template, 117 101 alg.skcipher.base); 118 102 119 - #ifdef CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG 120 103 algt->stat_fb++; 121 - #endif 122 104 } 123 105 124 106 skcipher_request_set_tfm(&rctx->fallback_req, op->fallback_tfm); ··· 160 146 rctx->op_dir, areq->iv, crypto_skcipher_ivsize(tfm), 161 147 op->keylen); 162 148 163 - #ifdef CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG 164 - algt->stat_req++; 165 - #endif 149 + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) 150 + algt->stat_req++; 166 151 167 152 flow = rctx->flow; 168 153 ··· 450 437 crypto_skcipher_set_reqsize(sktfm, sizeof(struct sun8i_cipher_req_ctx) + 451 438 crypto_skcipher_reqsize(op->fallback_tfm)); 452 439 453 - memcpy(algt->fbname, 454 - crypto_skcipher_driver_name(op->fallback_tfm), 455 - CRYPTO_MAX_ALG_NAME); 440 + if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG)) 441 + memcpy(algt->fbname, 442 + crypto_skcipher_driver_name(op->fallback_tfm), 443 + CRYPTO_MAX_ALG_NAME); 456 444 457 445 err = pm_runtime_get_sync(op->ce->dev); 458 446 if (err < 0)