diff mbox series

dma-buf/sync_debug: convert to list_for_each_entry()

Message ID 1582436240-14113-1-git-send-email-qiwuchen55@gmail.com
State New
Headers show
Series dma-buf/sync_debug: convert to list_for_each_entry() | expand

Commit Message

qiwuchen55@gmail.com Feb. 23, 2020, 5:37 a.m. UTC
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 mbox series

Patch

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');
 	}