Re: [PATCH 2/3] crypto: caam: print debug messages at debug level

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/17/2019 12:29 PM, Sascha Hauer wrote:
> The CAAM driver used to put its debug messages inside #ifdef DEBUG and
> then prints the messages at KERN_ERR level. Replace this with proper
> functions printing at KERN_DEBUG level. The #ifdef DEBUG gets
> unnecessary when the right functions are used.
> 
> This replaces:
> 
> - print_hex_dump(KERN_ERR ...) inside #ifdef DEBUG with
>   print_hex_dump_debug(...)
> - dev_err() inside #ifdef DEBUG with dev_dbg()
> - printk(KERN_ERR ...) inside #ifdef DEBUG with dev_dbg()
> 
> Some parts of the driver use these functions already, so it is only
> consequent to use the debug function consistently.
> 
> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> ---
>  drivers/crypto/caam/caamalg.c      |  95 ++++++++--------------
>  drivers/crypto/caam/caamalg_desc.c |  71 ++++------------
>  drivers/crypto/caam/caamalg_qi.c   |  36 +++------
>  drivers/crypto/caam/caamhash.c     | 126 +++++++++--------------------
>  drivers/crypto/caam/caamrng.c      |  16 ++--
>  drivers/crypto/caam/key_gen.c      |  19 ++---
>  drivers/crypto/caam/sg_sw_sec4.h   |   5 +-
>  7 files changed, 113 insertions(+), 255 deletions(-)
> 
> diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
> index 007c35cfc670..1395b4860f23 100644
> --- a/drivers/crypto/caam/caamalg.c
> +++ b/drivers/crypto/caam/caamalg.c
> @@ -575,13 +575,11 @@ static int aead_setkey(struct crypto_aead *aead,
>  	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__)": ",
> +	print_hex_dump_debug("key in @"__stringify(__LINE__)": ",
>  		       DUMP_PREFIX_ADDRESS, 16, 4, key, keylen, 1);
The alignments should probably be taken care of too, even if it adds a bit of noise.

Thanks,
Horia




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux