* [PATCH] crypto: cavium - Use 'hlist_for_each_entry' to simplify code
@ 2021-04-28 7:33 Christophe JAILLET
2021-04-28 9:34 ` AW: " Walter Harms
2021-05-14 11:35 ` Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2021-04-28 7:33 UTC (permalink / raw)
To: gcherian, herbert, davem
Cc: linux-crypto, linux-kernel, kernel-janitors, Christophe JAILLET
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>
---
Compile tested only
---
drivers/crypto/cavium/cpt/cptvf_reqmanager.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c
index 4fe7898c8561..feb0f76783dd 100644
--- a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c
+++ b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c
@@ -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 {
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* AW: [PATCH] crypto: cavium - Use 'hlist_for_each_entry' to simplify code
2021-04-28 7:33 [PATCH] crypto: cavium - Use 'hlist_for_each_entry' to simplify code Christophe JAILLET
@ 2021-04-28 9:34 ` Walter Harms
2021-05-14 11:35 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Walter Harms @ 2021-04-28 9:34 UTC (permalink / raw)
To: Christophe JAILLET, gcherian, herbert, davem
Cc: linux-crypto, linux-kernel, kernel-janitors
It is also possible to drop the else and simplify
further.
hlist_for_each_entry(chunk, &queue->chead, nextchunk)
if (chunk != queue->qhead) {
queue->qhead = chunk;
break;
}
re,
wh
________________________________________
Von: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Gesendet: Mittwoch, 28. April 2021 09:33:37
An: gcherian@marvell.com; herbert@gondor.apana.org.au; davem@davemloft.net
Cc: linux-crypto@vger.kernel.org; linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org; Christophe JAILLET
Betreff: [PATCH] crypto: cavium - Use 'hlist_for_each_entry' to simplify code
WARNUNG: Diese E-Mail kam von außerhalb der Organisation. Klicken Sie nicht auf Links oder öffnen Sie keine Anhänge, es sei denn, Sie kennen den/die Absender*in und wissen, dass der Inhalt sicher ist.
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>
---
Compile tested only
---
drivers/crypto/cavium/cpt/cptvf_reqmanager.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c
index 4fe7898c8561..feb0f76783dd 100644
--- a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c
+++ b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c
@@ -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 {
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: cavium - Use 'hlist_for_each_entry' to simplify code
2021-04-28 7:33 [PATCH] crypto: cavium - Use 'hlist_for_each_entry' to simplify code Christophe JAILLET
2021-04-28 9:34 ` AW: " Walter Harms
@ 2021-05-14 11:35 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2021-05-14 11:35 UTC (permalink / raw)
To: Christophe JAILLET
Cc: gcherian, davem, linux-crypto, linux-kernel, kernel-janitors
On Wed, Apr 28, 2021 at 09:33:37AM +0200, Christophe JAILLET wrote:
> 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>
> ---
> Compile tested only
> ---
> drivers/crypto/cavium/cpt/cptvf_reqmanager.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-14 11:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 7:33 [PATCH] crypto: cavium - Use 'hlist_for_each_entry' to simplify code Christophe JAILLET
2021-04-28 9:34 ` AW: " Walter Harms
2021-05-14 11:35 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).