int rtas_write_config(struct pci_dn *, int where, int size, u32 val);
 int rtas_read_config(struct pci_dn *, int where, int size, u32 *val);
 void eeh_pe_state_mark(struct eeh_pe *pe, int state);
+void eeh_pe_mark_isolated(struct eeh_pe *pe);
 void eeh_pe_state_clear(struct eeh_pe *pe, int state);
 void eeh_pe_state_mark_with_cfg(struct eeh_pe *pe, int state);
 void eeh_pe_dev_mode_mark(struct eeh_pe *pe, int mode);
 
        }
 
        /* Isolate the PHB and send event */
-       eeh_pe_state_mark(phb_pe, EEH_PE_ISOLATED);
+       eeh_pe_mark_isolated(phb_pe);
        eeh_serialize_unlock(flags);
 
        pr_err("EEH: PHB#%x failure detected, location: %s\n",
         * with other functions on this device, and functions under
         * bridges.
         */
-       eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
+       eeh_pe_mark_isolated(pe);
        eeh_serialize_unlock(flags);
 
        /* Most EEH events are due to device driver bugs.  Having
                eeh_pe_state_clear(pe, EEH_PE_ISOLATED);
                break;
        case pcie_hot_reset:
-               eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
+               eeh_pe_mark_isolated(pe);
                eeh_pe_state_clear(pe, EEH_PE_CFG_BLOCKED);
                eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE);
                eeh_pe_dev_traverse(pe, eeh_disable_and_save_dev_state, dev);
                eeh_ops->reset(pe, EEH_RESET_HOT);
                break;
        case pcie_warm_reset:
-               eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
+               eeh_pe_mark_isolated(pe);
                eeh_pe_state_clear(pe, EEH_PE_CFG_BLOCKED);
                eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE);
                eeh_pe_dev_traverse(pe, eeh_disable_and_save_dev_state, dev);
 
                                phb_pe = eeh_phb_pe_get(hose);
                                if (!phb_pe) continue;
 
-                               eeh_pe_state_mark(phb_pe, EEH_PE_ISOLATED);
+                               eeh_pe_mark_isolated(phb_pe);
                        }
 
                        eeh_serialize_unlock(flags);
                        /* Purge all events of the PHB */
                        eeh_remove_event(pe, true);
 
-                       if (rc == EEH_NEXT_ERR_DEAD_PHB)
-                               eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
-                       else
-                               eeh_pe_state_mark(pe,
-                                       EEH_PE_ISOLATED | EEH_PE_RECOVERING);
+                       if (rc != EEH_NEXT_ERR_DEAD_PHB)
+                               eeh_pe_state_mark(pe, EEH_PE_RECOVERING);
+                       eeh_pe_mark_isolated(pe);
 
                        eeh_serialize_unlock(flags);
 
 
 }
 
 /**
- * __eeh_pe_state_mark - Mark the state for the PE
- * @data: EEH PE
- * @flag: state
+ * eeh_pe_state_mark - Mark specified state for PE and its associated device
+ * @pe: EEH PE
  *
- * The function is used to mark the indicated state for the given
- * PE. Also, the associated PCI devices will be put into IO frozen
- * state as well.
+ * EEH error affects the current PE and its child PEs. The function
+ * is used to mark appropriate state for the affected PEs and the
+ * associated devices.
  */
-static void *__eeh_pe_state_mark(struct eeh_pe *pe, void *flag)
+void eeh_pe_state_mark(struct eeh_pe *root, int state)
 {
-       int state = *((int *)flag);
-       struct eeh_dev *edev, *tmp;
-       struct pci_dev *pdev;
-
-       /* Keep the state of permanently removed PE intact */
-       if (pe->state & EEH_PE_REMOVED)
-               return NULL;
-
-       pe->state |= state;
-
-       /* Offline PCI devices if applicable */
-       if (!(state & EEH_PE_ISOLATED))
-               return NULL;
-
-       eeh_pe_for_each_dev(pe, edev, tmp) {
-               pdev = eeh_dev_to_pci_dev(edev);
-               if (pdev)
-                       pdev->error_state = pci_channel_io_frozen;
-       }
-
-       /* Block PCI config access if required */
-       if (pe->state & EEH_PE_CFG_RESTRICTED)
-               pe->state |= EEH_PE_CFG_BLOCKED;
+       struct eeh_pe *pe;
 
-       return NULL;
+       eeh_for_each_pe(root, pe)
+               if (!(pe->state & EEH_PE_REMOVED))
+                       pe->state |= state;
 }
