[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200925073629.GA18921@gondor.apana.org.au>
Date: Fri, 25 Sep 2020 17:36:29 +1000
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Corentin Labbe <clabbe@...libre.com>
Cc: arnd@...db.de, davem@...emloft.net, mripard@...nel.org,
wens@...e.org, linux-arm-kernel@...ts.infradead.org,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-sunxi@...glegroups.com
Subject: Re: [PATCH v2 6/7] crypto: sun4i-ss: enabled stats via debugfs
On Sun, Sep 20, 2020 at 06:37:17PM +0000, Corentin Labbe wrote:
>
> diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c
> index f3bdf465b02e..2ec359eaa4cf 100644
> --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c
> +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c
> @@ -34,6 +34,10 @@ static int noinline_for_stack sun4i_ss_opti_poll(struct skcipher_request *areq)
> struct sg_mapping_iter mi, mo;
> unsigned int oi, oo; /* offset for in and out */
> unsigned long flags;
> +#ifdef CONFIG_CRYPTO_DEV_SUN4I_SS_DEBUG
> + struct skcipher_alg *alg = crypto_skcipher_alg(tfm);
> + struct sun4i_ss_alg_template *algt;
> +#endif
>
> if (!areq->cryptlen)
> return 0;
> @@ -50,6 +54,12 @@ static int noinline_for_stack sun4i_ss_opti_poll(struct skcipher_request *areq)
> scatterwalk_map_and_copy(backup_iv, areq->src, areq->cryptlen - ivsize, ivsize, 0);
> }
>
> +#ifdef CONFIG_CRYPTO_DEV_SUN4I_SS_DEBUG
> + algt = container_of(alg, struct sun4i_ss_alg_template, alg.crypto);
> + algt->stat_opti++;
> + algt->stat_bytes += areq->cryptlen;
> +#endif
Please do
if (IS_ENABLED(CONFIG_CRYPTO_DEV_SUN4I_SS_DEBUG)) {
...
}
instead so this always gets compiled.
> +#ifdef CONFIG_CRYPTO_DEV_SUN4I_SS_DEBUG
> + /* Ignore error of debugfs */
> + ss->dbgfs_dir = debugfs_create_dir("sun4i-ss", NULL);
> + ss->dbgfs_stats = debugfs_create_file("stats", 0444, ss->dbgfs_dir, ss,
> + &sun4i_ss_debugfs_fops);
> +#endif
The calls too be done under an if statement. Only the assignments
need to use the ifdef.
> diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h
> index 163962f9e284..a98a2c05089b 100644
> --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h
> +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss.h
> @@ -13,6 +13,7 @@
>
> #include <linux/clk.h>
> #include <linux/crypto.h>
> +#include <linux/debugfs.h>
Please add this into the c files that actually use debugfs, and
not here.
> #include <linux/io.h>
> #include <linux/module.h>
> #include <linux/of.h>
> @@ -152,6 +153,10 @@ struct sun4i_ss_ctx {
> #ifdef CONFIG_CRYPTO_DEV_SUN4I_SS_PRNG
> u32 seed[SS_SEED_LEN / BITS_PER_LONG];
> #endif
> +#ifdef CONFIG_CRYPTO_DEV_SUN4I_SS_DEBUG
> + struct dentry *dbgfs_dir;
> + struct dentry *dbgfs_stats;
> +#endif
You just need to add forward declarations for struct dentry.
Thanks,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists