Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1270235 > unrolled thread

[PATCH 1/2] crypto: api - use list_first_entry_or_null and list_next_entry

Started byGeliang Tang <geliangtang@163.com>
First post2015-11-16 15:40 +0100
Last post2015-11-23 14:10 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] crypto: api - use list_first_entry_or_null and list_next_entry Geliang Tang <geliangtang@163.com> - 2015-11-16 15:40 +0100
    [PATCH 2/2] crypto: mcryptd - use list_first_entry_or_null() Geliang Tang <geliangtang@163.com> - 2015-11-16 15:40 +0100
      Re: [PATCH 2/2] crypto: mcryptd - use list_first_entry_or_null() Herbert Xu <herbert@gondor.apana.org.au> - 2015-11-23 14:10 +0100
    Re: [PATCH 1/2] crypto: api - use list_first_entry_or_null and  list_next_entry Herbert Xu <herbert@gondor.apana.org.au> - 2015-11-23 14:10 +0100

#1270235 — [PATCH 1/2] crypto: api - use list_first_entry_or_null and list_next_entry

FromGeliang Tang <geliangtang@163.com>
Date2015-11-16 15:40 +0100
Subject[PATCH 1/2] crypto: api - use list_first_entry_or_null and list_next_entry
Message-ID<qvt6O-8uH-31@gated-at.bofh.it>
Simplify crypto_more_spawns() with list_first_entry_or_null()
and list_next_entry().

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 crypto/algapi.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/crypto/algapi.c b/crypto/algapi.c
index 59bf491..7be76aa 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);
 
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1270240 — [PATCH 2/2] crypto: mcryptd - use list_first_entry_or_null()

FromGeliang Tang <geliangtang@163.com>
Date2015-11-16 15:40 +0100
Subject[PATCH 2/2] crypto: mcryptd - use list_first_entry_or_null()
Message-ID<qvt6P-8uH-45@gated-at.bofh.it>
In reply to#1270235
Simplify mcryptd_opportunistic_flush() with list_first_entry_or_null().

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 crypto/mcryptd.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/crypto/mcryptd.c b/crypto/mcryptd.c
index fe5b495a..f78d4fc 100644
--- a/crypto/mcryptd.c
+++ b/crypto/mcryptd.c
@@ -128,13 +128,9 @@ static void mcryptd_opportunistic_flush(void)
 	flist = per_cpu_ptr(mcryptd_flist, smp_processor_id());
 	while (single_task_running()) {
 		mutex_lock(&flist->lock);
-		if (list_empty(&flist->list)) {
-			mutex_unlock(&flist->lock);
-			return;
-		}
-		cstate = list_entry(flist->list.next,
+		cstate = list_first_entry_or_null(&flist->list,
 				struct mcryptd_alg_cstate, flush_list);
-		if (!cstate->flusher_engaged) {
+		if (!cstate || !cstate->flusher_engaged) {
 			mutex_unlock(&flist->lock);
 			return;
 		}
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1275315 — Re: [PATCH 2/2] crypto: mcryptd - use list_first_entry_or_null()

FromHerbert Xu <herbert@gondor.apana.org.au>
Date2015-11-23 14:10 +0100
SubjectRe: [PATCH 2/2] crypto: mcryptd - use list_first_entry_or_null()
Message-ID<qxZ2z-29g-43@gated-at.bofh.it>
In reply to#1270240
On Mon, Nov 16, 2015 at 10:37:15PM +0800, Geliang Tang wrote:
> Simplify mcryptd_opportunistic_flush() with list_first_entry_or_null().
> 
> Signed-off-by: Geliang Tang <geliangtang@163.com>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1275308 — Re: [PATCH 1/2] crypto: api - use list_first_entry_or_null and list_next_entry

FromHerbert Xu <herbert@gondor.apana.org.au>
Date2015-11-23 14:10 +0100
SubjectRe: [PATCH 1/2] crypto: api - use list_first_entry_or_null and list_next_entry
Message-ID<qxZ2y-29g-25@gated-at.bofh.it>
In reply to#1270235
On Mon, Nov 16, 2015 at 10:37:14PM +0800, Geliang Tang wrote:
> Simplify crypto_more_spawns() with list_first_entry_or_null()
> and list_next_entry().
> 
> Signed-off-by: Geliang Tang <geliangtang@163.com>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web