aboutsummaryrefslogtreecommitdiffstats
path: root/pci
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-01-17 21:40:22 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-17 21:40:22 -0800
commit05f961a7cefc2f1441dcbaef4b175023c44b2342 (patch)
treed580ed0e60a00b157c37bc08b6cf46912db84e71 /pci
parentf88df26c66503b2782e54f6d08a227313710baed (diff)
downloadpatches-05f961a7cefc2f1441dcbaef4b175023c44b2342.tar.gz
pci hotplug patches
Diffstat (limited to 'pci')
-rw-r--r--pci/powerpc-pci-hotplug-cleanup-add-prefix.patch187
-rw-r--r--pci/powerpc-pci-hotplug-de-convolute-rpaphp_unconfig_pci_adap.patch124
-rw-r--r--pci/powerpc-pci-hotplug-merge-config_pci_adapter.patch94
-rw-r--r--pci/powerpc-pci-hotplug-merge-rpaphp_enable_pci_slot.patch134
-rw-r--r--pci/powerpc-pci-hotplug-minor-cleanup-forward-decls.patch68
-rw-r--r--pci/powerpc-pci-hotplug-remove-remove_bus_device.patch55
-rw-r--r--pci/powerpc-pci-hotplug-remove-rpaphp_find_bus.patch126
-rw-r--r--pci/powerpc-pci-hotplug-remove-rpaphp_fixup_new_pci_devices.patch211
-rw-r--r--pci/powerpc-pci-hotplug-shuffle-error-checking-to-better-location.patch116
9 files changed, 1115 insertions, 0 deletions
diff --git a/pci/powerpc-pci-hotplug-cleanup-add-prefix.patch b/pci/powerpc-pci-hotplug-cleanup-add-prefix.patch
new file mode 100644
index 0000000000000..8cbee1fd11e63
--- /dev/null
+++ b/pci/powerpc-pci-hotplug-cleanup-add-prefix.patch
@@ -0,0 +1,187 @@
+From linas@austin.ibm.com Thu Jan 12 16:31:04 2006
+Date: Thu, 12 Jan 2006 18:31:01 -0600
+From: linas@austin.ibm.com
+To: Greg KH <greg@kroah.com>, akpm@osdl.org
+Cc: Paul Mackerras <paulus@samba.org>
+Subject: [PATCH 7/9] powerpc/PCI hotplug: cleanup: add prefix
+Message-ID: <20060113003101.GE26221@austin.ibm.com>
+Content-Disposition: inline
+
+
+
+Minor cleanup. Add the prefix rpaphp_* to several generic-sounding routines.
+Remove rpaphp_remove_slot(), which is a one-liner.
+
+Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
+Acked-by: John Rose <johnrose@austin.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/rpadlpar_core.c | 4 ++--
+ drivers/pci/hotplug/rpaphp.h | 6 +++---
+ drivers/pci/hotplug/rpaphp_core.c | 14 +++++---------
+ drivers/pci/hotplug/rpaphp_pci.c | 4 ++--
+ drivers/pci/hotplug/rpaphp_slot.c | 16 ++++++++--------
+ 5 files changed, 20 insertions(+), 24 deletions(-)
+
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp_core.c
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp_core.c
+@@ -196,11 +196,6 @@ static int get_max_bus_speed(struct hotp
+ return 0;
+ }
+
+-int rpaphp_remove_slot(struct slot *slot)
+-{
+- return deregister_slot(slot);
+-}
+-
+ static int get_children_props(struct device_node *dn, int **drc_indexes,
+ int **drc_names, int **drc_types, int **drc_power_domains)
+ {
+@@ -307,13 +302,15 @@ static int is_php_dn(struct device_node
+ return 0;
+ }
+
+-/****************************************************************
++/**
++ * rpaphp_add_slot -- add hotplug or dlpar slot
++ *
+ * rpaphp not only registers PCI hotplug slots(HOTPLUG),
+ * but also logical DR slots(EMBEDDED).
+ * HOTPLUG slot: An adapter can be physically added/removed.
+ * EMBEDDED slot: An adapter can be logically removed/added
+ * from/to a partition with the slot.
+- ***************************************************************/
++ */
+ int rpaphp_add_slot(struct device_node *dn)
+ {
+ struct slot *slot;
+@@ -344,7 +341,7 @@ int rpaphp_add_slot(struct device_node *
+ dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n",
+ indexes[i + 1], name, type);
+
+- retval = register_pci_slot(slot);
++ retval = rpaphp_register_pci_slot(slot);
+ }
+ }
+ exit:
+@@ -462,6 +459,5 @@ module_init(rpaphp_init);
+ module_exit(rpaphp_exit);
+
+ EXPORT_SYMBOL_GPL(rpaphp_add_slot);
+-EXPORT_SYMBOL_GPL(rpaphp_remove_slot);
+ EXPORT_SYMBOL_GPL(rpaphp_slot_head);
+ EXPORT_SYMBOL_GPL(rpaphp_get_drc_props);
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp_pci.c
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp_pci.c
+@@ -199,7 +199,7 @@ exit_rc:
+ return -EINVAL;
+ }
+
+-int register_pci_slot(struct slot *slot)
++int rpaphp_register_pci_slot(struct slot *slot)
+ {
+ int rc = -EINVAL;
+
+@@ -207,7 +207,7 @@ int register_pci_slot(struct slot *slot)
+ goto exit_rc;
+ if (setup_pci_slot(slot))
+ goto exit_rc;
+- rc = register_slot(slot);
++ rc = rpaphp_register_slot(slot);
+ exit_rc:
+ return rc;
+ }
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpadlpar_core.c
++++ gregkh-2.6/drivers/pci/hotplug/rpadlpar_core.c
+@@ -227,7 +227,7 @@ static int dlpar_remove_phb(char *drc_na
+ slot = find_slot(dn);
+ if (slot) {
+ /* Remove hotplug slot */
+- if (rpaphp_remove_slot(slot)) {
++ if (rpaphp_deregister_slot(slot)) {
+ printk(KERN_ERR
+ "%s: unable to remove hotplug slot %s\n",
+ __FUNCTION__, drc_name);
+@@ -373,7 +373,7 @@ int dlpar_remove_pci_slot(char *drc_name
+ slot = find_slot(dn);
+ if (slot) {
+ /* Remove hotplug slot */
+- if (rpaphp_remove_slot(slot)) {
++ if (rpaphp_deregister_slot(slot)) {
+ printk(KERN_ERR
+ "%s: unable to remove hotplug slot %s\n",
+ __FUNCTION__, drc_name);
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp_slot.c
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp_slot.c
+@@ -35,16 +35,16 @@
+
+ static ssize_t location_read_file (struct hotplug_slot *php_slot, char *buf)
+ {
+- char *value;
+- int retval = -ENOENT;
++ char *value;
++ int retval = -ENOENT;
+ struct slot *slot = (struct slot *)php_slot->private;
+
+ if (!slot)
+ return retval;
+
+- value = slot->location;
+- retval = sprintf (buf, "%s\n", value);
+- return retval;
++ value = slot->location;
++ retval = sprintf (buf, "%s\n", value);
++ return retval;
+ }
+
+ static struct hotplug_slot_attribute hotplug_slot_attr_location = {
+@@ -137,7 +137,7 @@ static int is_registered(struct slot *sl
+ return 0;
+ }
+
+-int deregister_slot(struct slot *slot)
++int rpaphp_deregister_slot(struct slot *slot)
+ {
+ int retval = 0;
+ struct hotplug_slot *php_slot = slot->hotplug_slot;
+@@ -160,7 +160,7 @@ int deregister_slot(struct slot *slot)
+ return retval;
+ }
+
+-int register_slot(struct slot *slot)
++int rpaphp_register_slot(struct slot *slot)
+ {
+ int retval;
+
+@@ -169,7 +169,7 @@ int register_slot(struct slot *slot)
+ slot->power_domain, slot->type);
+ /* should not try to register the same slot twice */
+ if (is_registered(slot)) { /* should't be here */
+- err("register_slot: slot[%s] is already registered\n", slot->name);
++ err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name);
+ rpaphp_release_slot(slot->hotplug_slot);
+ return -EAGAIN;
+ }
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp.h
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp.h
+@@ -89,7 +89,7 @@ extern int num_slots;
+
+ /* rpaphp_pci.c */
+ extern int rpaphp_enable_pci_slot(struct slot *slot);
+-extern int register_pci_slot(struct slot *slot);
++extern int rpaphp_register_pci_slot(struct slot *slot);
+ extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value);
+ extern int rpaphp_get_sensor_state(struct slot *slot, int *state);
+
+@@ -102,8 +102,8 @@ extern int rpaphp_get_drc_props(struct d
+ /* rpaphp_slot.c */
+ extern void dealloc_slot_struct(struct slot *slot);
+ extern struct slot *alloc_slot_struct(struct device_node *dn, int drc_index, char *drc_name, int power_domain);
+-extern int register_slot(struct slot *slot);
+-extern int deregister_slot(struct slot *slot);
++extern int rpaphp_register_slot(struct slot *slot);
++extern int rpaphp_deregister_slot(struct slot *slot);
+ extern int rpaphp_get_power_status(struct slot *slot, u8 * value);
+ extern int rpaphp_set_attention_status(struct slot *slot, u8 status);
+
diff --git a/pci/powerpc-pci-hotplug-de-convolute-rpaphp_unconfig_pci_adap.patch b/pci/powerpc-pci-hotplug-de-convolute-rpaphp_unconfig_pci_adap.patch
new file mode 100644
index 0000000000000..06d7a49a7da46
--- /dev/null
+++ b/pci/powerpc-pci-hotplug-de-convolute-rpaphp_unconfig_pci_adap.patch
@@ -0,0 +1,124 @@
+From owner-linux-pci@atrey.karlin.mff.cuni.cz Thu Jan 12 16:26:37 2006
+Date: Thu, 12 Jan 2006 18:26:27 -0600
+From: linas@austin.ibm.com
+To: Greg KH <greg@kroah.com>, akpm@osdl.org
+Cc: Paul Mackerras <paulus@samba.org>
+Subject: [PATCH 5/9] powerpc/PCI hotplug: de-convolute rpaphp_unconfig_pci_adap
+Message-ID: <20060113002627.GC26221@austin.ibm.com>
+Content-Disposition: inline
+
+
+
+Remove general baroqueness. The function rpaphp_unconfig_pci_adapter()
+is really just three lines of code, once all the dbg printks are removed.
+And its called in only one place. So replace the call by the thre lines.
+Also, provide proper semaphore locking in the affected function
+disable_slot()
+
+Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
+Acked-by: John Rose <johnrose@austin.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ drivers/pci/hotplug/rpadlpar_core.c | 6 +++++-
+ drivers/pci/hotplug/rpaphp.h | 2 --
+ drivers/pci/hotplug/rpaphp_core.c | 32 ++++++++++++++++++--------------
+ drivers/pci/hotplug/rpaphp_pci.c | 12 ------------
+ 4 files changed, 23 insertions(+), 29 deletions(-)
+
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpadlpar_core.c
++++ gregkh-2.6/drivers/pci/hotplug/rpadlpar_core.c
+@@ -380,7 +380,11 @@ int dlpar_remove_pci_slot(char *drc_name
+ return -EIO;
+ }
+ } else {
+- rpaphp_unconfig_pci_adapter(bus);
++ struct pci_dev *dev, *tmp;
++ list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
++ eeh_remove_bus_device(dev);
++ pci_remove_bus_device(dev);
++ }
+ }
+
+ if (unmap_bus_range(bus)) {
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp_core.c
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp_core.c
+@@ -412,27 +412,31 @@ exit:
+ return retval;
+ }
+
+-static int disable_slot(struct hotplug_slot *hotplug_slot)
++static int __disable_slot(struct slot *slot)
+ {
+- int retval = -EINVAL;
+- struct slot *slot = (struct slot *)hotplug_slot->private;
++ struct pci_dev *dev, *tmp;
+
+- dbg("%s - Entry: slot[%s]\n", __FUNCTION__, slot->name);
++ if (slot->state == NOT_CONFIGURED)
++ return -EINVAL;
+
+- if (slot->state == NOT_CONFIGURED) {
+- dbg("%s: %s is already disabled\n", __FUNCTION__, slot->name);
+- goto exit;
++ list_for_each_entry_safe(dev, tmp, &slot->bus->devices, bus_list) {
++ eeh_remove_bus_device(dev);
++ pci_remove_bus_device(dev);
+ }
+
+- dbg("DISABLING SLOT %s\n", slot->name);
++ slot->state = NOT_CONFIGURED;
++ return 0;
++}
++
++static int disable_slot(struct hotplug_slot *hotplug_slot)
++{
++ struct slot *slot = (struct slot *)hotplug_slot->private;
++ int retval;
++
+ down(&rpaphp_sem);
+- retval = rpaphp_unconfig_pci_adapter(slot->bus);
++ retval = __disable_slot (slot);
+ up(&rpaphp_sem);
+- slot->state = NOT_CONFIGURED;
+- info("%s: devices in slot[%s] unconfigured.\n", __FUNCTION__,
+- slot->name);
+-exit:
+- dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval);
++
+ return retval;
+ }
+
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp_pci.c
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp_pci.c
+@@ -116,18 +116,6 @@ static void print_slot_pci_funcs(struct
+ return;
+ }
+
+-int rpaphp_unconfig_pci_adapter(struct pci_bus *bus)
+-{
+- struct pci_dev *dev, *tmp;
+-
+- list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
+- eeh_remove_bus_device(dev);
+- pci_remove_bus_device(dev);
+- }
+- return 0;
+-}
+-EXPORT_SYMBOL_GPL(rpaphp_unconfig_pci_adapter);
+-
+ static int setup_pci_hotplug_slot_info(struct slot *slot)
+ {
+ struct hotplug_slot_info *hotplug_slot_info = slot->hotplug_slot->info;
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp.h
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp.h
+@@ -92,8 +92,6 @@ extern int rpaphp_enable_pci_slot(struct
+ extern int register_pci_slot(struct slot *slot);
+ extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value);
+
+-extern int rpaphp_unconfig_pci_adapter(struct pci_bus *bus);
+-
+ /* rpaphp_core.c */
+ extern int rpaphp_add_slot(struct device_node *dn);
+ extern int rpaphp_remove_slot(struct slot *slot);
diff --git a/pci/powerpc-pci-hotplug-merge-config_pci_adapter.patch b/pci/powerpc-pci-hotplug-merge-config_pci_adapter.patch
new file mode 100644
index 0000000000000..74501a768a12a
--- /dev/null
+++ b/pci/powerpc-pci-hotplug-merge-config_pci_adapter.patch
@@ -0,0 +1,94 @@
+From linas@austin.ibm.com Thu Jan 12 16:22:08 2006
+From: linas@austin.ibm.com
+Date: Thu, 12 Jan 2006 18:22:07 -0600
+To: Greg KH <greg@kroah.com>, akpm@osdl.org
+Cc: Paul Mackerras <paulus@samba.org>
+Subject: [PATCH 3/9] powerpc/PCI hotplug: merge config_pci_adapter
+Message-ID: <20060113002206.GA26221@austin.ibm.com>
+Content-Disposition: inline
+
+
+
+Remove general baroqueness. The function rpaphp_config_pci_adapter()
+is really just one line of code, once all the dbg printks are removed.
+And its called in only one place. So replace the call by the one line.
+
+Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
+Acked-by: John Rose <johnrose@austin.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ drivers/pci/hotplug/rpaphp.h | 1 -
+ drivers/pci/hotplug/rpaphp_pci.c | 35 ++++-------------------------------
+ 2 files changed, 4 insertions(+), 32 deletions(-)
+
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp_pci.c
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp_pci.c
+@@ -116,24 +116,6 @@ static void print_slot_pci_funcs(struct
+ return;
+ }
+
+-int rpaphp_config_pci_adapter(struct pci_bus *bus)
+-{
+- struct device_node *dn = pci_bus_to_OF_node(bus);
+- int rc = -ENODEV;
+-
+- dbg("Entry %s: slot[%s]\n", __FUNCTION__, dn->full_name);
+- if (!dn)
+- goto exit;
+-
+- pcibios_add_pci_devices(bus);
+- print_slot_pci_funcs(bus);
+- rc = 0;
+-exit:
+- dbg("Exit %s: rc=%d\n", __FUNCTION__, rc);
+- return rc;
+-}
+-EXPORT_SYMBOL_GPL(rpaphp_config_pci_adapter);
+-
+ static void rpaphp_eeh_remove_bus_device(struct pci_dev *dev)
+ {
+ eeh_remove_device(dev);
+@@ -225,10 +207,7 @@ static int setup_pci_slot(struct slot *s
+ if (slot->hotplug_slot->info->adapter_status == NOT_CONFIGURED) {
+ dbg("%s CONFIGURING pci adapter in slot[%s]\n",
+ __FUNCTION__, slot->name);
+- if (rpaphp_config_pci_adapter(slot->bus)) {
+- err("%s: CONFIG pci adapter failed\n", __FUNCTION__);
+- goto exit_rc;
+- }
++ pcibios_add_pci_devices(slot->bus);
+
+ } else if (slot->hotplug_slot->info->adapter_status != CONFIGURED) {
+ err("%s: slot[%s]'s adapter_status is NOT_VALID.\n",
+@@ -274,16 +253,10 @@ int rpaphp_enable_pci_slot(struct slot *
+ /* if slot is not empty, enable the adapter */
+ if (state == PRESENT) {
+ dbg("%s : slot[%s] is occupied.\n", __FUNCTION__, slot->name);
+- retval = rpaphp_config_pci_adapter(slot->bus);
+- if (!retval) {
+- slot->state = CONFIGURED;
+- info("%s: devices in slot[%s] configured\n",
++ pcibios_add_pci_devices(slot->bus);
++ slot->state = CONFIGURED;
++ info("%s: devices in slot[%s] configured\n",
+ __FUNCTION__, slot->name);
+- } else {
+- slot->state = NOT_CONFIGURED;
+- dbg("%s: no pci_dev struct for adapter in slot[%s]\n",
+- __FUNCTION__, slot->name);
+- }
+ } else if (state == EMPTY) {
+ dbg("%s : slot[%s] is empty\n", __FUNCTION__, slot->name);
+ slot->state = EMPTY;
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp.h
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp.h
+@@ -92,7 +92,6 @@ extern int rpaphp_enable_pci_slot(struct
+ extern int register_pci_slot(struct slot *slot);
+ extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value);
+
+-extern int rpaphp_config_pci_adapter(struct pci_bus *bus);
+ extern int rpaphp_unconfig_pci_adapter(struct pci_bus *bus);
+
+ /* rpaphp_core.c */
diff --git a/pci/powerpc-pci-hotplug-merge-rpaphp_enable_pci_slot.patch b/pci/powerpc-pci-hotplug-merge-rpaphp_enable_pci_slot.patch
new file mode 100644
index 0000000000000..0e352cdcdf031
--- /dev/null
+++ b/pci/powerpc-pci-hotplug-merge-rpaphp_enable_pci_slot.patch
@@ -0,0 +1,134 @@
+From linas@austin.ibm.com Thu Jan 12 16:28:24 2006
+Date: Thu, 12 Jan 2006 18:28:22 -0600
+From: linas@austin.ibm.com
+To: Greg KH <greg@kroah.com>, akpm@osdl.org
+Cc: Paul Mackerras <paulus@samba.org>
+Subject: [PATCH 6/9] powerpc/PCI hotplug: merge rpaphp_enable_pci_slot()
+Message-ID: <20060113002822.GD26221@austin.ibm.com>
+Content-Disposition: inline
+
+
+
+Remove general baroqueness. The function rpaphp_enable_pci_slot()
+has a fairly simple logic structure, once all of the debug printk's
+are removed. Its called from only one place, and that place also
+has a very simple structure once he printk's are removed. Merge
+the two together.
+
+Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
+Acked-by: John Rose <johnrose@austin.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ drivers/pci/hotplug/rpaphp.h | 1 +
+ drivers/pci/hotplug/rpaphp_core.c | 38 ++++++++++++++++++++++++++++----------
+ drivers/pci/hotplug/rpaphp_pci.c | 30 +-----------------------------
+ 3 files changed, 30 insertions(+), 39 deletions(-)
+
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp_core.c
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp_core.c
+@@ -393,22 +393,40 @@ static void __exit rpaphp_exit(void)
+ cleanup_slots();
+ }
+
+-static int enable_slot(struct hotplug_slot *hotplug_slot)
++static int __enable_slot(struct slot *slot)
+ {
+- int retval = 0;
+- struct slot *slot = (struct slot *)hotplug_slot->private;
++ int state;
++ int retval;
++
++ if (slot->state == CONFIGURED)
++ return 0;
+
+- if (slot->state == CONFIGURED) {
+- dbg("%s: %s is already enabled\n", __FUNCTION__, slot->name);
+- goto exit;
++ retval = rpaphp_get_sensor_state(slot, &state);
++ if (retval)
++ return retval;
++
++ if (state == PRESENT) {
++ pcibios_add_pci_devices(slot->bus);
++ slot->state = CONFIGURED;
++ } else if (state == EMPTY) {
++ slot->state = EMPTY;
++ } else {
++ err("%s: slot[%s] is in invalid state\n", __FUNCTION__, slot->name);
++ slot->state = NOT_VALID;
++ return -EINVAL;
+ }
++ return 0;
++}
++
++static int enable_slot(struct hotplug_slot *hotplug_slot)
++{
++ int retval;
++ struct slot *slot = (struct slot *)hotplug_slot->private;
+
+- dbg("ENABLING SLOT %s\n", slot->name);
+ down(&rpaphp_sem);
+- retval = rpaphp_enable_pci_slot(slot);
++ retval = __enable_slot(slot);
+ up(&rpaphp_sem);
+-exit:
+- dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval);
++
+ return retval;
+ }
+
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp_pci.c
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp_pci.c
+@@ -32,7 +32,7 @@
+ #include "../pci.h" /* for pci_add_new_bus */
+ #include "rpaphp.h"
+
+-static int rpaphp_get_sensor_state(struct slot *slot, int *state)
++int rpaphp_get_sensor_state(struct slot *slot, int *state)
+ {
+ int rc;
+ int setlevel;
+@@ -212,31 +212,3 @@ exit_rc:
+ return rc;
+ }
+
+-int rpaphp_enable_pci_slot(struct slot *slot)
+-{
+- int retval = 0, state;
+-
+- retval = rpaphp_get_sensor_state(slot, &state);
+- if (retval)
+- goto exit;
+- dbg("%s: sensor state[%d]\n", __FUNCTION__, state);
+- /* if slot is not empty, enable the adapter */
+- if (state == PRESENT) {
+- dbg("%s : slot[%s] is occupied.\n", __FUNCTION__, slot->name);
+- pcibios_add_pci_devices(slot->bus);
+- slot->state = CONFIGURED;
+- info("%s: devices in slot[%s] configured\n",
+- __FUNCTION__, slot->name);
+- } else if (state == EMPTY) {
+- dbg("%s : slot[%s] is empty\n", __FUNCTION__, slot->name);
+- slot->state = EMPTY;
+- } else {
+- err("%s: slot[%s] is in invalid state\n", __FUNCTION__,
+- slot->name);
+- slot->state = NOT_VALID;
+- retval = -EINVAL;
+- }
+-exit:
+- dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval);
+- return retval;
+-}
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp.h
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp.h
+@@ -91,6 +91,7 @@ extern int num_slots;
+ extern int rpaphp_enable_pci_slot(struct slot *slot);
+ extern int register_pci_slot(struct slot *slot);
+ extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value);
++extern int rpaphp_get_sensor_state(struct slot *slot, int *state);
+
+ /* rpaphp_core.c */
+ extern int rpaphp_add_slot(struct device_node *dn);
diff --git a/pci/powerpc-pci-hotplug-minor-cleanup-forward-decls.patch b/pci/powerpc-pci-hotplug-minor-cleanup-forward-decls.patch
new file mode 100644
index 0000000000000..ef75108e00c30
--- /dev/null
+++ b/pci/powerpc-pci-hotplug-minor-cleanup-forward-decls.patch
@@ -0,0 +1,68 @@
+From linas@austin.ibm.com Thu Jan 12 16:33:01 2006
+Date: Thu, 12 Jan 2006 18:32:58 -0600
+From: linas@austin.ibm.com
+To: Greg KH <greg@kroah.com>, akpm@osdl.org
+Cc: Paul Mackerras <paulus@samba.org>
+Subject: [PATCH 8/9] powerpc/PCI hotplug: minor cleanup forward decls
+Message-ID: <20060113003258.GF26221@austin.ibm.com>
+Content-Disposition: inline
+
+
+Minor cleanup. Move structure initializer to bottom of file,
+this allows elimination of eyeball-strain-inducing forward
+declarations.
+
+Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
+Acked-by: John Rose <johnrose@austin.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/rpaphp_core.c | 30 +++++++++++-------------------
+ 1 file changed, 11 insertions(+), 19 deletions(-)
+
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp_core.c
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp_core.c
+@@ -56,25 +56,6 @@ MODULE_LICENSE("GPL");
+
+ module_param(debug, bool, 0644);
+
+-static int enable_slot(struct hotplug_slot *slot);
+-static int disable_slot(struct hotplug_slot *slot);
+-static int set_attention_status(struct hotplug_slot *slot, u8 value);
+-static int get_power_status(struct hotplug_slot *slot, u8 * value);
+-static int get_attention_status(struct hotplug_slot *slot, u8 * value);
+-static int get_adapter_status(struct hotplug_slot *slot, u8 * value);
+-static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value);
+-
+-struct hotplug_slot_ops rpaphp_hotplug_slot_ops = {
+- .owner = THIS_MODULE,
+- .enable_slot = enable_slot,
+- .disable_slot = disable_slot,
+- .set_attention_status = set_attention_status,
+- .get_power_status = get_power_status,
+- .get_attention_status = get_attention_status,
+- .get_adapter_status = get_adapter_status,
+- .get_max_bus_speed = get_max_bus_speed,
+-};
+-
+ static int rpaphp_get_attention_status(struct slot *slot)
+ {
+ return slot->hotplug_slot->info->attention_status;
+@@ -455,6 +436,17 @@ static int disable_slot(struct hotplug_s
+ return retval;
+ }
+
++struct hotplug_slot_ops rpaphp_hotplug_slot_ops = {
++ .owner = THIS_MODULE,
++ .enable_slot = enable_slot,
++ .disable_slot = disable_slot,
++ .set_attention_status = set_attention_status,
++ .get_power_status = get_power_status,
++ .get_attention_status = get_attention_status,
++ .get_adapter_status = get_adapter_status,
++ .get_max_bus_speed = get_max_bus_speed,
++};
++
+ module_init(rpaphp_init);
+ module_exit(rpaphp_exit);
+
diff --git a/pci/powerpc-pci-hotplug-remove-remove_bus_device.patch b/pci/powerpc-pci-hotplug-remove-remove_bus_device.patch
new file mode 100644
index 0000000000000..9f5ef60f8c3c3
--- /dev/null
+++ b/pci/powerpc-pci-hotplug-remove-remove_bus_device.patch
@@ -0,0 +1,55 @@
+From linas@austin.ibm.com Thu Jan 12 16:24:28 2006
+From: linas@austin.ibm.com
+Date: Thu, 12 Jan 2006 18:24:27 -0600
+To: Greg KH <greg@kroah.com>, akpm@osdl.org
+Cc: Paul Mackerras <paulus@samba.org>
+Subject: [PATCH 4/9] powerpc/PCI hotplug: remove remove_bus_device()
+Message-ID: <20060113002427.GB26221@austin.ibm.com>
+Content-Disposition: inline
+
+
+The function rpaphp_eeh_remove_bus_device() is a dupe of
+eeh_remove_bus_device(). Remove it.
+
+Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
+Acked-by: John Rose <johnrose@austin.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/rpaphp_pci.c | 20 +-------------------
+ 1 file changed, 1 insertion(+), 19 deletions(-)
+
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp_pci.c
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp_pci.c
+@@ -116,30 +116,12 @@ static void print_slot_pci_funcs(struct
+ return;
+ }
+
+-static void rpaphp_eeh_remove_bus_device(struct pci_dev *dev)
+-{
+- 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)
+- rpaphp_eeh_remove_bus_device(pdev);
+- }
+-
+- }
+- return;
+-}
+-
+ int rpaphp_unconfig_pci_adapter(struct pci_bus *bus)
+ {
+ struct pci_dev *dev, *tmp;
+
+ list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
+- rpaphp_eeh_remove_bus_device(dev);
++ eeh_remove_bus_device(dev);
+ pci_remove_bus_device(dev);
+ }
+ return 0;
diff --git a/pci/powerpc-pci-hotplug-remove-rpaphp_find_bus.patch b/pci/powerpc-pci-hotplug-remove-rpaphp_find_bus.patch
new file mode 100644
index 0000000000000..23a2dc957abc7
--- /dev/null
+++ b/pci/powerpc-pci-hotplug-remove-rpaphp_find_bus.patch
@@ -0,0 +1,126 @@
+From linas@austin.ibm.com Thu Jan 12 16:18:26 2006
+Date: Thu, 12 Jan 2006 18:18:26 -0600
+From: linas@austin.ibm.com
+To: Greg KH <greg@kroah.com>
+Cc: Paul Mackerras <paulus@samba.org>
+Subject: [PATCH 1/9] powerpc/PCI hotplug: remove rpaphp_find_bus()
+Message-ID: <20060113001826.GY26221@austin.ibm.com>
+Content-Disposition: inline
+
+
+The function rpaphp_find_pci_bus() has been migrated to
+pcibios_find_pci_bus() in arch/powerpc/platforms/pseries/pci_dlpar.c
+This patch removes the old version.
+
+Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
+Acked-by: John Rose <johnrose@austin.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/rpadlpar_core.c | 6 +++---
+ drivers/pci/hotplug/rpaphp.h | 3 ---
+ drivers/pci/hotplug/rpaphp_pci.c | 34 ++--------------------------------
+ 3 files changed, 5 insertions(+), 38 deletions(-)
+
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp_pci.c
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp_pci.c
+@@ -32,36 +32,6 @@
+ #include "../pci.h" /* for pci_add_new_bus */
+ #include "rpaphp.h"
+
+-static struct pci_bus *find_bus_among_children(struct pci_bus *bus,
+- struct device_node *dn)
+-{
+- struct pci_bus *child = NULL;
+- struct list_head *tmp;
+- struct device_node *busdn;
+-
+- busdn = pci_bus_to_OF_node(bus);
+- if (busdn == dn)
+- return bus;
+-
+- list_for_each(tmp, &bus->children) {
+- child = find_bus_among_children(pci_bus_b(tmp), dn);
+- if (child)
+- break;
+- }
+- return child;
+-}
+-
+-struct pci_bus *rpaphp_find_pci_bus(struct device_node *dn)
+-{
+- struct pci_dn *pdn = dn->data;
+-
+- if (!pdn || !pdn->phb || !pdn->phb->bus)
+- return NULL;
+-
+- return find_bus_among_children(pdn->phb->bus, dn);
+-}
+-EXPORT_SYMBOL_GPL(rpaphp_find_pci_bus);
+-
+ static int rpaphp_get_sensor_state(struct slot *slot, int *state)
+ {
+ int rc;
+@@ -120,7 +90,7 @@ int rpaphp_get_pci_adapter_status(struct
+ /* config/unconfig adapter */
+ *value = slot->state;
+ } else {
+- bus = rpaphp_find_pci_bus(slot->dn);
++ bus = pcibios_find_pci_bus(slot->dn);
+ if (bus && !list_empty(&bus->devices))
+ *value = CONFIGURED;
+ else
+@@ -370,7 +340,7 @@ static int setup_pci_slot(struct slot *s
+ struct pci_bus *bus;
+
+ BUG_ON(!dn);
+- bus = rpaphp_find_pci_bus(dn);
++ bus = pcibios_find_pci_bus(dn);
+ if (!bus) {
+ err("%s: no pci_bus for dn %s\n", __FUNCTION__, dn->full_name);
+ goto exit_rc;
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpadlpar_core.c
++++ gregkh-2.6/drivers/pci/hotplug/rpadlpar_core.c
+@@ -174,7 +174,7 @@ static int dlpar_add_pci_slot(char *drc_
+ {
+ struct pci_dev *dev;
+
+- if (rpaphp_find_pci_bus(dn))
++ if (pcibios_find_pci_bus(dn))
+ return -EINVAL;
+
+ /* Add pci bus */
+@@ -221,7 +221,7 @@ static int dlpar_remove_phb(char *drc_na
+ struct pci_dn *pdn;
+ int rc = 0;
+
+- if (!rpaphp_find_pci_bus(dn))
++ if (!pcibios_find_pci_bus(dn))
+ return -EINVAL;
+
+ slot = find_slot(dn);
+@@ -366,7 +366,7 @@ int dlpar_remove_pci_slot(char *drc_name
+ struct pci_bus *bus;
+ struct slot *slot;
+
+- bus = rpaphp_find_pci_bus(dn);
++ bus = pcibios_find_pci_bus(dn);
+ if (!bus)
+ return -EINVAL;
+
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp.h
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp.h
+@@ -88,13 +88,10 @@ extern int num_slots;
+ /* function prototypes */
+
+ /* rpaphp_pci.c */
+-extern struct pci_bus *rpaphp_find_pci_bus(struct device_node *dn);
+-extern int rpaphp_claim_resource(struct pci_dev *dev, int resource);
+ extern int rpaphp_enable_pci_slot(struct slot *slot);
+ extern int register_pci_slot(struct slot *slot);
+ extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value);
+ extern void rpaphp_init_new_devs(struct pci_bus *bus);
+-extern void rpaphp_eeh_init_nodes(struct device_node *dn);
+
+ extern int rpaphp_config_pci_adapter(struct pci_bus *bus);
+ extern int rpaphp_unconfig_pci_adapter(struct pci_bus *bus);
diff --git a/pci/powerpc-pci-hotplug-remove-rpaphp_fixup_new_pci_devices.patch b/pci/powerpc-pci-hotplug-remove-rpaphp_fixup_new_pci_devices.patch
new file mode 100644
index 0000000000000..0e10e7415e75e
--- /dev/null
+++ b/pci/powerpc-pci-hotplug-remove-rpaphp_fixup_new_pci_devices.patch
@@ -0,0 +1,211 @@
+From linas@austin.ibm.com Thu Jan 12 16:20:28 2006
+Date: Thu, 12 Jan 2006 18:20:26 -0600
+From: linas@austin.ibm.com
+To: Greg KH <greg@kroah.com>
+Cc: Paul Mackerras <paulus@samba.org>
+Subject: [PATCH 2/9] powerpc/PCI hotplug: remove rpaphp_fixup_new_pci_devices()
+Message-ID: <20060113002026.GZ26221@austin.ibm.com>
+Content-Disposition: inline
+
+
+The function rpaphp_fixup_new_pci_devices() has been migrated to
+pcibios_fixup_new_pci_devices() in
+arch/powerpc/platforms/pseries/pci_dlpar.c
+This patch removes the old version.
+
+Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
+Acked-by: John Rose <johnrose@austin.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+
+---
+ drivers/pci/hotplug/rpadlpar_core.c | 2
+ drivers/pci/hotplug/rpaphp.h | 1
+ drivers/pci/hotplug/rpaphp_pci.c | 142 ------------------------------------
+ 3 files changed, 2 insertions(+), 143 deletions(-)
+
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp_pci.c
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp_pci.c
+@@ -101,140 +101,6 @@ exit:
+ return rc;
+ }
+
+-/* Must be called before pci_bus_add_devices */
+-void rpaphp_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus)
+-{
+- struct pci_dev *dev;
+-
+- list_for_each_entry(dev, &bus->devices, bus_list) {
+- /*
+- * Skip already-present devices (which are on the
+- * global device list.)
+- */
+- if (list_empty(&dev->global_list)) {
+- int i;
+-
+- /* Need to setup IOMMU tables */
+- ppc_md.iommu_dev_setup(dev);
+-
+- if(fix_bus)
+- pcibios_fixup_device_resources(dev, bus);
+- pci_read_irq_line(dev);
+- for (i = 0; i < PCI_NUM_RESOURCES; i++) {
+- struct resource *r = &dev->resource[i];
+-
+- if (r->parent || !r->start || !r->flags)
+- continue;
+- pci_claim_resource(dev, i);
+- }
+- }
+- }
+-}
+-
+-static void rpaphp_eeh_add_bus_device(struct pci_bus *bus)
+-{
+- struct pci_dev *dev;
+-
+- list_for_each_entry(dev, &bus->devices, bus_list) {
+- eeh_add_device_late(dev);
+- if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
+- struct pci_bus *subbus = dev->subordinate;
+- if (subbus)
+- rpaphp_eeh_add_bus_device (subbus);
+- }
+- }
+-}
+-
+-static int rpaphp_pci_config_bridge(struct pci_dev *dev)
+-{
+- u8 sec_busno;
+- struct pci_bus *child_bus;
+- struct pci_dev *child_dev;
+-
+- dbg("Enter %s: BRIDGE dev=%s\n", __FUNCTION__, pci_name(dev));
+-
+- /* get busno of downstream bus */
+- pci_read_config_byte(dev, PCI_SECONDARY_BUS, &sec_busno);
+-
+- /* add to children of PCI bridge dev->bus */
+- child_bus = pci_add_new_bus(dev->bus, dev, sec_busno);
+- if (!child_bus) {
+- err("%s: could not add second bus\n", __FUNCTION__);
+- return -EIO;
+- }
+- sprintf(child_bus->name, "PCI Bus #%02x", child_bus->number);
+- /* do pci_scan_child_bus */
+- pci_scan_child_bus(child_bus);
+-
+- list_for_each_entry(child_dev, &child_bus->devices, bus_list) {
+- eeh_add_device_late(child_dev);
+- }
+-
+- /* fixup new pci devices without touching bus struct */
+- rpaphp_fixup_new_pci_devices(child_bus, 0);
+-
+- /* Make the discovered devices available */
+- pci_bus_add_devices(child_bus);
+- return 0;
+-}
+-
+-void rpaphp_init_new_devs(struct pci_bus *bus)
+-{
+- rpaphp_fixup_new_pci_devices(bus, 0);
+- rpaphp_eeh_add_bus_device(bus);
+-}
+-EXPORT_SYMBOL_GPL(rpaphp_init_new_devs);
+-
+-/*****************************************************************************
+- rpaphp_pci_config_slot() will configure all devices under the
+- given slot->dn and return the the first pci_dev.
+- *****************************************************************************/
+-static struct pci_dev *
+-rpaphp_pci_config_slot(struct pci_bus *bus)
+-{
+- struct device_node *dn = pci_bus_to_OF_node(bus);
+- struct pci_dev *dev = NULL;
+- int slotno;
+- int num;
+-
+- dbg("Enter %s: dn=%s bus=%s\n", __FUNCTION__, dn->full_name, bus->name);
+- if (!dn || !dn->child)
+- return NULL;
+-
+- if (_machine == PLATFORM_PSERIES_LPAR) {
+- of_scan_bus(dn, bus);
+- if (list_empty(&bus->devices)) {
+- err("%s: No new device found\n", __FUNCTION__);
+- return NULL;
+- }
+-
+- rpaphp_init_new_devs(bus);
+- pci_bus_add_devices(bus);
+- dev = list_entry(&bus->devices, struct pci_dev, bus_list);
+- } else {
+- slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
+-
+- /* pci_scan_slot should find all children */
+- num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
+- if (num) {
+- rpaphp_fixup_new_pci_devices(bus, 1);
+- pci_bus_add_devices(bus);
+- }
+- if (list_empty(&bus->devices)) {
+- err("%s: No new device found\n", __FUNCTION__);
+- return NULL;
+- }
+- list_for_each_entry(dev, &bus->devices, bus_list) {
+- if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE)
+- rpaphp_pci_config_bridge(dev);
+-
+- rpaphp_eeh_add_bus_device(bus);
+- }
+- }
+-
+- return dev;
+-}
+-
+ static void print_slot_pci_funcs(struct pci_bus *bus)
+ {
+ struct device_node *dn;
+@@ -253,19 +119,13 @@ static void print_slot_pci_funcs(struct
+ int rpaphp_config_pci_adapter(struct pci_bus *bus)
+ {
+ struct device_node *dn = pci_bus_to_OF_node(bus);
+- struct pci_dev *dev;
+ int rc = -ENODEV;
+
+ dbg("Entry %s: slot[%s]\n", __FUNCTION__, dn->full_name);
+ if (!dn)
+ goto exit;
+
+- eeh_add_device_tree_early(dn);
+- dev = rpaphp_pci_config_slot(bus);
+- if (!dev) {
+- err("%s: can't find any devices.\n", __FUNCTION__);
+- goto exit;
+- }
++ pcibios_add_pci_devices(bus);
+ print_slot_pci_funcs(bus);
+ rc = 0;
+ exit:
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpadlpar_core.c
++++ gregkh-2.6/drivers/pci/hotplug/rpadlpar_core.c
+@@ -146,7 +146,7 @@ static struct pci_dev *dlpar_pci_add_bus
+ dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
+ of_scan_pci_bridge(dn, dev);
+
+- rpaphp_init_new_devs(dev->subordinate);
++ pcibios_fixup_new_pci_devices(dev->subordinate,0);
+
+ /* Claim new bus resources */
+ pcibios_claim_one_bus(dev->bus);
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpaphp.h
++++ gregkh-2.6/drivers/pci/hotplug/rpaphp.h
+@@ -91,7 +91,6 @@ extern int num_slots;
+ extern int rpaphp_enable_pci_slot(struct slot *slot);
+ extern int register_pci_slot(struct slot *slot);
+ extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value);
+-extern void rpaphp_init_new_devs(struct pci_bus *bus);
+
+ extern int rpaphp_config_pci_adapter(struct pci_bus *bus);
+ extern int rpaphp_unconfig_pci_adapter(struct pci_bus *bus);
diff --git a/pci/powerpc-pci-hotplug-shuffle-error-checking-to-better-location.patch b/pci/powerpc-pci-hotplug-shuffle-error-checking-to-better-location.patch
new file mode 100644
index 0000000000000..6fb760df91f46
--- /dev/null
+++ b/pci/powerpc-pci-hotplug-shuffle-error-checking-to-better-location.patch
@@ -0,0 +1,116 @@
+From linas@austin.ibm.com Thu Jan 12 16:35:24 2006
+Date: Thu, 12 Jan 2006 18:35:23 -0600
+From: linas@austin.ibm.com
+To: Greg KH <greg@kroah.com>, akpm@osdl.org
+Cc: Paul Mackerras <paulus@samba.org>
+Subject: [PATCH 9/9] powerpc/PCI hotplug: shuffle error checking to better location.
+Message-ID: <20060113003523.GG26221@austin.ibm.com>
+Content-Disposition: inline
+
+
+
+Error checking is scattered through various layers of the dlpar code,
+leading to a somewhat opaque code structure. This patch consolidates
+error checking in one routine, simplifying the code a tad. There's
+also some whitespace cleanup here too.
+
+Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
+Acked-by: John Rose <johnrose@austin.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/rpadlpar_core.c | 44 ++++++++++++++++++------------------
+ 1 file changed, 22 insertions(+), 22 deletions(-)
+
+--- gregkh-2.6.orig/drivers/pci/hotplug/rpadlpar_core.c
++++ gregkh-2.6/drivers/pci/hotplug/rpadlpar_core.c
+@@ -103,13 +103,13 @@ static struct slot *find_slot(struct dev
+ struct list_head *tmp, *n;
+ struct slot *slot;
+
+- list_for_each_safe(tmp, n, &rpaphp_slot_head) {
+- slot = list_entry(tmp, struct slot, rpaphp_slot_list);
+- if (slot->dn == dn)
+- return slot;
+- }
++ list_for_each_safe(tmp, n, &rpaphp_slot_head) {
++ slot = list_entry(tmp, struct slot, rpaphp_slot_list);
++ if (slot->dn == dn)
++ return slot;
++ }
+
+- return NULL;
++ return NULL;
+ }
+
+ static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent,
+@@ -126,9 +126,9 @@ static struct pci_dev *dlpar_find_new_de
+ return NULL;
+ }
+
+-static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn)
++static void dlpar_pci_add_bus(struct device_node *dn)
+ {
+- struct pci_dn *pdn = dn->data;
++ struct pci_dn *pdn = PCI_DN(dn);
+ struct pci_controller *phb = pdn->phb;
+ struct pci_dev *dev = NULL;
+
+@@ -139,7 +139,7 @@ static struct pci_dev *dlpar_pci_add_bus
+ if (!dev) {
+ printk(KERN_ERR "%s: failed to create pci dev for %s\n",
+ __FUNCTION__, dn->full_name);
+- return NULL;
++ return;
+ }
+
+ if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
+@@ -156,35 +156,35 @@ static struct pci_dev *dlpar_pci_add_bus
+
+ /* Add new devices to global lists. Register in proc, sysfs. */
+ pci_bus_add_devices(phb->bus);
+-
+- /* Confirm new bridge dev was created */
+- dev = dlpar_find_new_dev(phb->bus, dn);
+- if (dev) {
+- if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
+- printk(KERN_ERR "%s: unexpected header type %d\n",
+- __FUNCTION__, dev->hdr_type);
+- return NULL;
+- }
+- }
+-
+- return dev;
+ }
+
+ static int dlpar_add_pci_slot(char *drc_name, struct device_node *dn)
+ {
+ struct pci_dev *dev;
++ struct pci_controller *phb;
+
+ if (pcibios_find_pci_bus(dn))
+ return -EINVAL;
+
+ /* Add pci bus */
+- dev = dlpar_pci_add_bus(dn);
++ dlpar_pci_add_bus(dn);
++
++ /* Confirm new bridge dev was created */
++ phb = PCI_DN(dn)->phb;
++ dev = dlpar_find_new_dev(phb->bus, dn);
++
+ if (!dev) {
+ printk(KERN_ERR "%s: unable to add bus %s\n", __FUNCTION__,
+ drc_name);
+ return -EIO;
+ }
+
++ if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
++ printk(KERN_ERR "%s: unexpected header type %d, unable to add bus %s\n",
++ __FUNCTION__, dev->hdr_type, drc_name);
++ return -EIO;
++ }
++
+ /* Add hotplug slot */
+ if (rpaphp_add_slot(dn)) {
+ printk(KERN_ERR "%s: unable to add hotplug slot %s\n",