Staging: lustre: lnet: selftest: Use list_first_entry
PATCH 1/1 Staging: lustre: lnet: selftest: Use list_first_entry
This patch replaces list_entry with list_first_entry as it makes the code more clear.
Done using coccinelle:
@@
expression e;
@@
(
- list_entry(e->next,
+ list_first_entry(e,
...)
|
- list_entry(e->prev,
+ list_last_entry(e,
...)
)
--- drivers/staging/lustre/lnet/selftest/rpc.c | 4 ++-- drivers/staging/lustre/lnet/selftest/timer.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lnet/selftest/rpc.c +2 -2
@@ -212,8 +212,8 @@ srpc_service_fini(struct srpc_service *svc)break ;while (!list_empty (q)) { - buf = list_entry(q->next, struct srpc_buffer, - buf_list); + buf = list_first_entry(q, struct srpc_buffer, + buf_list);list_del (&buf->buf_list);LIBCFS_FREE (buf,sizeof (*buf)); }
drivers/staging/lustre/lnet/selftest/timer.c +1 -1
@@ -128,7 +128,7 @@ stt_expire_list(struct list_head *slot, time64_t now)struct stt_timer *timer;while (!list_empty (slot)) { - timer = list_entry(slot->next, struct stt_timer, stt_list); + timer = list_first_entry(slot, struct stt_timer, stt_list);if (timer->stt_expires > now)break ;
Signature · 1 line
1.9.1
Quoted 2 lines · Bhumika Goyal
This patch replaces
list_entrywithlist_first_entryas it makes the code more clear.
Shouldn't these be using list_for_each_entry_safe?
julia
Quoted 59 lines
Done using coccinelle:
@@
expression e;
@@
(
- list_entry(e->next,
+ list_first_entry(e,
...)
|
- list_entry(e->prev,
+ list_last_entry(e,
...)
)Signed-off-by Bhumika Goyal <[email protected]>--- drivers/staging/lustre/lnet/selftest/rpc.c | 4 ++-- drivers/staging/lustre/lnet/selftest/timer.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/staging/lustre/lnet/selftest/rpc.c +2
-2@@ -212,8 +212,8 @@ srpc_service_fini(struct srpc_service *svc)break ;while (!list_empty (q)) { - buf = list_entry(q->next, struct srpc_buffer, - buf_list); + buf = list_first_entry(q, struct srpc_buffer, + buf_list);list_del (&buf->buf_list);LIBCFS_FREE (buf,sizeof (*buf)); }drivers/staging/lustre/lnet/selftest/timer.c +1
-2@@ -128,7 +128,7 @@ stt_expire_list(struct list_head *slot, time64_t now)struct stt_timer *timer;while (!list_empty (slot)) { - timer = list_entry(slot->next, struct stt_timer, stt_list); + timer = list_first_entry(slot, struct stt_timer, stt_list);if (timer->stt_expires > now)break ; --1.9.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1457278655-16379-1-git-send-email-bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.