crypto: cpt - Use 'hlist_for_each_entry' to simplify code
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Wed, 28 Apr 2021 07:33:37 +0000 (09:33 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 14 May 2021 11:07:55 +0000 (19:07 +0800)
Use 'hlist_for_each_entry' instead of hand writing it.
This saves a few lines of code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/cavium/cpt/cptvf_reqmanager.c

index 4fe7898c85615a7d8d9dabddc0e6a933368e8463..feb0f76783ddac03384300fb7117b5a9c5e4953a 100644 (file)
@@ -244,11 +244,7 @@ static int send_cpt_command(struct cpt_vf *cptvf, union cpt_inst_s *cmd,
        memcpy(ent, (void *)cmd, qinfo->cmd_size);
 
        if (++queue->idx >= queue->qhead->size / 64) {
-               struct hlist_node *node;
-
-               hlist_for_each(node, &queue->chead) {
-                       chunk = hlist_entry(node, struct command_chunk,
-                                           nextchunk);
+               hlist_for_each_entry(chunk, &queue->chead, nextchunk) {
                        if (chunk == queue->qhead) {
                                continue;
                        } else {