dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma-buf/sync_debug: convert to list_for_each_entry()
@ 2020-02-23  5:37 qiwuchen55
  0 siblings, 0 replies; only message in thread
From: qiwuchen55 @ 2020-02-23  5:37 UTC (permalink / raw)
  To: sumit.semwal, gustavo; +Cc: linaro-mm-sig, chenqiwu, dri-devel, linux-media

From: chenqiwu <chenqiwu@xiaomi.com>

Convert list_for_each() to list_for_each_entry() to simplify code.

Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
---
 drivers/dma-buf/sync_debug.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c
index 101394f..05cfeee 100644
--- a/drivers/dma-buf/sync_debug.c
+++ b/drivers/dma-buf/sync_debug.c
@@ -106,13 +106,12 @@ static void sync_print_fence(struct seq_file *s,
 
 static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj)
 {
-	struct list_head *pos;
+	struct sync_pt *pt;
 
 	seq_printf(s, "%s: %d\n", obj->name, obj->value);
 
 	spin_lock_irq(&obj->lock);
-	list_for_each(pos, &obj->pt_list) {
-		struct sync_pt *pt = container_of(pos, struct sync_pt, link);
+	list_for_each_entry(pt, &obj->pt_list, link) {
 		sync_print_fence(s, &pt->base, false);
 	}
 	spin_unlock_irq(&obj->lock);
@@ -140,16 +139,13 @@ static void sync_print_sync_file(struct seq_file *s,
 
 static int sync_info_debugfs_show(struct seq_file *s, void *unused)
 {
-	struct list_head *pos;
+	struct sync_timeline *obj;
+	struct sync_file *sync_file;
 
 	seq_puts(s, "objs:\n--------------\n");
 
 	spin_lock_irq(&sync_timeline_list_lock);
-	list_for_each(pos, &sync_timeline_list_head) {
-		struct sync_timeline *obj =
-			container_of(pos, struct sync_timeline,
-				     sync_timeline_list);
-
+	list_for_each_entry(obj, &sync_timeline_list_head, sync_timeline_list) {
 		sync_print_obj(s, obj);
 		seq_putc(s, '\n');
 	}
@@ -158,10 +154,7 @@ static int sync_info_debugfs_show(struct seq_file *s, void *unused)
 	seq_puts(s, "fences:\n--------------\n");
 
 	spin_lock_irq(&sync_file_list_lock);
-	list_for_each(pos, &sync_file_list_head) {
-		struct sync_file *sync_file =
-			container_of(pos, struct sync_file, sync_file_list);
-
+	list_for_each_entry(sync_file, &sync_file_list_head, sync_file_list) {
 		sync_print_sync_file(s, sync_file);
 		seq_putc(s, '\n');
 	}
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-24  9:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-23  5:37 [PATCH] dma-buf/sync_debug: convert to list_for_each_entry() qiwuchen55

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).