aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/eeh.c
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2015-03-17 01:15:08 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2015-03-23 22:15:53 -0400
commitc6406d8fbb014bebdfb5bf3c244548958aec7379 (patch)
treed472e1f82ffcaec3d9dd03bd34f11fdea21fdb96 /arch/powerpc/kernel/eeh.c
parent0bd785873c6a6c9bd50d2ae19862f69ee5759fb9 (diff)
powerpc/eeh: Remove device_node dependency
The patch removes struct eeh_dev::dn and the corresponding helper functions: eeh_dev_to_of_node() and of_node_to_eeh_dev(). Instead, eeh_dev_to_pdn() and pdn_to_eeh_dev() should be used to get the pdn, which might contain device_node on PowerNV platform. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/eeh.c')
-rw-r--r--arch/powerpc/kernel/eeh.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 1fd2566c87f1..76253eb146be 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -418,11 +418,11 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
418 int ret; 418 int ret;
419 int active_flags = (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE); 419 int active_flags = (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE);
420 unsigned long flags; 420 unsigned long flags;
421 struct device_node *dn; 421 struct pci_dn *pdn;
422 struct pci_dev *dev; 422 struct pci_dev *dev;
423 struct eeh_pe *pe, *parent_pe, *phb_pe; 423 struct eeh_pe *pe, *parent_pe, *phb_pe;
424 int rc = 0; 424 int rc = 0;
425 const char *location; 425 const char *location = NULL;
426 426
427 eeh_stats.total_mmio_ffs++; 427 eeh_stats.total_mmio_ffs++;
428 428
@@ -433,15 +433,14 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
433 eeh_stats.no_dn++; 433 eeh_stats.no_dn++;
434 return 0; 434 return 0;
435 } 435 }
436 dn = eeh_dev_to_of_node(edev);
437 dev = eeh_dev_to_pci_dev(edev); 436 dev = eeh_dev_to_pci_dev(edev);
438 pe = eeh_dev_to_pe(edev); 437 pe = eeh_dev_to_pe(edev);
439 438
440 /* Access to IO BARs might get this far and still not want checking. */ 439 /* Access to IO BARs might get this far and still not want checking. */
441 if (!pe) { 440 if (!pe) {
442 eeh_stats.ignored_check++; 441 eeh_stats.ignored_check++;
443 pr_debug("EEH: Ignored check for %s %s\n", 442 pr_debug("EEH: Ignored check for %s\n",
444 eeh_pci_name(dev), dn->full_name); 443 eeh_pci_name(dev));
445 return 0; 444 return 0;
446 } 445 }
447 446
@@ -477,10 +476,13 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
477 if (pe->state & EEH_PE_ISOLATED) { 476 if (pe->state & EEH_PE_ISOLATED) {
478 pe->check_count++; 477 pe->check_count++;
479 if (pe->check_count % EEH_MAX_FAILS == 0) { 478 if (pe->check_count % EEH_MAX_FAILS == 0) {
480 location = of_get_property(dn, "ibm,loc-code", NULL); 479 pdn = eeh_dev_to_pdn(edev);
480 if (pdn->node)
481 location = of_get_property(pdn->node, "ibm,loc-code", NULL);
481 printk(KERN_ERR "EEH: %d reads ignored for recovering device at " 482 printk(KERN_ERR "EEH: %d reads ignored for recovering device at "
482 "location=%s driver=%s pci addr=%s\n", 483 "location=%s driver=%s pci addr=%s\n",
483 pe->check_count, location, 484 pe->check_count,
485 location ? location : "unknown",
484 eeh_driver_name(dev), eeh_pci_name(dev)); 486 eeh_driver_name(dev), eeh_pci_name(dev));
485 printk(KERN_ERR "EEH: Might be infinite loop in %s driver\n", 487 printk(KERN_ERR "EEH: Might be infinite loop in %s driver\n",
486 eeh_driver_name(dev)); 488 eeh_driver_name(dev));
@@ -1035,7 +1037,7 @@ int eeh_init(void)
1035core_initcall_sync(eeh_init); 1037core_initcall_sync(eeh_init);
1036 1038
1037/** 1039/**
1038 * eeh_add_device_early - Enable EEH for the indicated device_node 1040 * eeh_add_device_early - Enable EEH for the indicated device node
1039 * @pdn: PCI device node for which to set up EEH 1041 * @pdn: PCI device node for which to set up EEH
1040 * 1042 *
1041 * This routine must be used to perform EEH initialization for PCI 1043 * This routine must be used to perform EEH initialization for PCI
@@ -1093,7 +1095,7 @@ EXPORT_SYMBOL_GPL(eeh_add_device_tree_early);
1093 */ 1095 */
1094void eeh_add_device_late(struct pci_dev *dev) 1096void eeh_add_device_late(struct pci_dev *dev)
1095{ 1097{
1096 struct device_node *dn; 1098 struct pci_dn *pdn;
1097 struct eeh_dev *edev; 1099 struct eeh_dev *edev;
1098 1100
1099 if (!dev || !eeh_enabled()) 1101 if (!dev || !eeh_enabled())
@@ -1101,8 +1103,8 @@ void eeh_add_device_late(struct pci_dev *dev)
1101 1103
1102 pr_debug("EEH: Adding device %s\n", pci_name(dev)); 1104 pr_debug("EEH: Adding device %s\n", pci_name(dev));
1103 1105
1104 dn = pci_device_to_OF_node(dev); 1106 pdn = pci_get_pdn_by_devfn(dev->bus, dev->devfn);
1105 edev = of_node_to_eeh_dev(dn); 1107 edev = pdn_to_eeh_dev(pdn);
1106 if (edev->pdev == dev) { 1108 if (edev->pdev == dev) {
1107 pr_debug("EEH: Already referenced !\n"); 1109 pr_debug("EEH: Already referenced !\n");
1108 return; 1110 return;