Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1270240
| From | Geliang Tang <geliangtang@163.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/2] crypto: mcryptd - use list_first_entry_or_null() |
| Date | 2015-11-16 15:40 +0100 |
| Message-ID | <qvt6P-8uH-45@gated-at.bofh.it> (permalink) |
| References | <qvt6O-8uH-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[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
csiph-web