Thread (3 messages) 3 messages, 3 authors, 2023-08-31

Re: [PATCH -next] isdn: capi, Use list_for_each_entry() helper

From: Michal Swiatkowski <hidden>
Date: 2023-08-30 09:42:42

On Wed, Aug 30, 2023 at 05:05:28PM +0800, Jinjie Ruan wrote:
quoted hunk ↗ jump to hunk
Convert list_for_each() to list_for_each_entry() so that the l
list_head pointer and list_entry() call are no longer needed, which
can reduce a few lines of code. No functional changed.

Signed-off-by: Jinjie Ruan <redacted>
---
 drivers/isdn/capi/capi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 2f3789515445..6664eb3dc35c 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -1326,11 +1326,9 @@ static inline void capinc_tty_exit(void) { }
 static int __maybe_unused capi20_proc_show(struct seq_file *m, void *v)
 {
 	struct capidev *cdev;
-	struct list_head *l;
 
 	mutex_lock(&capidev_list_lock);
-	list_for_each(l, &capidev_list) {
-		cdev = list_entry(l, struct capidev, list);
+	list_for_each_entry(cdev, &capidev_list, list) {
 		seq_printf(m, "0 %d %lu %lu %lu %lu\n",
 			   cdev->ap.applid,
 			   cdev->ap.nrecvctlpkt,
-- 
2.34.1
Probably { } aren't needed now.
Reviewed-by: Michal Swiatkowski <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help