Linux-Crypto Archive on lore.kernel.org
 help / color / Atom feed
From: "Horia Geantă" <horia.geanta@nxp.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	Aymen Sghaier <aymen.sghaier@nxp.com>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH] crypto: caam - Move debugfs fops into standalone file
Date: Fri, 31 Jul 2020 19:46:07 +0300
Message-ID: <c7fa483a-8f57-ee12-3c72-68c770ba4e00@nxp.com> (raw)
In-Reply-To: <20200730135426.GA13682@gondor.apana.org.au>

On 7/30/2020 4:54 PM, Herbert Xu wrote:
> Currently the debugfs fops are defined in caam/intern.h.  This causes
> problems because it creates identical static functions and variables
> in multiple files.  It also creates warnings when those files don't
> use the fops.
> 
Indeed, I see the warnings when compiling with W=1 and CONFIG_DEBUG_FS=y.

> This patch moves them into a standalone file, debugfs.c.
> 
> It also removes unnecessary uses of ifdefs on CONFIG_DEBUG_FS.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
Below hunk is needed for fixing the compilation when CONFIG_DEBUG_FS=y:

diff --git a/drivers/crypto/caam/Makefile b/drivers/crypto/caam/Makefile
index 68d5cc0f28e2..a8d0d37408b2 100644
--- a/drivers/crypto/caam/Makefile
+++ b/drivers/crypto/caam/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_DESC) += caamalg_desc.o
 obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API_DESC) += caamhash_desc.o

 caam-y := ctrl.o
+caam-$(CONFIG_DEBUG_FS) += debugfs.o
 caam_jr-y := jr.o key_gen.o
 caam_jr-$(CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API) += caamalg.o
 caam_jr-$(CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_QI) += caamalg_qi.o

> -	ctrlpriv->ctl = debugfs_create_dir("ctl", dfs_root);
> +	ctl = debugfs_create_dir("ctl", dfs_root);
> +#ifdef CONFIG_DEBUG_FS
> +	ctrlpriv->ctl = ctl;
>  #endif
[...]
>  	debugfs_create_blob("kek", S_IRUSR | S_IRGRP | S_IROTH, ctrlpriv->ctl,
> -			    &ctrlpriv->ctl_kek_wrap);
> +			    blob);
Compilation fails when CONFIG_DEBUG_FS=n.

s/ctrlpriv->ctl/ctl, here and below.

>  
> -	ctrlpriv->ctl_tkek_wrap.data = (__force void *)&ctrlpriv->ctrl->tkek[0];
> -	ctrlpriv->ctl_tkek_wrap.size = KEK_KEY_SIZE * sizeof(u32);
> +	blob = caam_debugfs_ptr(&ctrlpriv->ctl_tkek_wrap);
> +	blob->data = (__force void *)&ctrlpriv->ctrl->tkek[0];
> +	blob->size = KEK_KEY_SIZE * sizeof(u32);
>  	debugfs_create_blob("tkek", S_IRUSR | S_IRGRP | S_IROTH, ctrlpriv->ctl,
> -			    &ctrlpriv->ctl_tkek_wrap);
> +			    blob);
>  
> -	ctrlpriv->ctl_tdsk_wrap.data = (__force void *)&ctrlpriv->ctrl->tdsk[0];
> -	ctrlpriv->ctl_tdsk_wrap.size = KEK_KEY_SIZE * sizeof(u32);
> +	blob = caam_debugfs_ptr(&ctrlpriv->ctl_tdsk_wrap);
> +	blob->data = (__force void *)&ctrlpriv->ctrl->tdsk[0];
> +	blob->size = KEK_KEY_SIZE * sizeof(u32);
>  	debugfs_create_blob("tdsk", S_IRUSR | S_IRGRP | S_IROTH, ctrlpriv->ctl,
> -			    &ctrlpriv->ctl_tdsk_wrap);
> -#endif
> +			    blob);

Thanks,
Horia

  reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30 13:54 Herbert Xu
2020-07-31 16:46 ` Horia Geantă [this message]
2020-08-01 12:42   ` [v2 PATCH] " Herbert Xu
2020-08-06 18:09     ` [v3 " Horia Geantă
2020-08-06 22:10       ` Herbert Xu
2020-08-07  4:54         ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c7fa483a-8f57-ee12-3c72-68c770ba4e00@nxp.com \
    --to=horia.geanta@nxp.com \
    --cc=aymen.sghaier@nxp.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Crypto Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-crypto/0 linux-crypto/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-crypto linux-crypto/ https://lore.kernel.org/linux-crypto \
		linux-crypto@vger.kernel.org
	public-inbox-index linux-crypto

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-crypto


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git