diff options
| author | Petr Mladek <pmladek@suse.com> | 2016-10-19 07:54:30 -0400 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-10-24 23:08:25 -0400 |
| commit | c4ca2b0b25814cd56665c1c8a7c6254d900a6f11 (patch) | |
| tree | 25977405aa442aa6211b0daef85b3630289dbdde /include/crypto | |
| parent | 103600ab966a2f02d8986bbfdf87b762b1c6a06d (diff) | |
crypto: engine - Handle the kthread worker using the new API
Use the new API to create and destroy the crypto engine kthread
worker. The API hides some implementation details.
In particular, kthread_create_worker() allocates and initializes
struct kthread_worker. It runs the kthread the right way
and stores task_struct into the worker structure.
kthread_destroy_worker() flushes all pending works, stops
the kthread and frees the structure.
This patch does not change the existing behavior except for
dynamically allocating struct kthread_worker and storing
only the pointer of this structure.
It is compile tested only because I did not find an easy
way how to run the code. Well, it should be pretty safe
given the nature of the change.
Signed-off-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto')
| -rw-r--r-- | include/crypto/engine.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/include/crypto/engine.h b/include/crypto/engine.h index 04eb5c77addd..1bf600fc99f7 100644 --- a/include/crypto/engine.h +++ b/include/crypto/engine.h | |||
| @@ -43,8 +43,7 @@ | |||
| 43 | * @prepare_hash_request: do some prepare if need before handle the current request | 43 | * @prepare_hash_request: do some prepare if need before handle the current request |
| 44 | * @unprepare_hash_request: undo any work done by prepare_hash_request() | 44 | * @unprepare_hash_request: undo any work done by prepare_hash_request() |
| 45 | * @hash_one_request: do hash for current request | 45 | * @hash_one_request: do hash for current request |
| 46 | * @kworker: thread struct for request pump | 46 | * @kworker: kthread worker struct for request pump |
| 47 | * @kworker_task: pointer to task for request pump kworker thread | ||
| 48 | * @pump_requests: work struct for scheduling work to the request pump | 47 | * @pump_requests: work struct for scheduling work to the request pump |
| 49 | * @priv_data: the engine private data | 48 | * @priv_data: the engine private data |
| 50 | * @cur_req: the current request which is on processing | 49 | * @cur_req: the current request which is on processing |
| @@ -78,8 +77,7 @@ struct crypto_engine { | |||
| 78 | int (*hash_one_request)(struct crypto_engine *engine, | 77 | int (*hash_one_request)(struct crypto_engine *engine, |
| 79 | struct ahash_request *req); | 78 | struct ahash_request *req); |
| 80 | 79 | ||
| 81 | struct kthread_worker kworker; | 80 | struct kthread_worker *kworker; |
| 82 | struct task_struct *kworker_task; | ||
| 83 | struct kthread_work pump_requests; | 81 | struct kthread_work pump_requests; |
| 84 | 82 | ||
| 85 | void *priv_data; | 83 | void *priv_data; |
