diff options
author | Geliang Tang <geliangtang@163.com> | 2015-11-16 09:37:14 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-11-23 07:55:50 -0500 |
commit | 304e4818d4a45e83019ea30e4cfcb3ac2a8ce09a (patch) | |
tree | 426d0b70e9fe8624c66ef63d96e7ac0963399f17 /crypto/algapi.c | |
parent | 4f9ea86604e3ba64edd2817795798168fbb3c1a6 (diff) |
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>
Diffstat (limited to 'crypto/algapi.c')
-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, | |||
93 | { | 93 | { |
94 | struct crypto_spawn *spawn, *n; | 94 | struct crypto_spawn *spawn, *n; |
95 | 95 | ||
96 | if (list_empty(stack)) | 96 | spawn = list_first_entry_or_null(stack, struct crypto_spawn, list); |
97 | if (!spawn) | ||
97 | return NULL; | 98 | return NULL; |
98 | 99 | ||
99 | spawn = list_first_entry(stack, struct crypto_spawn, list); | 100 | n = list_next_entry(spawn, list); |
100 | n = list_entry(spawn->list.next, struct crypto_spawn, list); | ||
101 | 101 | ||
102 | if (spawn->alg && &n->list != stack && !n->alg) | 102 | if (spawn->alg && &n->list != stack && !n->alg) |
103 | n->alg = (n->list.next == stack) ? alg : | 103 | n->alg = (n->list.next == stack) ? alg : |
104 | &list_entry(n->list.next, struct crypto_spawn, | 104 | &list_next_entry(n, list)->inst->alg; |
105 | list)->inst->alg; | ||
106 | 105 | ||
107 | list_move(&spawn->list, secondary_spawns); | 106 | list_move(&spawn->list, secondary_spawns); |
108 | 107 | ||