All of lore.kernel.org
 help / color / mirror / Atom feed
* [Kernel-janitors] [patch 2.6.8.1] list_for_each:
@ 2004-08-19 11:11 Domen Puncer
  2004-08-19 11:11 ` Domen Puncer
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Domen Puncer @ 2004-08-19 11:11 UTC (permalink / raw)
  To: kernel-janitors

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

Hi.

Change for loops with list_for_each().

Signed-off-by: Domen Puncer <domen@coderock.org>

--- c/arch/alpha/kernel/pci.c	Wed Jun 16 07:18:57 2004
+++ list_for_each/arch/alpha/kernel/pci.c	Thu Aug 15 17:58:22 2002
@@ -309,7 +309,7 @@
  		pcibios_fixup_device_resources(dev, bus);
 	} 
 
-	for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) {
+	list_for_each(ln, &bus->devices) {
 		struct pci_dev *dev = pci_dev_b(ln);
 
 		pdev_save_srm_config(dev);
@@ -411,7 +411,7 @@
 	struct list_head *ld;
 	struct pci_bus *child_bus;
 
-	for (ld = b->devices.next; ld != &b->devices; ld = ld->next) {
+	list_for_each(ld, &b->devices) {
 		struct pci_dev *dev = pci_dev_b(ld);
 		int i;
 
@@ -433,7 +433,7 @@
 {
 	struct list_head *lb;
 
-	for(lb = pci_root_buses.next; lb != &pci_root_buses; lb = lb->next) {
+	list_for_each(lb, &pci_root_buses) {
 		struct pci_bus *b = pci_bus_b(lb);
 		pcibios_claim_one_bus(b);
 	}

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Kernel-janitors] [patch 2.6.8.1] list_for_each:
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
@ 2004-08-19 11:11 ` Domen Puncer
  2004-08-19 11:11 ` [Kernel-janitors] [patch 2.6.8.1] list_for_each: arch-ia64-pci-pci.c Domen Puncer
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Domen Puncer @ 2004-08-19 11:11 UTC (permalink / raw)
  To: kernel-janitors

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

Hi.

Replace for with more readable list_for_each.
Compile tested.

Signed-off-by: Domen Puncer <domen@coderock.org>

--- c/arch/i386/pci/i386.c	Wed Jun 16 07:19:02 2004
+++ list_for_each/arch/i386/pci/i386.c	Thu Aug 15 17:58:22 2002
@@ -103,7 +103,7 @@
 	struct resource *r, *pr;
 
 	/* Depth-First Search on bus tree */
-	for (ln=bus_list->next; ln != bus_list; ln=ln->next) {
+	list_for_each(ln, bus_list) {
 		bus = pci_bus_b(ln);
 		if ((dev = bus->self)) {
 			for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Kernel-janitors] [patch 2.6.8.1] list_for_each: arch-ia64-pci-pci.c
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
  2004-08-19 11:11 ` Domen Puncer
