Skip to content

Commit 5eb3243

Browse files
ovpanaitherbertx
authored andcommitted
crypto: engine - remove {prepare,unprepare}_crypt_hardware callbacks
The {prepare,unprepare}_crypt_hardware callbacks were added back in 2016 by commit 735d37b ("crypto: engine - Introduce the block request crypto engine framework"), but they were never implemented by any driver. Remove them as they are unused. Since the 'engine->idling' and 'was_busy' flags are no longer needed, remove them as well. Signed-off-by: Ovidiu Panait <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent c470ffa commit 5eb3243

File tree

3 files changed

+1
-46
lines changed

3 files changed

+1
-46
lines changed

Documentation/crypto/crypto_engine.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ engine using ``crypto_engine_stop()`` and destroy the engine with
3636
Before transferring any request, you have to fill the context enginectx by
3737
providing functions for the following:
3838

39-
* ``prepare_crypt_hardware``: Called once before any prepare functions are
40-
called.
41-
42-
* ``unprepare_crypt_hardware``: Called once after all unprepare functions have
43-
been called.
44-
4539
* ``prepare_cipher_request``/``prepare_hash_request``: Called before each
4640
corresponding request is performed. If some processing or other preparatory
4741
work is required, do it here.

crypto/crypto_engine.c

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ static void crypto_pump_requests(struct crypto_engine *engine,
7474
struct crypto_engine_alg *alg;
7575
struct crypto_engine_op *op;
7676
unsigned long flags;
77-
bool was_busy = false;
7877
int ret;
7978

8079
spin_lock_irqsave(&engine->queue_lock, flags);
@@ -83,12 +82,6 @@ static void crypto_pump_requests(struct crypto_engine *engine,
8382
if (!engine->retry_support && engine->cur_req)
8483
goto out;
8584

86-
/* If another context is idling then defer */
87-
if (engine->idling) {
88-
kthread_queue_work(engine->kworker, &engine->pump_requests);
89-
goto out;
90-
}
91-
9285
/* Check if the engine queue is idle */
9386
if (!crypto_queue_len(&engine->queue) || !engine->running) {
9487
if (!engine->busy)
@@ -102,15 +95,6 @@ static void crypto_pump_requests(struct crypto_engine *engine,
10295
}
10396

10497
engine->busy = false;
105-
engine->idling = true;
106-
spin_unlock_irqrestore(&engine->queue_lock, flags);
107-
108-
if (engine->unprepare_crypt_hardware &&
109-
engine->unprepare_crypt_hardware(engine))
110-
dev_err(engine->dev, "failed to unprepare crypt hardware\n");
111-
112-
spin_lock_irqsave(&engine->queue_lock, flags);
113-
engine->idling = false;
11498
goto out;
11599
}
116100

@@ -129,22 +113,11 @@ static void crypto_pump_requests(struct crypto_engine *engine,
129113
if (!engine->retry_support)
130114
engine->cur_req = async_req;
131115

132-
if (engine->busy)
133-
was_busy = true;
134-
else
116+
if (!engine->busy)
135117
engine->busy = true;
136118

137119
spin_unlock_irqrestore(&engine->queue_lock, flags);
138120

139-
/* Until here we get the request need to be encrypted successfully */
140-
if (!was_busy && engine->prepare_crypt_hardware) {
141-
ret = engine->prepare_crypt_hardware(engine);
142-
if (ret) {
143-
dev_err(engine->dev, "failed to prepare crypt hardware\n");
144-
goto req_err_1;
145-
}
146-
}
147-
148121
alg = container_of(async_req->tfm->__crt_alg,
149122
struct crypto_engine_alg, base);
150123
op = &alg->op;
@@ -474,7 +447,6 @@ struct crypto_engine *crypto_engine_alloc_init_and_set(struct device *dev,
474447
engine->rt = rt;
475448
engine->running = false;
476449
engine->busy = false;
477-
engine->idling = false;
478450
engine->retry_support = retry_support;
479451
engine->priv_data = dev;
480452

include/crypto/internal/engine.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ struct device;
2121
/*
2222
* struct crypto_engine - crypto hardware engine
2323
* @name: the engine name
24-
* @idling: the engine is entering idle state
2524
* @busy: request pump is busy
2625
* @running: the engine is on working
2726
* @retry_support: indication that the hardware allows re-execution
@@ -31,20 +30,13 @@ struct device;
3130
* @list: link with the global crypto engine list
3231
* @queue_lock: spinlock to synchronise access to request queue
3332
* @queue: the crypto queue of the engine
34-
* @prepare_crypt_hardware: a request will soon arrive from the queue
35-
* so the subsystem requests the driver to prepare the hardware
36-
* by issuing this call
37-
* @unprepare_crypt_hardware: there are currently no more requests on the
38-
* queue so the subsystem notifies the driver that it may relax the
39-
* hardware by issuing this call
4033
* @kworker: kthread worker struct for request pump
4134
* @pump_requests: work struct for scheduling work to the request pump
4235
* @priv_data: the engine private data
4336
* @cur_req: the current request which is on processing
4437
*/
4538
struct crypto_engine {
4639
char name[ENGINE_NAME_LEN];
47-
bool idling;
4840
bool busy;
4941
bool running;
5042

@@ -56,9 +48,6 @@ struct crypto_engine {
5648
struct crypto_queue queue;
5749
struct device *dev;
5850

59-
int (*prepare_crypt_hardware)(struct crypto_engine *engine);
60-
int (*unprepare_crypt_hardware)(struct crypto_engine *engine);
61-
6251
struct kthread_worker *kworker;
6352
struct kthread_work pump_requests;
6453

0 commit comments

Comments
 (0)