diff options
-rw-r--r-- | drivers/crypto/ccp/ccp-crypto-main.c | 4 | ||||
-rw-r--r-- | drivers/crypto/ccp/ccp-dev.c | 14 | ||||
-rw-r--r-- | include/linux/ccp.h | 12 |
3 files changed, 30 insertions, 0 deletions
diff --git a/drivers/crypto/ccp/ccp-crypto-main.c b/drivers/crypto/ccp/ccp-crypto-main.c index 20dc848481e7..4d4e016d755b 100644 --- a/drivers/crypto/ccp/ccp-crypto-main.c +++ b/drivers/crypto/ccp/ccp-crypto-main.c | |||
@@ -367,6 +367,10 @@ static int ccp_crypto_init(void) | |||
367 | { | 367 | { |
368 | int ret; | 368 | int ret; |
369 | 369 | ||
370 | ret = ccp_present(); | ||
371 | if (ret) | ||
372 | return ret; | ||
373 | |||
370 | spin_lock_init(&req_queue_lock); | 374 | spin_lock_init(&req_queue_lock); |
371 | INIT_LIST_HEAD(&req_queue.cmds); | 375 | INIT_LIST_HEAD(&req_queue.cmds); |
372 | req_queue.backlog = &req_queue.cmds; | 376 | req_queue.backlog = &req_queue.cmds; |
diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index a7d110652a74..c6e6171eb6d3 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c | |||
@@ -55,6 +55,20 @@ static inline void ccp_del_device(struct ccp_device *ccp) | |||
55 | } | 55 | } |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * ccp_present - check if a CCP device is present | ||
59 | * | ||
60 | * Returns zero if a CCP device is present, -ENODEV otherwise. | ||
61 | */ | ||
62 | int ccp_present(void) | ||
63 | { | ||
64 | if (ccp_get_device()) | ||
65 | return 0; | ||
66 | |||
67 | return -ENODEV; | ||
68 | } | ||
69 | EXPORT_SYMBOL_GPL(ccp_present); | ||
70 | |||
71 | /** | ||
58 | * ccp_enqueue_cmd - queue an operation for processing by the CCP | 72 | * ccp_enqueue_cmd - queue an operation for processing by the CCP |
59 | * | 73 | * |
60 | * @cmd: ccp_cmd struct to be processed | 74 | * @cmd: ccp_cmd struct to be processed |
diff --git a/include/linux/ccp.h b/include/linux/ccp.h index ebcc9d146219..7f437036baa4 100644 --- a/include/linux/ccp.h +++ b/include/linux/ccp.h | |||
@@ -27,6 +27,13 @@ struct ccp_cmd; | |||
27 | defined(CONFIG_CRYPTO_DEV_CCP_DD_MODULE) | 27 | defined(CONFIG_CRYPTO_DEV_CCP_DD_MODULE) |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * ccp_present - check if a CCP device is present | ||
31 | * | ||
32 | * Returns zero if a CCP device is present, -ENODEV otherwise. | ||
33 | */ | ||
34 | int ccp_present(void); | ||
35 | |||
36 | /** | ||
30 | * ccp_enqueue_cmd - queue an operation for processing by the CCP | 37 | * ccp_enqueue_cmd - queue an operation for processing by the CCP |
31 | * | 38 | * |
32 | * @cmd: ccp_cmd struct to be processed | 39 | * @cmd: ccp_cmd struct to be processed |
@@ -53,6 +60,11 @@ int ccp_enqueue_cmd(struct ccp_cmd *cmd); | |||
53 | 60 | ||
54 | #else /* CONFIG_CRYPTO_DEV_CCP_DD is not enabled */ | 61 | #else /* CONFIG_CRYPTO_DEV_CCP_DD is not enabled */ |
55 | 62 | ||
63 | static inline int ccp_present(void) | ||
64 | { | ||
65 | return -ENODEV; | ||
66 | } | ||
67 | |||
56 | static inline int ccp_enqueue_cmd(struct ccp_cmd *cmd) | 68 | static inline int ccp_enqueue_cmd(struct ccp_cmd *cmd) |
57 | { | 69 | { |
58 | return -ENODEV; | 70 | return -ENODEV; |