+EXPORT_SYMBOL_GPL(eeh_pe_state_mark);
 
 /**
- * eeh_pe_state_mark - Mark specified state for PE and its associated device
+ * eeh_pe_mark_isolated
  * @pe: EEH PE
  *
- * EEH error affects the current PE and its child PEs. The function
- * is used to mark appropriate state for the affected PEs and the
- * associated devices.
+ * Record that a PE has been isolated by marking the PE and it's children as
+ * EEH_PE_ISOLATED (and EEH_PE_CFG_BLOCKED, if required) and their PCI devices
+ * as pci_channel_io_frozen.
  */
-void eeh_pe_state_mark(struct eeh_pe *pe, int state)
+void eeh_pe_mark_isolated(struct eeh_pe *root)
 {
-       eeh_pe_traverse(pe, __eeh_pe_state_mark, &state);
+       struct eeh_pe *pe;
+       struct eeh_dev *edev;
+       struct pci_dev *pdev;
+
+       eeh_pe_state_mark(root, EEH_PE_ISOLATED);
+       eeh_for_each_pe(root, pe) {
+               list_for_each_entry(edev, &pe->edevs, entry) {
+                       pdev = eeh_dev_to_pci_dev(edev);
+                       if (pdev)
+                               pdev->error_state = pci_channel_io_frozen;
+               }
+               /* Block PCI config access if required */
+               if (pe->state & EEH_PE_CFG_RESTRICTED)
+                       pe->state |= EEH_PE_CFG_BLOCKED;
+       }
 }
-EXPORT_SYMBOL_GPL(eeh_pe_state_mark);
+EXPORT_SYMBOL_GPL(eeh_pe_mark_isolated);
 
 static void *__eeh_pe_dev_mode_mark(struct eeh_dev *edev, void *flag)
 {
 
                          EEH_STATE_MMIO_ENABLED |
                          EEH_STATE_DMA_ENABLED);
        } else if (!(pe->state & EEH_PE_ISOLATED)) {
-               eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
+               eeh_pe_mark_isolated(pe);
                pnv_eeh_get_phb_diag(pe);
 
                if (eeh_has_flag(EEH_EARLY_DUMP_LOG))
                if (phb->freeze_pe)
                        phb->freeze_pe(phb, pe->addr);
 
-               eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
+               eeh_pe_mark_isolated(pe);
                pnv_eeh_get_phb_diag(pe);
 
                if (eeh_has_flag(EEH_EARLY_DUMP_LOG))
                if ((ret == EEH_NEXT_ERR_FROZEN_PE  ||
                    ret == EEH_NEXT_ERR_FENCED_PHB) &&
                    !((*pe)->state & EEH_PE_ISOLATED)) {
-                       eeh_pe_state_mark(*pe, EEH_PE_ISOLATED);
+                       eeh_pe_mark_isolated(*pe);
                        pnv_eeh_get_phb_diag(*pe);
 
                        if (eeh_has_flag(EEH_EARLY_DUMP_LOG))
                        }
 
                        /* We possibly migrate to another PE */
-                       eeh_pe_state_mark(*pe, EEH_PE_ISOLATED);
+                       eeh_pe_mark_isolated(*pe);
                }
 
                /*
 
                pe = edev ? edev->pe : NULL;
                if (pe) {
                        eeh_serialize_lock(&flags);
-                       eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
+                       eeh_pe_mark_isolated(pe);
                        eeh_serialize_unlock(flags);
                        eeh_pe_set_option(pe, EEH_OPT_FREEZE_PE);
                }