mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-07 14:32:23 +00:00
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>
This commit is contained in:
parent
4f9ea86604
commit
304e4818d4
@ -93,16 +93,15 @@ static struct list_head *crypto_more_spawns(struct crypto_alg *alg,
|
|||||||
{
|
{
|
||||||
struct crypto_spawn *spawn, *n;
|
struct crypto_spawn *spawn, *n;
|
||||||
|
|
||||||
if (list_empty(stack))
|
spawn = list_first_entry_or_null(stack, struct crypto_spawn, list);
|
||||||
|
if (!spawn)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
spawn = list_first_entry(stack, struct crypto_spawn, list);
|
n = list_next_entry(spawn, list);
|
||||||
n = list_entry(spawn->list.next, struct crypto_spawn, list);
|
|
||||||
|
|
||||||
if (spawn->alg && &n->list != stack && !n->alg)
|
if (spawn->alg && &n->list != stack && !n->alg)
|
||||||
n->alg = (n->list.next == stack) ? alg :
|
n->alg = (n->list.next == stack) ? alg :
|
||||||
&list_entry(n->list.next, struct crypto_spawn,
|
&list_next_entry(n, list)->inst->alg;
|
||||||
list)->inst->alg;
|
|
||||||
|
|
||||||
list_move(&spawn->list, secondary_spawns);
|
list_move(&spawn->list, secondary_spawns);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user