From: Domen Puncer <domen@coderock.org>
To: kernel-janitors@vger.kernel.org
Subject: [Kernel-janitors] [patch 2.6.8.1] list_for_each:
Date: Thu, 19 Aug 2004 11:11:26 +0000 [thread overview]
Message-ID: <20040819111126.GA3523@masina.coderock.org> (raw)
In-Reply-To: <20040819111118.GA3469@masina.coderock.org>
[-- 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
next prev parent reply other threads:[~2004-08-19 11:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040819111126.GA3523@masina.coderock.org \
--to=domen@coderock.org \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.