diff options
author | Geliang Tang <geliangtang@163.com> | 2015-11-16 22:37:14 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-11-23 20:55:50 +0800 |
commit | 304e4818d4a45e83019ea30e4cfcb3ac2a8ce09a (patch) | |
tree | 426d0b70e9fe8624c66ef63d96e7ac0963399f17 | |
parent | 4f9ea86604e3ba64edd2817795798168fbb3c1a6 (diff) | |
download | linux-304e4818d4a45e83019ea30e4cfcb3ac2a8ce09a.tar.gz linux-304e4818d4a45e83019ea30e4cfcb3ac2a8ce09a.tar.bz2 linux-304e4818d4a45e83019ea30e4cfcb3ac2a8ce09a.zip |
crypto: api - use list_first_entry_or_null and list_next_entry
Simplify crypto_more_spawns() with list_first_entry_or_null()
and list_next_entry().
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/algapi.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c index 59bf491fe3d8..7be76aa31579 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -93,16 +93,15 @@ static struct list_head *crypto_more_spawns(struct crypto_alg *alg, { struct crypto_spawn *spawn, *n; - if (list_empty(stack)) + spawn = list_first_entry_or_null(stack, struct crypto_spawn, list); + if (!spawn) return NULL; - spawn = list_first_entry(stack, struct crypto_spawn, list); - n = list_entry(spawn->list.next, struct crypto_spawn, list); + n = list_next_entry(spawn, list); if (spawn->alg && &n->list != stack && !n->alg) n->alg = (n->list.next == stack) ? alg : - &list_entry(n->list.next, struct crypto_spawn, - list)->inst->alg; + &list_next_entry(n, list)->inst->alg; list_move(&spawn->list, secondary_spawns); |