public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: domen@coderock.org
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, domen@coderock.org,
	hannal@us.ibm.com, janitor@sternwelten.at
Subject: [patch 03/11] arch/i386/pci/i386.c: Use new for_each_pci_dev macro
Date: Wed, 12 Jan 2005 00:34:58 +0100	[thread overview]
Message-ID: <20050111233458.9B8E01F228@trashy.coderock.org> (raw)




As requested by Christoph Hellwig I've created a new macro called
for_each_pci_dev. It is a wrapper for this common use of pci_get/find_device:

(while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL))

This macro will return the pci_dev *for all pci devices.  Here is the first patch I 
used to test this macro with. Compiled and booted on my T23. There will be
53 more patches using this new macro.

Hanna Linder
IBM Linux Technology Center

Signed-off-by: Hanna Linder <hannal@us.ibm.com>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>

---

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


 kj-domen/arch/i386/pci/i386.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -puN arch/i386/pci/i386.c~for-each-pci-dev-arch_i386_pci_i386 arch/i386/pci/i386.c
--- kj/arch/i386/pci/i386.c~for-each-pci-dev-arch_i386_pci_i386	2005-01-10 17:59:57.000000000 +0100
+++ kj-domen/arch/i386/pci/i386.c	2005-01-10 17:59:57.000000000 +0100
@@ -124,7 +124,7 @@ static void __init pcibios_allocate_reso
 	u16 command;
 	struct resource *r, *pr;
 
-	while ((dev = pci_get_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];
@@ -168,7 +168,7 @@ static int __init pcibios_assign_resourc
 	int idx;
 	struct resource *r;
 
-	while ((dev = pci_get_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 */
_

             reply	other threads:[~2005-01-12  0:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-11 23:34 domen [this message]
2005-01-12  0:46 ` [patch 03/11] arch/i386/pci/i386.c: Use new for_each_pci_dev macro Dave Jones
2005-01-12  1:16   ` Greg KH

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=20050111233458.9B8E01F228@trashy.coderock.org \
    --to=domen@coderock.org \
    --cc=akpm@osdl.org \
    --cc=hannal@us.ibm.com \
    --cc=janitor@sternwelten.at \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox