[Kernel-janitors] [patch] use list_for_each in fs/jffs/intrep.c

maximilian attems <[email protected]>
Newsgroups gmane.linux.kernel.janitors,gmane.linux.file-systems.jffs
Message-ID <[email protected]>

Use list_for_each() where applicable
From: Domen Puncer <[email protected]>
- for (list = ymf_devs.next; list != &ymf_devs; list = list->next) {
+ list_for_each(list, &ymf_devs) {
pure cosmetic change, defined as a preprocessor macro in:
include/linux/list.h

please apply
maks



--- linux-2.6.0-test5/fs/jffs/intrep.c	Mon Sep  8 21:50:07 2003
+++ linux/fs/jffs/intrep.c	Wed Sep 10 12:13:24 2003
@@ -1624,7 +1624,7 @@
 
 	D3(printk("jffs_find_file(): ino: %u\n", ino));
 
-	for (tmp = c->hash[i].next; tmp != &c->hash[i]; tmp = tmp->next) {
+	list_for_each(tmp, &c->hash[i]) {
 		f = list_entry(tmp, struct jffs_file, hash);
 		if (ino != f->ino)
 			continue;
@@ -2022,11 +2022,10 @@
 
 	for (pos = 0; pos < c->hash_len; pos++) {
 		struct list_head *p, *next;
-		for (p = c->hash[pos].next; p != &c->hash[pos]; p = next) {
-			/* We need a reference to the next file in the
-			   list because `func' might remove the current
-			   file `f'.  */
-			next = p->next;
+
+		/* We must do _safe, because 'func' might remove the
+		   current file 'f' from the list.  */
+		list_for_each_safe(p, next, &c->hash[pos]) {
 			r = func(list_entry(p, struct jffs_file, hash));
 			if (r < 0)
 				return r;
@@ -2591,7 +2590,7 @@
 	printk("JFFS: Dumping the file system's hash table...\n");
 	for (i = 0; i < c->hash_len; i++) {
 		struct list_head *p;
-		for (p = c->hash[i].next; p != &c->hash[i]; p = p->next) {
+		list_for_each(p, &c->hash[i]) {
 			struct jffs_file *f=list_entry(p,struct jffs_file,hash);
 			printk("*** c->hash[%u]: \"%s\" "
 			       "(ino: %u, pino: %u)\n",

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
signature.asc (application/pgp-signature, 232 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE/XzbJ6//kSTNjoX0RAhfKAJ9hjm6+PytNBLtWWx2JUjRVFJMILQCfWHe3
pLgtQKK5wysMYtWihP0BDJE=
=i7VL
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.