Re: [Kernel-janitors] [PATCH 2.6][1/12] arch/ppc/kernel/pci.c replace pci_find_device with pci_get_device

From: Hanna Linder
Date: Wed Oct 06 2004 - 16:32:13 EST


--On Tuesday, October 05, 2004 10:44:43 AM +0100 Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:

> what about adding a for_each_pci_dev macro that nicely hides these AND_ID
> iterations?
>

OK. How about this? Following are two patches that I used to test this
new macro on my T23. I found roughly 54 other places this macro can
be used.

Hanna Linder
IBM Linux Technology Center

Signed-off-by: Hanna Linder <hannal@xxxxxxxxxx>

---

diff -Nrup linux-2.6.9-rc3-mm2cln/include/linux/pci.h linux-2.6.9-rc3-mm2patch/include/linux/pci.h
--- linux-2.6.9-rc3-mm2cln/include/linux/pci.h 2004-10-04 11:38:51.000000000 -0700
+++ linux-2.6.9-rc3-mm2patch/include/linux/pci.h 2004-10-05 15:56:26.000000000 -0700
@@ -548,6 +548,7 @@ struct pci_dev {
#define pci_dev_g(n) list_entry(n, struct pci_dev, global_list)
#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list)
#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
+#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)

/*
* For PCI devices, the region numbers are assigned this way:

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/