2019-07-10 21:46:01

by Gary R Hook

[permalink] [raw]
Subject: [PATCH 0/2] Improve system log messaging in ccp-crypto

From: Gary R Hook <[email protected]>

Add a prefix to any messages logged by the ccp-crypto module, and
add a notice if the module fails to load in the case that no CCPs
are defined.

Gary R Hook (2):
crypto: ccp - Include the module name in system log messages
crypto: ccp - Log an error message when ccp-crypto fails to load

drivers/crypto/ccp/ccp-crypto-main.c | 4 +++-
drivers/crypto/ccp/ccp-crypto.h | 4 ++++
2 files changed, 7 insertions(+), 1 deletion(-)

--
2.17.1


2019-07-10 21:46:01

by Gary R Hook

[permalink] [raw]
Subject: [PATCH 2/2] crypto: ccp - Log an error message when ccp-crypto fails to load

If there are no CCP devices on the system, ccp-crypto will not load.
Write a message to the system log clarifying the reason for the failure
of the modprobe operation
---
drivers/crypto/ccp/ccp-crypto-main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/ccp/ccp-crypto-main.c b/drivers/crypto/ccp/ccp-crypto-main.c
index 44a9917a4a6a..5b61c440dff0 100644
--- a/drivers/crypto/ccp/ccp-crypto-main.c
+++ b/drivers/crypto/ccp/ccp-crypto-main.c
@@ -405,8 +405,10 @@ static int ccp_crypto_init(void)
int ret;

ret = ccp_present();
- if (ret)
+ if (ret) {
+ pr_err("Cannot load: there are no available CCPs\n");
return ret;
+ }

spin_lock_init(&req_queue_lock);
INIT_LIST_HEAD(&req_queue.cmds);
--
2.17.1

2019-07-10 21:46:28

by Gary R Hook

[permalink] [raw]
Subject: [PATCH 1/2] crypto: ccp - Include the module name in system log messages

Redefine pr_fmt so that the module name is prefixed to every
log message produced by the ccp-crypto module

Signed-off-by: Gary R Hook <[email protected]>
---
drivers/crypto/ccp/ccp-crypto.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/crypto/ccp/ccp-crypto.h b/drivers/crypto/ccp/ccp-crypto.h
index a4a593dddfd6..c5d471b2ac1b 100644
--- a/drivers/crypto/ccp/ccp-crypto.h
+++ b/drivers/crypto/ccp/ccp-crypto.h
@@ -24,6 +24,10 @@
#include <crypto/akcipher.h>
#include <crypto/internal/rsa.h>

+/* We want the module name in front of our messages */
+#undef pr_fmt
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#define CCP_LOG_LEVEL KERN_INFO

#define CCP_CRA_PRIORITY 300
--
2.17.1

2019-07-26 12:35:53

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH 0/2] Improve system log messaging in ccp-crypto

Hook, Gary <[email protected]> wrote:
> From: Gary R Hook <[email protected]>
>
> Add a prefix to any messages logged by the ccp-crypto module, and
> add a notice if the module fails to load in the case that no CCPs
> are defined.
>
> Gary R Hook (2):
> crypto: ccp - Include the module name in system log messages
> crypto: ccp - Log an error message when ccp-crypto fails to load
>
> drivers/crypto/ccp/ccp-crypto-main.c | 4 +++-
> drivers/crypto/ccp/ccp-crypto.h | 4 ++++
> 2 files changed, 7 insertions(+), 1 deletion(-)

All applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt