public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI fixes for 2.6.10-rc2
Date: Fri, 19 Nov 2004 13:57:00 -0800	[thread overview]
Message-ID: <20041119215659.GC15863@kroah.com> (raw)
In-Reply-To: <20041119215640.GB15863@kroah.com>

ChangeSet 1.2165, 2004/11/19 10:02:07-08:00, eike-hotplug@sf-tec.de

[PATCH] PCI Hotplug: clean up rpaphp_pci.c::rpaphp_find_pci_dev

this patch improves rpaphp_find_pci_dev. First it uses the for_each_pci_dev
macro instead of the while loop, making this hotplug safe (which is a good
idea in a hotplug driver, isn't it?). Then it removes retval_dev. retval_dev
is set to the found device when something is found, NULL otherwise. If
nothing is found dev will be NULL at the end of the loop anyway and the
found device if we found something, no need for retval_dev then. And a very
small coding style fix.

Signed-off-by: Rolf Eike Beer <eike-hotplug@sf-tec.de>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/pci/hotplug/rpaphp_pci.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)


diff -Nru a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
--- a/drivers/pci/hotplug/rpaphp_pci.c	2004-11-19 13:20:10 -08:00
+++ b/drivers/pci/hotplug/rpaphp_pci.c	2004-11-19 13:20:10 -08:00
@@ -31,18 +31,17 @@
 
 struct pci_dev *rpaphp_find_pci_dev(struct device_node *dn)
 {
-	struct pci_dev *retval_dev = NULL, *dev = NULL;
+	struct pci_dev *dev = NULL;
 	char bus_id[BUS_ID_SIZE];
 
-	sprintf(bus_id, "%04x:%02x:%02x.%d",dn->phb->global_number,
+	sprintf(bus_id, "%04x:%02x:%02x.%d", dn->phb->global_number,
 		dn->busno, PCI_SLOT(dn->devfn), PCI_FUNC(dn->devfn));
-	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+	for_each_pci_dev(dev) {
 		if (!strcmp(pci_name(dev), bus_id)) {
-			retval_dev = dev;
 			break;
 		}
 	}
-	return retval_dev;
+	return dev;
 }
 
 EXPORT_SYMBOL_GPL(rpaphp_find_pci_dev);

  reply	other threads:[~2004-11-19 22:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-19 21:56 [BK PATCH] PCI fixes for 2.6.10-rc2 Greg KH
2004-11-19 21:56 ` [PATCH] " Greg KH
2004-11-19 21:57   ` Greg KH [this message]
2004-11-19 21:57     ` Greg KH
2004-11-19 21:57       ` 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=20041119215659.GC15863@kroah.com \
    --to=greg@kroah.com \
    --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