mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Clean up list head usage in sysrq.c
@ 2003-02-21 23:24 Brian Gerst
  0 siblings, 0 replies; only message in thread
From: Brian Gerst @ 2003-02-21 23:24 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux-Kernel

[-- Attachment #1: Type: text/plain, Size: 68 bytes --]

Use list_for_each_entry() instead of open code.

--
				Brian Gerst

[-- Attachment #2: sysrqlist-1 --]
[-- Type: text/plain, Size: 1364 bytes --]

diff -urN linux-2.5.62-bk6/drivers/char/sysrq.c linux/drivers/char/sysrq.c
--- linux-2.5.62-bk6/drivers/char/sysrq.c	2003-01-13 16:20:50.000000000 -0500
+++ linux/drivers/char/sysrq.c	2003-02-21 10:36:41.000000000 -0500
@@ -153,7 +153,7 @@
 
 	if (remount_flag) { /* Remount R/O */
 		int ret, flags;
-		struct list_head *p;
+		struct file *file;
 
 		if (sb->s_flags & MS_RDONLY) {
 			printk("R/O\n");
@@ -161,8 +161,7 @@
 		}
 
 		file_list_lock();
-		for (p = sb->s_files.next; p != &sb->s_files; p = p->next) {
-			struct file *file = list_entry(p, struct file, f_list);
+		list_for_each_entry(file, &sb->s_files, f_list) {
 			if (file->f_dentry && file_count(file)
 				&& S_ISREG(file->f_dentry->d_inode->i_mode))
 				file->f_mode &= ~2;
@@ -205,15 +204,11 @@
 	remount_flag = (emergency_sync_scheduled == EMERG_REMOUNT);
 	emergency_sync_scheduled = 0;
 
-	for (sb = sb_entry(super_blocks.next);
-	     sb != sb_entry(&super_blocks); 
-	     sb = sb_entry(sb->s_list.next))
+	list_for_each_entry(sb, &super_blocks, s_list)
 		if (sb->s_bdev && is_local_disk(sb->s_bdev))
 			go_sync(sb, remount_flag);
 
-	for (sb = sb_entry(super_blocks.next);
-	     sb != sb_entry(&super_blocks); 
-	     sb = sb_entry(sb->s_list.next))
+	list_for_each_entry(sb, &super_blocks, s_list)
 		if (sb->s_bdev && !is_local_disk(sb->s_bdev))
 			go_sync(sb, remount_flag);
 

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

only message in thread, other threads:[~2003-02-21 23:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-21 23:24 [PATCH] Clean up list head usage in sysrq.c Brian Gerst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®