[PATCH 2/2] PCI Hotplug/powerpc: more removal of duplicated code

linas linas at austin.ibm.com
Fri Dec 2 11:59:58 EST 2005


Greg, 
Please apply! 

John Rose, 
Please review this code!

--linas

The RPAPHP code contains two routines that appear to be gratuitous copies
of very similar pci code.  In particular,

   rpaphp_claim_resource ~~ pci_claim_resource 
      (there is a minor, non-functional difference)

   rpadlpar_claim_one_bus == pcibios_claim_one_bus 
      (the code is identical)

This patch removes the rpaphp versions of the code.

Signed-off-by: Linas Vepstas <linas at austin.ibm.com>

Index: linux-2.6.15-rc3-mm1/drivers/pci/hotplug/rpaphp_pci.c
===================================================================
--- linux-2.6.15-rc3-mm1.orig/drivers/pci/hotplug/rpaphp_pci.c	2005-12-01 18:51:18.686712139 -0600
+++ linux-2.6.15-rc3-mm1/drivers/pci/hotplug/rpaphp_pci.c	2005-12-01 18:51:26.357635444 -0600
@@ -62,28 +62,6 @@
 }
 EXPORT_SYMBOL_GPL(rpaphp_find_pci_bus);
 
-int rpaphp_claim_resource(struct pci_dev *dev, int resource)
-{
-	struct resource *res = &dev->resource[resource];
-	struct resource *root = pci_find_parent_resource(dev, res);
-	char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge";
-	int err = -EINVAL;
-
-	if (root != NULL) {
-		err = request_resource(root, res);
-	}
-
-	if (err) {
-		err("PCI: %s region %d of %s %s [%lx:%lx]\n",
-		    root ? "Address space collision on" :
-		    "No parent found for",
-		    resource, dtype, pci_name(dev), res->start, res->end);
-	}
-	return err;
-}
-
-EXPORT_SYMBOL_GPL(rpaphp_claim_resource);
-
 static int rpaphp_get_sensor_state(struct slot *slot, int *state)
 {
 	int rc;
@@ -177,7 +155,7 @@
 
 				if (r->parent || !r->start || !r->flags)
 					continue;
-				rpaphp_claim_resource(dev, i);
+				pci_claim_resource(dev, i);
 			}
 		}
 	}
Index: linux-2.6.15-rc3-mm1/drivers/pci/hotplug/rpadlpar_core.c
===================================================================
--- linux-2.6.15-rc3-mm1.orig/drivers/pci/hotplug/rpadlpar_core.c	2005-12-01 18:51:18.687711999 -0600
+++ linux-2.6.15-rc3-mm1/drivers/pci/hotplug/rpadlpar_core.c	2005-12-01 18:51:26.358635304 -0600
@@ -112,28 +112,6 @@
         return NULL;
 }
 
-static void rpadlpar_claim_one_bus(struct pci_bus *b)
-{
-	struct list_head *ld;
-	struct pci_bus *child_bus;
-
-	for (ld = b->devices.next; ld != &b->devices; ld = ld->next) {
-		struct pci_dev *dev = pci_dev_b(ld);
-		int i;
-
-		for (i = 0; i < PCI_NUM_RESOURCES; i++) {
-			struct resource *r = &dev->resource[i];
-
-			if (r->parent || !r->start || !r->flags)
-				continue;
-			rpaphp_claim_resource(dev, i);
-		}
-	}
-
-	list_for_each_entry(child_bus, &b->children, node)
-		rpadlpar_claim_one_bus(child_bus);
-}
-
 static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent,
 					struct device_node *dev_dn)
 {
@@ -171,7 +149,7 @@
 	rpaphp_init_new_devs(dev->subordinate);
 
 	/* Claim new bus resources */
-	rpadlpar_claim_one_bus(dev->bus);
+	pcibios_claim_one_bus(dev->bus);
 
 	/* ioremap() for child bus, which may or may not succeed */
 	(void) remap_bus_range(dev->bus);



More information about the Linuxppc64-dev mailing list