Commit 80e65b00 authored by Sam Bobroff's avatar Sam Bobroff Committed by Michael Ellerman

powerpc/eeh: Cleanup list_head field names

Instances of struct eeh_pe are placed in a tree structure using the
fields "child_list" and "child", so place these next to each other
in the definition.

The field "child" is a list entry, so remove the unnecessary and
misleading use of the list initializer, LIST_HEAD(), on it.

The eeh_dev struct contains two list entry fields, called "list" and
"rmv_list". Rename them to "entry" and "rmv_entry" and, as above, stop
initializing them with LIST_HEAD().
Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent bf773df9
...@@ -98,13 +98,13 @@ struct eeh_pe { ...@@ -98,13 +98,13 @@ struct eeh_pe {
atomic_t pass_dev_cnt; /* Count of passed through devs */ atomic_t pass_dev_cnt; /* Count of passed through devs */
struct eeh_pe *parent; /* Parent PE */ struct eeh_pe *parent; /* Parent PE */
void *data; /* PE auxillary data */ void *data; /* PE auxillary data */
struct list_head child_list; /* Link PE to the child list */ struct list_head child_list; /* List of PEs below this PE */
struct list_head edevs; /* Link list of EEH devices */ struct list_head child; /* Memb. child_list/eeh_phb_pe */
struct list_head child; /* Child PEs */ struct list_head edevs; /* List of eeh_dev in this PE */
}; };
#define eeh_pe_for_each_dev(pe, edev, tmp) \ #define eeh_pe_for_each_dev(pe, edev, tmp) \
list_for_each_entry_safe(edev, tmp, &pe->edevs, list) list_for_each_entry_safe(edev, tmp, &pe->edevs, entry)
#define eeh_for_each_pe(root, pe) \ #define eeh_for_each_pe(root, pe) \
for (pe = root; pe; pe = eeh_pe_next(pe, root)) for (pe = root; pe; pe = eeh_pe_next(pe, root))
...@@ -141,8 +141,8 @@ struct eeh_dev { ...@@ -141,8 +141,8 @@ struct eeh_dev {
int aer_cap; /* Saved AER capability */ int aer_cap; /* Saved AER capability */
int af_cap; /* Saved AF capability */ int af_cap; /* Saved AF capability */
struct eeh_pe *pe; /* Associated PE */ struct eeh_pe *pe; /* Associated PE */
struct list_head list; /* Form link list in the PE */ struct list_head entry; /* Membership in eeh_pe.edevs */
struct list_head rmv_list; /* Record the removed edevs */ struct list_head rmv_entry; /* Membership in rmv_list */
struct pci_dn *pdn; /* Associated PCI device node */ struct pci_dn *pdn; /* Associated PCI device node */
struct pci_dev *pdev; /* Associated PCI device */ struct pci_dev *pdev; /* Associated PCI device */
bool in_error; /* Error flag for edev */ bool in_error; /* Error flag for edev */
......
...@@ -60,8 +60,6 @@ struct eeh_dev *eeh_dev_init(struct pci_dn *pdn) ...@@ -60,8 +60,6 @@ struct eeh_dev *eeh_dev_init(struct pci_dn *pdn)
/* Associate EEH device with OF node */ /* Associate EEH device with OF node */
pdn->edev = edev; pdn->edev = edev;
edev->pdn = pdn; edev->pdn = pdn;
INIT_LIST_HEAD(&edev->list);
INIT_LIST_HEAD(&edev->rmv_list);
return edev; return edev;
} }
......
...@@ -404,7 +404,7 @@ static void *eeh_dev_restore_state(struct eeh_dev *edev, void *userdata) ...@@ -404,7 +404,7 @@ static void *eeh_dev_restore_state(struct eeh_dev *edev, void *userdata)
* EEH device is created. * EEH device is created.
*/ */
if (edev->pe && (edev->pe->state & EEH_PE_CFG_RESTRICTED)) { if (edev->pe && (edev->pe->state & EEH_PE_CFG_RESTRICTED)) {
if (list_is_last(&edev->list, &edev->pe->edevs)) if (list_is_last(&edev->entry, &edev->pe->edevs))
eeh_pe_restore_bars(edev->pe); eeh_pe_restore_bars(edev->pe);
return NULL; return NULL;
...@@ -560,7 +560,7 @@ static void *eeh_rmv_device(struct eeh_dev *edev, void *userdata) ...@@ -560,7 +560,7 @@ static void *eeh_rmv_device(struct eeh_dev *edev, void *userdata)
pdn->pe_number = IODA_INVALID_PE; pdn->pe_number = IODA_INVALID_PE;
#endif #endif
if (rmv_data) if (rmv_data)
list_add(&edev->rmv_list, &rmv_data->edev_list); list_add(&edev->rmv_entry, &rmv_data->edev_list);
} else { } else {
pci_lock_rescan_remove(); pci_lock_rescan_remove();
pci_stop_and_remove_bus_device(dev); pci_stop_and_remove_bus_device(dev);
...@@ -739,7 +739,7 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus, ...@@ -739,7 +739,7 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus,
* PE. We should disconnect it so the binding can be * PE. We should disconnect it so the binding can be
* rebuilt when adding PCI devices. * rebuilt when adding PCI devices.
*/ */
edev = list_first_entry(&pe->edevs, struct eeh_dev, list); edev = list_first_entry(&pe->edevs, struct eeh_dev, entry);
eeh_pe_traverse(pe, eeh_pe_detach_dev, NULL); eeh_pe_traverse(pe, eeh_pe_detach_dev, NULL);
if (pe->type & EEH_PE_VF) { if (pe->type & EEH_PE_VF) {
eeh_add_virt_device(edev); eeh_add_virt_device(edev);
...@@ -934,9 +934,9 @@ void eeh_handle_normal_event(struct eeh_pe *pe) ...@@ -934,9 +934,9 @@ void eeh_handle_normal_event(struct eeh_pe *pe)
* For those hot removed VFs, we should add back them after PF get * For those hot removed VFs, we should add back them after PF get
* recovered properly. * recovered properly.
*/ */
list_for_each_entry_safe(edev, tmp, &rmv_data.edev_list, rmv_list) { list_for_each_entry_safe(edev, tmp, &rmv_data.edev_list, rmv_entry) {
eeh_add_virt_device(edev); eeh_add_virt_device(edev);
list_del(&edev->rmv_list); list_del(&edev->rmv_entry);
} }
/* Tell all device drivers that they can resume operations */ /* Tell all device drivers that they can resume operations */
......
...@@ -75,7 +75,6 @@ static struct eeh_pe *eeh_pe_alloc(struct pci_controller *phb, int type) ...@@ -75,7 +75,6 @@ static struct eeh_pe *eeh_pe_alloc(struct pci_controller *phb, int type)
pe->type = type; pe->type = type;
pe->phb = phb; pe->phb = phb;
INIT_LIST_HEAD(&pe->child_list); INIT_LIST_HEAD(&pe->child_list);
INIT_LIST_HEAD(&pe->child);
INIT_LIST_HEAD(&pe->edevs); INIT_LIST_HEAD(&pe->edevs);
pe->data = (void *)pe + ALIGN(sizeof(struct eeh_pe), pe->data = (void *)pe + ALIGN(sizeof(struct eeh_pe),
...@@ -360,7 +359,7 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) ...@@ -360,7 +359,7 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
edev->pe = pe; edev->pe = pe;
/* Put the edev to PE */ /* Put the edev to PE */
list_add_tail(&edev->list, &pe->edevs); list_add_tail(&edev->entry, &pe->edevs);
pr_debug("EEH: Add %04x:%02x:%02x.%01x to Bus PE#%x\n", pr_debug("EEH: Add %04x:%02x:%02x.%01x to Bus PE#%x\n",
pdn->phb->global_number, pdn->phb->global_number,
pdn->busno, pdn->busno,
...@@ -369,7 +368,7 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) ...@@ -369,7 +368,7 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
pe->addr); pe->addr);
return 0; return 0;
} else if (pe && (pe->type & EEH_PE_INVALID)) { } else if (pe && (pe->type & EEH_PE_INVALID)) {
list_add_tail(&edev->list, &pe->edevs); list_add_tail(&edev->entry, &pe->edevs);
edev->pe = pe; edev->pe = pe;
/* /*
* We're running to here because of PCI hotplug caused by * We're running to here because of PCI hotplug caused by
...@@ -429,7 +428,7 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev) ...@@ -429,7 +428,7 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
* link the EEH device accordingly. * link the EEH device accordingly.
*/ */
list_add_tail(&pe->child, &parent->child_list); list_add_tail(&pe->child, &parent->child_list);
list_add_tail(&edev->list, &pe->edevs); list_add_tail(&edev->entry, &pe->edevs);
edev->pe = pe; edev->pe = pe;
pr_debug("EEH: Add %04x:%02x:%02x.%01x to " pr_debug("EEH: Add %04x:%02x:%02x.%01x to "
"Device PE#%x, Parent PE#%x\n", "Device PE#%x, Parent PE#%x\n",
...@@ -469,7 +468,7 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev) ...@@ -469,7 +468,7 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev)
/* Remove the EEH device */ /* Remove the EEH device */
pe = eeh_dev_to_pe(edev); pe = eeh_dev_to_pe(edev);
edev->pe = NULL; edev->pe = NULL;
list_del(&edev->list); list_del(&edev->entry);
/* /*
* Check if the parent PE includes any EEH devices. * Check if the parent PE includes any EEH devices.
...@@ -945,7 +944,7 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe) ...@@ -945,7 +944,7 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe)
return pe->bus; return pe->bus;
/* Retrieve the parent PCI bus of first (top) PCI device */ /* Retrieve the parent PCI bus of first (top) PCI device */
edev = list_first_entry_or_null(&pe->edevs, struct eeh_dev, list); edev = list_first_entry_or_null(&pe->edevs, struct eeh_dev, entry);
pdev = eeh_dev_to_pci_dev(edev); pdev = eeh_dev_to_pci_dev(edev);
if (pdev) if (pdev)
return pdev->bus; return pdev->bus;
......
...@@ -1040,7 +1040,7 @@ static int pnv_eeh_reset_vf_pe(struct eeh_pe *pe, int option) ...@@ -1040,7 +1040,7 @@ static int pnv_eeh_reset_vf_pe(struct eeh_pe *pe, int option)
int ret; int ret;
/* The VF PE should have only one child device */ /* The VF PE should have only one child device */
edev = list_first_entry_or_null(&pe->edevs, struct eeh_dev, list); edev = list_first_entry_or_null(&pe->edevs, struct eeh_dev, entry);
pdn = eeh_dev_to_pdn(edev); pdn = eeh_dev_to_pdn(edev);
if (!pdn) if (!pdn)
return -ENXIO; return -ENXIO;
......
...@@ -203,7 +203,8 @@ static struct device_node *find_pe_dn(struct pci_dev *dev, int *total) ...@@ -203,7 +203,8 @@ static struct device_node *find_pe_dn(struct pci_dev *dev, int *total)
/* Get the top level device in the PE */ /* Get the top level device in the PE */
edev = pdn_to_eeh_dev(PCI_DN(dn)); edev = pdn_to_eeh_dev(PCI_DN(dn));
if (edev->pe) if (edev->pe)
edev = list_first_entry(&edev->pe->edevs, struct eeh_dev, list); edev = list_first_entry(&edev->pe->edevs, struct eeh_dev,
entry);
dn = pci_device_to_OF_node(edev->pdev); dn = pci_device_to_OF_node(edev->pdev);
if (!dn) if (!dn)
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment