lkml.org 
[lkml]   [2004]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] PCI fixes for 2.6.10-rc2
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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.048 / U:1.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site