mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2.6][1/12] arch/ppc/kernel/pci.c replace pci_find_device with pci_get_device
@ 2004-10-04 22:58 Hanna Linder
  2004-10-05  9:44 ` [Kernel-janitors] " Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Hanna Linder @ 2004-10-04 22:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, greg, hannal, paulus, benh


As pci_find_device is going away I have replaced this call with pci_get_device.
If someone with a PPC system could verify it I would appreciate it. This is the only
one in ppc/kernel all the others are under ppc/platform. There will be 12 total.

Hanna Linder
IBM Linux Technology Center

Signed-off-by: Hanna Linder <hannal@us.ibm.com>

---

diff -Nrup linux-2.6.9-rc3-mm2cln/arch/ppc/kernel/pci.c linux-2.6.9-rc3-mm2patch/arch/ppc/kernel/pci.c
--- linux-2.6.9-rc3-mm2cln/arch/ppc/kernel/pci.c	2004-10-04 11:38:04.000000000 -0700
+++ linux-2.6.9-rc3-mm2patch/arch/ppc/kernel/pci.c	2004-10-04 14:36:09.000000000 -0700
@@ -503,7 +503,7 @@ pcibios_allocate_resources(int pass)
 	u16 command;
 	struct resource *r;
 
-	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+	while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
 		pci_read_config_word(dev, PCI_COMMAND, &command);
 		for (idx = 0; idx < 6; idx++) {
 			r = &dev->resource[idx];
@@ -540,7 +540,7 @@ pcibios_assign_resources(void)
 	int idx;
 	struct resource *r;
 
-	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+	while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
 		int class = dev->class >> 8;
 
 		/* Don't touch classless devices and host bridges */
@@ -866,7 +866,7 @@ pci_device_from_OF_node(struct device_no
 	 */
 	if (!pci_to_OF_bus_map)
 		return 0;
-	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+	while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
 		if (pci_to_OF_bus_map[dev->bus->number] != *bus)
 			continue;
 		if (dev->devfn != *devfn)


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

* Re: [Kernel-janitors] [PATCH 2.6][1/12] arch/ppc/kernel/pci.c replace pci_find_device with pci_get_device
  2004-10-04 22:58 [PATCH 2.6][1/12] arch/ppc/kernel/pci.c replace pci_find_device with pci_get_device Hanna Linder
@ 2004-10-05  9:44 ` Christoph Hellwig
  2004-10-06 20:23   ` Hanna Linder
  2004-10-06 23:10   ` Hanna Linder
  0 siblings, 2 replies; 5+ messages in thread
From: Christoph Hellwig @ 2004-10-05  9:44 UTC (permalink / raw)
  To: Hanna Linder; +Cc: linux-kernel, kernel-janitors, benh, paulus, greg

On Mon, Oct 04, 2004 at 03:58:01PM -0700, Hanna Linder wrote:
> 
> As pci_find_device is going away I have replaced this call with pci_get_device.
> If someone with a PPC system could verify it I would appreciate it. This is the only
> one in ppc/kernel all the others are under ppc/platform. There will be 12 total.

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

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

* Re: [Kernel-janitors] [PATCH 2.6][1/12] arch/ppc/kernel/pci.c replace pci_find_device with pci_get_device
  2004-10-05  9:44 ` [Kernel-janitors] " Christoph Hellwig
@ 2004-10-06 20:23   ` Hanna Linder
  2004-10-07 13:17     ` Christoph Hellwig
  2004-10-06 23:10   ` Hanna Linder
  1 sibling, 1 reply; 5+ messages in thread
From: Hanna Linder @ 2004-10-06 20:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Hanna Linder, linux-kernel, kernel-janitors, benh, paulus, greg

--On Tuesday, October 05, 2004 10:44:43 AM +0100 Christoph Hellwig <hch@infradead.org> 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@us.ibm.com>

---

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:


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

* Re: [Kernel-janitors] [PATCH 2.6][1/12] arch/ppc/kernel/pci.c replace pci_find_device with pci_get_device
  2004-10-05  9:44 ` [Kernel-janitors] " Christoph Hellwig
  2004-10-06 20:23   ` Hanna Linder
@ 2004-10-06 23:10   ` Hanna Linder
  1 sibling, 0 replies; 5+ messages in thread
From: Hanna Linder @ 2004-10-06 23:10 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Hanna Linder, linux-kernel, kernel-janitors, benh, paulus, greg

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

> On Mon, Oct 04, 2004 at 03:58:01PM -0700, Hanna Linder wrote:
>> 
>> As pci_find_device is going away I have replaced this call with pci_get_device.
>> If someone with a PPC system could verify it I would appreciate it. This is the only
>> one in ppc/kernel all the others are under ppc/platform. There will be 12 total.
> 
> what about adding a for_each_pci_dev macro that nicely hides these AND_ID
> iterations?
> 

Here is a re-roll of the original patch now with the new for_each_pci_dev macro instead.

Hanna Linder
IBM Linux Technology Center

Signed-off-by: Hanna Linder <hannal@us.ibm.com>

---

diff -Nrup linux-2.6.9-rc3-mm2cln/arch/ppc/kernel/pci.c linux-2.6.9-rc3-mm2patch/arch/ppc/kernel/pci.c
--- linux-2.6.9-rc3-mm2cln/arch/ppc/kernel/pci.c	2004-10-04 11:38:04.000000000 -0700
+++ linux-2.6.9-rc3-mm2patch/arch/ppc/kernel/pci.c	2004-10-06 16:03:20.302316368 -0700
@@ -503,7 +503,7 @@ pcibios_allocate_resources(int pass)
 	u16 command;
 	struct resource *r;
 
-	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+	for_each_pci_dev(dev) {
 		pci_read_config_word(dev, PCI_COMMAND, &command);
 		for (idx = 0; idx < 6; idx++) {
 			r = &dev->resource[idx];
@@ -540,7 +540,7 @@ pcibios_assign_resources(void)
 	int idx;
 	struct resource *r;
 
-	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+	for_each_pci_dev(dev) {
 		int class = dev->class >> 8;
 
 		/* Don't touch classless devices and host bridges */
@@ -866,7 +866,7 @@ pci_device_from_OF_node(struct device_no
 	 */
 	if (!pci_to_OF_bus_map)
 		return 0;
-	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+	for_each_pci_dev(dev) {
 		if (pci_to_OF_bus_map[dev->bus->number] != *bus)
 			continue;
 		if (dev->devfn != *devfn)



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

* Re: [Kernel-janitors] [PATCH 2.6][1/12] arch/ppc/kernel/pci.c replace pci_find_device with pci_get_device
  2004-10-06 20:23   ` Hanna Linder
@ 2004-10-07 13:17     ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2004-10-07 13:17 UTC (permalink / raw)
  To: Hanna Linder
  Cc: Christoph Hellwig, linux-kernel, kernel-janitors, benh, paulus, greg

On Wed, Oct 06, 2004 at 01:23:21PM -0700, Hanna Linder wrote:
> --On Tuesday, October 05, 2004 10:44:43 AM +0100 Christoph Hellwig <hch@infradead.org> 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.

Looks good to me

---end quoted text---

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

end of thread, other threads:[~2004-10-07 13:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-04 22:58 [PATCH 2.6][1/12] arch/ppc/kernel/pci.c replace pci_find_device with pci_get_device Hanna Linder
2004-10-05  9:44 ` [Kernel-janitors] " Christoph Hellwig
2004-10-06 20:23   ` Hanna Linder
2004-10-07 13:17     ` Christoph Hellwig
2004-10-06 23:10   ` Hanna Linder

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®