[PATCH 1/2] EEH cleanups

John Rose johnrose at austin.ibm.com
Wed Feb 22 07:53:38 EST 2006


This patch removes unnecessary exports, marks functions as static when
possible, and simplifies some list-related code.

Signed-off-by: John Rose <johnrose at austin.ibm.com>

diff -puN arch/powerpc/platforms/pseries/eeh.c~eeh_cleanups arch/powerpc/platforms/pseries/eeh.c
--- 2_6_linus/arch/powerpc/platforms/pseries/eeh.c~eeh_cleanups	2006-02-21 14:40:43.000000000 -0600
+++ 2_6_linus-johnrose/arch/powerpc/platforms/pseries/eeh.c	2006-02-21 14:55:34.000000000 -0600
@@ -409,8 +409,6 @@ dn_unlock:
 	return rc;
 }
 
-EXPORT_SYMBOL_GPL(eeh_dn_check_failure);
-
 /**
  * eeh_check_failure - check if all 1's data is due to EEH slot freeze
  * @token i/o token, should be address in the form 0xA....
@@ -865,7 +863,7 @@ void __init eeh_init(void)
  * on the CEC architecture, type of the device, on earlier boot
  * command-line arguments & etc.
  */
-void eeh_add_device_early(struct device_node *dn)
+static void eeh_add_device_early(struct device_node *dn)
 {
 	struct pci_controller *phb;
 	struct eeh_early_enable_info info;
@@ -882,7 +880,6 @@ void eeh_add_device_early(struct device_
 	info.buid_lo = BUID_LO(phb->buid);
 	early_enable_eeh(dn, &info);
 }
-EXPORT_SYMBOL_GPL(eeh_add_device_early);
 
 void eeh_add_device_tree_early(struct device_node *dn)
 {
@@ -919,7 +916,6 @@ void eeh_add_device_late(struct pci_dev 
 
 	pci_addr_cache_insert_device (dev);
 }
-EXPORT_SYMBOL_GPL(eeh_add_device_late);
 
 /**
  * eeh_remove_device - undo EEH setup for the indicated pci device
@@ -928,7 +924,7 @@ EXPORT_SYMBOL_GPL(eeh_add_device_late);
  * This routine should be when a device is removed from a running
  * system (e.g. by hotplug or dlpar).
  */
-void eeh_remove_device(struct pci_dev *dev)
+static void eeh_remove_device(struct pci_dev *dev)
 {
 	struct device_node *dn;
 	if (!dev || !eeh_subsystem_enabled)
@@ -944,21 +940,16 @@ void eeh_remove_device(struct pci_dev *d
 	PCI_DN(dn)->pcidev = NULL;
 	pci_dev_put (dev);
 }
-EXPORT_SYMBOL_GPL(eeh_remove_device);
 
 void eeh_remove_bus_device(struct pci_dev *dev)
 {
+	struct pci_bus *bus = dev->subordinate;
+	struct pci_dev *child, *tmp;
+
 	eeh_remove_device(dev);
-	if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
-		struct pci_bus *bus = dev->subordinate;
-		struct list_head *ln;
-		if (!bus)
-			return; 
-		for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) {
-			struct pci_dev *pdev = pci_dev_b(ln);
-			if (pdev)
-				eeh_remove_bus_device(pdev);
-		}
+	if (bus && dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
+		list_for_each_entry_safe(child, tmp, &bus->devices, bus_list)
+			eeh_remove_bus_device(child);
 	}
 }
 EXPORT_SYMBOL_GPL(eeh_remove_bus_device);
diff -puN include/asm-powerpc/eeh.h~eeh_cleanups include/asm-powerpc/eeh.h
--- 2_6_linus/include/asm-powerpc/eeh.h~eeh_cleanups	2006-02-21 14:40:43.000000000 -0600
+++ 2_6_linus-johnrose/include/asm-powerpc/eeh.h	2006-02-21 14:55:34.000000000 -0600
@@ -50,33 +50,11 @@ unsigned long eeh_check_failure(const vo
 int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev);
 void __init pci_addr_cache_build(void);
 
-/**
- * eeh_add_device_early
- * eeh_add_device_late
- *
- * Perform eeh initialization for devices added after boot.
- * Call eeh_add_device_early before doing any i/o to the
- * device (including config space i/o).  Call eeh_add_device_late
- * to finish the eeh setup for this device.
- */
-void eeh_add_device_early(struct device_node *);
 void eeh_add_device_tree_early(struct device_node *);
 void eeh_add_device_late(struct pci_dev *);
 
 /**
- * eeh_remove_device - undo EEH setup for the indicated pci device
- * @dev: pci device to be removed
- *
- * This routine should be called when a device is removed from
- * a running system (e.g. by hotplug or dlpar).  It unregisters
- * the PCI device from the EEH subsystem.  I/O errors affecting
- * this device will no longer be detected after this call; thus,
- * i/o errors affecting this slot may leave this device unusable.
- */
-void eeh_remove_device(struct pci_dev *);
-
-/**
- * eeh_remove_device_recursive - undo EEH for device & children.
+ * eeh_remove_bus_device - undo EEH for device & children.
  * @dev: pci device to be removed
  *
  * As above, this removes the device; it also removes child
@@ -114,12 +92,8 @@ static inline int eeh_dn_check_failure(s
 
 static inline void pci_addr_cache_build(void) { }
 
-static inline void eeh_add_device_early(struct device_node *dn) { }
-
 static inline void eeh_add_device_late(struct pci_dev *dev) { }
 
-static inline void eeh_remove_device(struct pci_dev *dev) { }
-
 static inline void eeh_add_device_tree_early(struct device_node *dn) { }
 
 static inline void eeh_remove_bus_device(struct pci_dev *dev) { }

_




More information about the Linuxppc64-dev mailing list