@ 2004-08-19 11:11 ` Domen Puncer
  2004-08-19 11:11 ` [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Domen Puncer @ 2004-08-19 11:11 UTC (permalink / raw)
  To: kernel-janitors

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

Hi.

Replace for with a more readable list_for_each.

Signed-off-by: Domen Puncer <domen@coderock.org>

--- c/arch/ia64/pci/pci.c	Wed Jul 14 19:14:46 2004
+++ list_for_each/arch/ia64/pci/pci.c	Thu Aug 15 17:58:22 2002
@@ -364,7 +364,7 @@
 {
 	struct list_head *ln;
 
-	for (ln = b->devices.next; ln != &b->devices; ln = ln->next)
+	list_for_each(ln, &b->devices)
 		pcibios_fixup_device_resources(pci_dev_b(ln), b);
 
 	return;

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Kernel-janitors] [patch 2.6.8.1] list_for_each:
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
  2004-08-19 11:11 ` Domen Puncer
  2004-08-19 11:11 ` [Kernel-janitors] [patch 2.6.8.1] list_for_each: arch-ia64-pci-pci.c Domen Puncer
@ 2004-08-19 11:11 ` Domen Puncer
  2004-08-19 11:11 ` Domen Puncer
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Domen Puncer @ 2004-08-19 11:11 UTC (permalink / raw)
  To: kernel-janitors

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

Hi.

s/for/list_for_each/

Signed-off-by: Domen Puncer <domen@coderock.org>

--- c/arch/ia64/sn/io/machvec/pci_bus_cvlink.c	Wed Jul 14 19:14:46 2004
+++ list_for_each/arch/ia64/sn/io/machvec/pci_bus_cvlink.c	Thu Aug 15 17:58:22 2002
@@ -863,7 +863,7 @@
 	/*
 	 * Initialize the pci bus vertex in the pci_bus struct.
 	 */
-	for( ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) {
+	list_for_each(ln, &pci_root_buses) {
 		pci_bus = pci_bus_b(ln);
 		ret = sn_pci_fixup_bus(pci_bus);
 		if ( ret ) {

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Kernel-janitors] [patch 2.6.8.1] list_for_each:
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
                   ` (2 preceding siblings ...)
  2004-08-19 11:11 ` [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
@ 2004-08-19 11:11 ` Domen Puncer
  2004-08-19 11:11 ` Domen Puncer
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Domen Puncer @ 2004-08-19 11:11 UTC (permalink / raw)
  To: kernel-janitors

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

Hi.

s/for/list_for_each/

Signed-off-by: Domen Puncer <domen@coderock.org>

--- c/arch/ppc/kernel/pci.c	Sat Aug 14 10:56:31 2004
+++ list_for_each/arch/ppc/kernel/pci.c	Wed Aug 18 17:15:40 2004
@@ -252,7 +252,7 @@
 	struct resource *res, *pr;
 
 	/* Depth-First Search on bus tree */
-	for (ln = bus_list->next; ln != bus_list; ln=ln->next) {
+	list_for_each(ln, bus_list) {
 		bus = pci_bus_b(ln);
 		for (i = 0; i < 4; ++i) {
 			if ((res = bus->resource[i]) == NULL || !res->flags
@@ -405,8 +405,7 @@
 			return 1;
 		}
 	}
-	for (ln = parent->children.next; ln != &parent->children;
-	     ln = ln->next) {
+	list_for_each(ln, &parent->children) {
 		bus = pci_bus_b(ln);
 		for (i = 0; i < 4; ++i) {
 			if ((r = bus->resource[i]) == NULL)
@@ -421,7 +420,7 @@
 			}
 		}
 	}
-	for (ln = parent->devices.next; ln != &parent->devices; ln=ln->next) {
+	list_for_each(ln, &parent->devices) {
 		dev = pci_dev_b(ln);
 		for (i = 0; i < 6; ++i) {
 			r = &dev->resource[i];
@@ -1125,7 +1124,7 @@
 	res->end = ((res->end + __sz) / (__sz + 1)) * (__sz + 1) + __sz; \
     } while (0)
 
-	for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
+	list_for_each(ln, &bus->devices) {
 		struct pci_dev *dev = pci_dev_b(ln);
 		u16 class = dev->class >> 8;
 
@@ -1178,7 +1177,7 @@
 	if (parent_io >= 4)
 		return;
 
-	for (ln=bus->children.next; ln != &bus->children; ln=ln->next) {
+	list_for_each(ln, &bus->children) {
 		struct pci_bus *b = pci_bus_b(ln);
 		struct pci_dev *d = b->self;
 		struct pci_controller* hose = (struct pci_controller *)d->sysdata;
@@ -1254,7 +1253,7 @@
 {
 	struct list_head *ln;
 
-	for(ln=pci_root_buses.next; ln != &pci_root_buses; ln=ln->next) {
+	list_for_each(ln, &pci_root_buses) {
 		struct pci_bus *b = pci_bus_b(ln);
 		do_fixup_p2p_level(b);
 	}

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Kernel-janitors] [patch 2.6.8.1] list_for_each:
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
                   ` (3 preceding siblings ...)
  2004-08-19 11:11 ` Domen Puncer
@ 2004-08-19 11:11 ` Domen Puncer
  2004-08-19 11:11 ` Domen Puncer
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Domen Puncer @ 2004-08-19 11:11 UTC (permalink / raw)
  To: kernel-janitors

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

Hi.

s/for/list_for_each/

Signed-off-by: Domen Puncer <domen@coderock.org>

--- c/arch/ppc64/kernel/pSeries_pci.c	Sat Aug 14 10:57:26 2004
+++ list_for_each/arch/ppc64/kernel/pSeries_pci.c	Thu Aug 15 17:58:22 2002
@@ -626,7 +624,7 @@
 	if (!pci_probe_only)
 		return;
 
-	for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) {
+	list_for_each(ln, &bus->devices) {
 		struct pci_dev *dev = pci_dev_b(ln);
 		if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
 			pcibios_fixup_device_resources(dev, bus);

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Kernel-janitors] [patch 2.6.8.1] list_for_each:
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
                   ` (5 preceding siblings ...)
  2004-08-19 11:11 ` Domen Puncer
@ 2004-08-19 11:11 ` Domen Puncer
  2004-08-19 11:11 ` Domen Puncer
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Domen Puncer @ 2004-08-19 11:11 UTC (permalink / raw)
  To: kernel-janitors

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

Hi.

s/for/list_for_each/

Signed-off-by: Domen Puncer <domen@coderock.org>

--- c/arch/ppc64/kernel/pci.c	Wed Jun 16 07:19:52 2004
+++ list_for_each/arch/ppc64/kernel/pci.c	Thu Aug 15 17:58:22 2002
@@ -250,7 +250,7 @@
 	struct list_head *ld;
 	struct pci_bus *child_bus;
 
-	for (ld = b->devices.next; ld != &b->devices; ld = ld->next) {
+	list_for_each(ld, &b->devices) {
 		struct pci_dev *dev = pci_dev_b(ld);
 		int i;
 
@@ -272,7 +272,7 @@
 {
 	struct list_head *lb;
 
-	for (lb = pci_root_buses.next; lb != &pci_root_buses; lb = lb->next) {
+	list_for_each(lb, &pci_root_buses) {
 		struct pci_bus *b = pci_bus_b(lb);
 		pcibios_claim_one_bus(b);
 	}

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Kernel-janitors] [patch 2.6.8.1] list_for_each:
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
                   ` (4 preceding siblings ...)
  2004-08-19 11:11 ` Domen Puncer
@ 2004-08-19 11:11 ` Domen Puncer
  2004-08-19 11:11 ` Domen Puncer
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Domen Puncer @ 2004-08-19 11:11 UTC (permalink / raw)
  To: kernel-janitors

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

Hi.

s/for/list_for_each/

Signed-off-by: Domen Puncer <domen@coderock.org>

--- c/arch/ppc64/kernel/pci_dn.c	Sat Aug 14 10:57:26 2004
+++ list_for_each/arch/ppc64/kernel/pci_dn.c	Wed Aug 18 17:22:35 2004
@@ -199,7 +199,7 @@
 	struct list_head *ln;
 	struct pci_bus *bus;
 
-	for (ln = bus_list->next; ln != bus_list; ln = ln->next) {
+	list_for_each(ln, bus_list) {
 		bus = pci_bus_b(ln);
 		if (bus->self)
 			bus->sysdata = bus->self->sysdata;

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Kernel-janitors] [patch 2.6.8.1] list_for_each:
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
                   ` (6 preceding siblings ...)
  2004-08-19 11:11 ` Domen Puncer
@ 2004-08-19 11:11 ` Domen Puncer
  2004-08-19 11:11 ` Domen Puncer
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Domen Puncer @ 2004-08-19 11:11 UTC (permalink / raw)
  To: kernel-janitors

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

Hi.

s/for/list_for_each/

Signed-off-by: Domen Puncer <domen@coderock.org>

--- c/arch/sparc/kernel/pcic.c	Wed Jun 16 07:19:29 2004
+++ list_for_each/arch/sparc/kernel/pcic.c	Thu Aug 15 17:58:22 2002
@@ -629,8 +629,7 @@
 		return;
 	}
 
-	walk = &bus->devices;
-	for (walk = walk->next; walk != &bus->devices; walk = walk->next) {
+	list_for_each(walk, &bus->devices) {
 		struct pci_dev *dev = pci_dev_b(walk);
 
 		/*

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Kernel-janitors] [patch 2.6.8.1] list_for_each:
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
                   ` (7 preceding siblings ...)
  2004-08-19 11:11 ` Domen Puncer
@ 2004-08-19 11:11 ` Domen Puncer
  2004-08-19 11:11 ` Domen Puncer
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Domen Puncer @ 2004-08-19 11:11 UTC (permalink / raw)
  To: kernel-janitors

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

Hi.

Replace for/while loops with list_for_each*.

Signed-off-by: Domen Puncer <domen@coderock.org>

--- c/arch/sparc64/kernel/pci_common.c	Wed Jun 16 07:19:02 2004
+++ list_for_each/arch/sparc64/kernel/pci_common.c	Thu Aug 15 17:58:22 2002
@@ -15,18 +15,15 @@
  */
 void __init pci_fixup_host_bridge_self(struct pci_bus *pbus)
 {
-	struct list_head *walk = &pbus->devices;
+	struct list_head *walk;
 
-	walk = walk->next;
-	while (walk != &pbus->devices) {
+	list_for_each(walk, &pbus->devices) {
 		struct pci_dev *pdev = pci_dev_b(walk);
 
 		if (pdev->class >> 8 == PCI_CLASS_BRIDGE_HOST) {
 			pbus->self = pdev;
 			return;
 		}
-
-		walk = walk->next;
 	}
 
 	prom_printf("PCI: Critical error, cannot find host bridge PDEV.\n");
@@ -217,31 +214,21 @@
 				    struct pci_pbm_info *pbm,
 				    int prom_node)
 {
-	struct list_head *walk = &pbus->devices;
+	struct list_head *walk, *walk_next;
 
-	/* This loop is coded like this because the cookie
-	 * fillin routine can delete devices from the tree.
-	 */
-	walk = walk->next;
-	while (walk != &pbus->devices) {
+	/* This must be _safe because the cookie fillin
+	   routine can delete devices from the tree.  */
+	list_for_each_safe(walk, walk_next, &pbus->devices) {
 		struct pci_dev *pdev = pci_dev_b(walk);
-		struct list_head *walk_next = walk->next;
 
 		pdev_cookie_fillin(pbm, pdev, prom_node);
-
-		walk = walk_next;
 	}
 
-	walk = &pbus->children;
-	walk = walk->next;
-	while (walk != &pbus->children) {
+	list_for_each_safe(walk, walk_next, &pbus->children) {
 		struct pci_bus *this_pbus = pci_bus_b(walk);
 		struct pcidev_cookie *pcp = this_pbus->self->sysdata;
-		struct list_head *walk_next = walk->next;
 
 		pci_fill_in_pbm_cookies(this_pbus, pbm, pcp->prom_node);
-
-		walk = walk_next;
 	}
 }
 
@@ -431,13 +418,12 @@
 void __init pci_record_assignments(struct pci_pbm_info *pbm,
 				   struct pci_bus *pbus)
 {
-	struct list_head *walk = &pbus->devices;
+	struct list_head *walk;
 
-	for (walk = walk->next; walk != &pbus->devices; walk = walk->next)
+	list_for_each(walk, &pbus->devices)
 		pdev_record_assignments(pbm, pci_dev_b(walk));
 
-	walk = &pbus->children;
-	for (walk = walk->next; walk != &pbus->children; walk = walk->next)
+	list_for_each(walk, &pbus->children)
 		pci_record_assignments(pbm, pci_bus_b(walk));
 }
 
@@ -549,13 +535,12 @@
 void __init pci_assign_unassigned(struct pci_pbm_info *pbm,
 				  struct pci_bus *pbus)
 {
-	struct list_head *walk = &pbus->devices;
+	struct list_head *walk;
 
-	for (walk = walk->next; walk != &pbus->devices; walk = walk->next)
+	list_for_each(walk, &pbus->devices)
 		pdev_assign_unassigned(pbm, pci_dev_b(walk));
 
-	walk = &pbus->children;
-	for (walk = walk->next; walk != &pbus->children; walk = walk->next)
+	list_for_each(walk, &pbus->children)
 		pci_assign_unassigned(pbm, pci_bus_b(walk));
 }
 
@@ -797,13 +782,12 @@
 void __init pci_fixup_irq(struct pci_pbm_info *pbm,
 			  struct pci_bus *pbus)
 {
-	struct list_head *walk = &pbus->devices;
+	struct list_head *walk;
 
-	for (walk = walk->next; walk != &pbus->devices; walk = walk->next)
+	list_for_each(walk, &pbus->devices)
 		pdev_fixup_irq(pci_dev_b(walk));
 
-	walk = &pbus->children;
-	for (walk = walk->next; walk != &pbus->children; walk = walk->next)
+	list_for_each(walk, &pbus->children)
 		pci_fixup_irq(pbm, pci_bus_b(walk));
 }
 
@@ -906,9 +890,8 @@
 		goto out;
 	}
 
-	walk = &pbus->devices;
 	all_are_66mhz = 1;
-	for (walk = walk->next; walk != &pbus->devices; walk = walk->next) {
+	list_for_each(walk, &pbus->devices) {
 		struct pci_dev *pdev = pci_dev_b(walk);
 
 		pci_read_config_word(pdev, PCI_STATUS, &status);
@@ -929,16 +912,15 @@
 void pci_setup_busmastering(struct pci_pbm_info *pbm,
 			    struct pci_bus *pbus)
 {
-	struct list_head *walk = &pbus->devices;
+	struct list_head *walk;
 	int is_66mhz;
 
 	is_66mhz = pbm->is_66mhz_capable && pbm->all_devs_66mhz;
 
-	for (walk = walk->next; walk != &pbus->devices; walk = walk->next)
+	list_for_each(walk, &pbus->devices)
 		pdev_setup_busmastering(pci_dev_b(walk), is_66mhz);
 
-	walk = &pbus->children;
-	for (walk = walk->next; walk != &pbus->children; walk = walk->next)
+	list_for_each(walk, &pbus->children)
 		pci_setup_busmastering(pbm, pci_bus_b(walk));
 }
 
@@ -987,9 +969,9 @@
 			       struct pci_pbm_info *pbm,
 			       struct pci_bus *pbus)
 {
-	struct list_head *walk = &pbus->devices;
+	struct list_head *walk;
 
-	for (walk = walk->next; walk != &pbus->devices; walk = walk->next) {
+	list_for_each(walk, &pbus->devices) {
 		struct pci_dev *pdev = pci_dev_b(walk);
 		u16 status, error_bits;
 
@@ -1005,8 +987,7 @@
 		}
 	}
 
-	walk = &pbus->children;
-	for (walk = walk->next; walk != &pbus->children; walk = walk->next)
+	list_for_each(walk, &pbus->children)
 		pci_scan_for_target_abort(p, pbm, pci_bus_b(walk));
 }
 
@@ -1014,9 +995,9 @@
 			       struct pci_pbm_info *pbm,
 			       struct pci_bus *pbus)
 {
-	struct list_head *walk = &pbus->devices;
+	struct list_head *walk;
 
-	for (walk = walk->next; walk != &pbus->devices; walk = walk->next) {
+	list_for_each(walk, &pbus->devices) {
 		struct pci_dev *pdev = pci_dev_b(walk);
 		u16 status, error_bits;
 
@@ -1031,8 +1012,7 @@
 		}
 	}
 
-	walk = &pbus->children;
-	for (walk = walk->next; walk != &pbus->children; walk = walk->next)
+	list_for_each(walk, &pbus->children)
 		pci_scan_for_master_abort(p, pbm, pci_bus_b(walk));
 }
 
@@ -1040,9 +1020,9 @@
 			       struct pci_pbm_info *pbm,
 			       struct pci_bus *pbus)
 {
-	struct list_head *walk = &pbus->devices;
+	struct list_head *walk;
 
-	for (walk = walk->next; walk != &pbus->devices; walk = walk->next) {
+	list_for_each(walk, &pbus->devices) {
 		struct pci_dev *pdev = pci_dev_b(walk);
 		u16 status, error_bits;
 
@@ -1058,7 +1038,6 @@
 		}
 	}
 
-	walk = &pbus->children;
-	for (walk = walk->next; walk != &pbus->children; walk = walk->next)
+	list_for_each(walk, &pbus->children)
 		pci_scan_for_parity_error(p, pbm, pci_bus_b(walk));
 }

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Kernel-janitors] [patch 2.6.8.1] list_for_each:
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
                   ` (8 preceding siblings ...)
  2004-08-19 11:11 ` Domen Puncer
@ 2004-08-19 11:11 ` Domen Puncer
  2004-08-19 11:11 ` Domen Puncer
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Domen Puncer @ 2004-08-19 11:11 UTC (permalink / raw)
  To: kernel-janitors

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

Hi.

s/for/list_for_each//

Signed-off-by: Domen Puncer <domen@coderock.org>

--- c/arch/sparc64/kernel/pci_sabre.c	Wed Jun 16 07:20:16 2004
+++ list_for_each/arch/sparc64/kernel/pci_sabre.c	Thu Aug 15 17:58:22 2002
@@ -1113,9 +1113,9 @@
 
 static void __init apb_init(struct pci_controller_info *p, struct pci_bus *sabre_bus)
 {
-	struct list_head *walk = &sabre_bus->devices;
+	struct list_head *walk;
 
-	for (walk = walk->next; walk != &sabre_bus->devices; walk = walk->next) {
+	list_for_each(walk, &sabre_bus->devices) {
 		struct pci_dev *pdev = pci_dev_b(walk);
 
 		if (pdev->vendor == PCI_VENDOR_ID_SUN &&
@@ -1217,8 +1217,7 @@
 
 	sabres_scanned = 0;
 
-	walk = &sabre_bus->children;
-	for (walk = walk->next; walk != &sabre_bus->children; walk = walk->next) {
+	list_for_each(walk, &sabre_bus->children) {
 		struct pci_bus *pbus = pci_bus_b(walk);
 
 		if (pbus->number == p->pbm_A.pci_first_busno) {

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Kernel-janitors] [patch 2.6.8.1] list_for_each:
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
                   ` (9 preceding siblings ...)
  2004-08-19 11:11 ` Domen Puncer
@ 2004-08-19 11:11 ` Domen Puncer
  2004-08-19 11:11 ` Domen Puncer
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Domen Puncer @ 2004-08-19 11:11 UTC (permalink / raw)
  To: kernel-janitors

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

Hi.

s/for/list_for_each/
Compile tested.

Signed-off-by: Domen Puncer <domen@coderock.org>

--- c/drivers/char/drm/radeon_mem.c	Fri Jul 23 16:00:18 2004
+++ list_for_each/drivers/char/drm/radeon_mem.c	Thu Aug 15 17:58:22 2002
@@ -85,7 +85,7 @@
 	struct mem_block *p;
 	int mask = (1 << align2)-1;
 
-	for (p = heap->next ; p != heap ; p = p->next) {
+	list_for_each(p, heap) {
 		int start = (p->start + mask) & ~mask;
 		if (p->filp == 0 && start + size <= p->start + p->size)
 			return split_block( p, start, size, filp );
@@ -98,7 +98,7 @@
 {
 	struct mem_block *p;
 
-	for (p = heap->next ; p != heap ; p = p->next) 
+	list_for_each(p, heap)
 		if (p->start == start)
 			return p;
 
@@ -166,7 +166,7 @@
 	if (!heap || !heap->next)
 		return;
 
-	for (p = heap->next ; p != heap ; p = p->next) {
+	list_for_each(p, heap) {
 		if (p->filp == filp) 
 			p->filp = NULL;
 	}
@@ -174,7 +174,7 @@
 	/* Assumes a single contiguous range.  Needs a special filp in
 	 * 'heap' to stop it being subsumed.
 	 */
-	for (p = heap->next ; p != heap ; p = p->next) {
+	list_for_each(p, heap) {
 		while (p->filp == 0 && p->next->filp == 0) {
 			struct mem_block *q = p->next;
 			p->size += q->size;

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Kernel-janitors] [patch 2.6.8.1] list_for_each:
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
                   ` (10 preceding siblings ...)
  2004-08-19 11:11 ` Domen Puncer
@ 2004-08-19 11:11 ` Domen Puncer
  2004-08-19 11:11 ` [Kernel-janitors] [patch 2.6.8.1] list_for_each: net-ipv6-ip6_fib.c Domen Puncer
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Domen Puncer @ 2004-08-19 11:11 UTC (permalink / raw)
  To: kernel-janitors

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

Hi.

s/for/list_for_each/
Compile tested.

Signed-off-by: Domen Puncer <domen@coderock.org>

--- c/drivers/net/tulip/de4x5.c	Fri Jul 23 16:00:23 2004
+++ list_for_each/drivers/net/tulip/de4x5.c	Thu Aug 19 12:50:26 2004
@@ -2143,9 +2143,9 @@
     u_long iobase = 0;                     /* Clear upper 32 bits in Alphas */
     int i, j, cfrv;
     struct de4x5_private *lp = netdev_priv(dev);
-    struct list_head *walk = &pdev->bus_list;
+    struct list_head *walk;
 
-    for (walk = walk->next; walk != &pdev->bus_list; walk = walk->next) {
+    list_for_each(walk, &pdev->bus_list) {
 	struct pci_dev *this_dev = pci_dev_b(walk);
 
 	/* Skip the pci_bus list entry */

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Kernel-janitors] [patch 2.6.8.1] list_for_each: net-ipv6-ip6_fib.c
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
                   ` (11 preceding siblings ...)
  2004-08-19 11:11 ` Domen Puncer
@ 2004-08-19 11:11 ` Domen Puncer
  2004-08-19 14:57 ` [Kernel-janitors] [patch 2.6.8.1] list_for_each: maximilian attems
  2004-08-20  5:29 ` Christoph Hellwig
  14 siblings, 0 replies; 16+ messages in thread
From: Domen Puncer @ 2004-08-19 11:11 UTC (permalink / raw)
  To: kernel-janitors

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

Hi.

s/for/list_for_each/
Compile tested.

Signed-off-by: Domen Puncer <domen@coderock.org>

--- c/net/ipv6/ip6_fib.c	Sat Aug 14 10:56:44 2004
+++ list_for_each/net/ipv6/ip6_fib.c	Thu Aug 19 12:58:37 2004
@@ -99,7 +99,7 @@
 	.next	= &fib6_walker_list, 
 };
 
-#define FOR_WALKERS(w) for ((w)=fib6_walker_list.next; (w) != &fib6_walker_list; (w)=(w)->next)
+#define FOR_WALKERS(w) list_for_each((w), &fib6_walker_list)
 
 static __inline__ u32 fib6_new_sernum(void)
 {

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Kernel-janitors] [patch 2.6.8.1] list_for_each:
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
                   ` (12 preceding siblings ...)
  2004-08-19 11:11 ` [Kernel-janitors] [patch 2.6.8.1] list_for_each: net-ipv6-ip6_fib.c Domen Puncer
@ 2004-08-19 14:57 ` maximilian attems
  2004-08-20  5:29 ` Christoph Hellwig
  14 siblings, 0 replies; 16+ messages in thread
From: maximilian attems @ 2004-08-19 14:57 UTC (permalink / raw)
  To: kernel-janitors

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

On Thu, 19 Aug 2004, Domen Puncer wrote:

> s/for/list_for_each/
> Compile tested.
> 

thanks all applied


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Kernel-janitors] [patch 2.6.8.1] list_for_each:
  2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
                   ` (13 preceding siblings ...)
  2004-08-19 14:57 ` [Kernel-janitors] [patch 2.6.8.1] list_for_each: maximilian attems
@ 2004-08-20  5:29 ` Christoph Hellwig
  14 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2004-08-20  5:29 UTC (permalink / raw)
  To: kernel-janitors

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

On Thu, Aug 19, 2004 at 01:11:18PM +0200, Domen Puncer wrote:
> Hi.
> 
> Change for loops with list_for_each().

Please go directly to list_for_each_entry in all your patches where possible.

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2004-08-20  5:29 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-19 11:11 [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
2004-08-19 11:11 ` Domen Puncer
2004-08-19 11:11 ` [Kernel-janitors] [patch 2.6.8.1] list_for_each: arch-ia64-pci-pci.c Domen Puncer
2004-08-19 11:11 ` [Kernel-janitors] [patch 2.6.8.1] list_for_each: Domen Puncer
2004-08-19 11:11 ` Domen Puncer
2004-08-19 11:11 ` Domen Puncer
2004-08-19 11:11 ` Domen Puncer
2004-08-19 11:11 ` Domen Puncer
2004-08-19 11:11 ` Domen Puncer
2004-08-19 11:11 ` Domen Puncer
2004-08-19 11:11 ` Domen Puncer
2004-08-19 11:11 ` Domen Puncer
2004-08-19 11:11 ` Domen Puncer
2004-08-19 11:11 ` [Kernel-janitors] [patch 2.6.8.1] list_for_each: net-ipv6-ip6_fib.c Domen Puncer
2004-08-19 14:57 ` [Kernel-janitors] [patch 2.6.8.1] list_for_each: maximilian attems
2004-08-20  5:29 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.