Commit 5cfdc750 authored by Bjorn Helgaas's avatar Bjorn Helgaas

Merge branch 'pci/hotplug'

- Use for_each_child_of_node() and for_each_node_by_name() instead of
  open-coding them (Qinglang Miao)

- Reduce pciehp noisiness on hot removal (Lukas Wunner)

- Remove unused assignment in shpchp (Krzysztof Wilczyński)

* pci/hotplug:
  PCI: shpchp: Remove unused 'rc' assignment
  PCI: pciehp: Reduce noisiness on hot removal
  PCI: rpadlpar: Use for_each_child_of_node() and for_each_node_by_name()
parents 28a18aec 23cce2e0
...@@ -73,10 +73,8 @@ static int board_added(struct controller *ctrl) ...@@ -73,10 +73,8 @@ static int board_added(struct controller *ctrl)
/* Check link training status */ /* Check link training status */
retval = pciehp_check_link_status(ctrl); retval = pciehp_check_link_status(ctrl);
if (retval) { if (retval)
ctrl_err(ctrl, "Failed to check link status\n");
goto err_exit; goto err_exit;
}
/* Check for a power fault */ /* Check for a power fault */
if (ctrl->power_fault_detected || pciehp_query_power_fault(ctrl)) { if (ctrl->power_fault_detected || pciehp_query_power_fault(ctrl)) {
......
...@@ -283,8 +283,6 @@ static void pcie_wait_for_presence(struct pci_dev *pdev) ...@@ -283,8 +283,6 @@ static void pcie_wait_for_presence(struct pci_dev *pdev)
msleep(10); msleep(10);
timeout -= 10; timeout -= 10;
} while (timeout > 0); } while (timeout > 0);
pci_info(pdev, "Timeout waiting for Presence Detect\n");
} }
int pciehp_check_link_status(struct controller *ctrl) int pciehp_check_link_status(struct controller *ctrl)
...@@ -293,8 +291,10 @@ int pciehp_check_link_status(struct controller *ctrl) ...@@ -293,8 +291,10 @@ int pciehp_check_link_status(struct controller *ctrl)
bool found; bool found;
u16 lnk_status; u16 lnk_status;
if (!pcie_wait_for_link(pdev, true)) if (!pcie_wait_for_link(pdev, true)) {
ctrl_info(ctrl, "Slot(%s): No link\n", slot_name(ctrl));
return -1; return -1;
}
if (ctrl->inband_presence_disabled) if (ctrl->inband_presence_disabled)
pcie_wait_for_presence(pdev); pcie_wait_for_presence(pdev);
...@@ -311,15 +311,18 @@ int pciehp_check_link_status(struct controller *ctrl) ...@@ -311,15 +311,18 @@ int pciehp_check_link_status(struct controller *ctrl)
ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status); ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status);
if ((lnk_status & PCI_EXP_LNKSTA_LT) || if ((lnk_status & PCI_EXP_LNKSTA_LT) ||
!(lnk_status & PCI_EXP_LNKSTA_NLW)) { !(lnk_status & PCI_EXP_LNKSTA_NLW)) {
ctrl_err(ctrl, "link training error: status %#06x\n", ctrl_info(ctrl, "Slot(%s): Cannot train link: status %#06x\n",
lnk_status); slot_name(ctrl), lnk_status);
return -1; return -1;
} }
pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status); pcie_update_link_speed(ctrl->pcie->port->subordinate, lnk_status);
if (!found) if (!found) {
ctrl_info(ctrl, "Slot(%s): No device found\n",
slot_name(ctrl));
return -1; return -1;
}
return 0; return 0;
} }
......
...@@ -40,13 +40,13 @@ static DEFINE_MUTEX(rpadlpar_mutex); ...@@ -40,13 +40,13 @@ static DEFINE_MUTEX(rpadlpar_mutex);
static struct device_node *find_vio_slot_node(char *drc_name) static struct device_node *find_vio_slot_node(char *drc_name)
{ {
struct device_node *parent = of_find_node_by_name(NULL, "vdevice"); struct device_node *parent = of_find_node_by_name(NULL, "vdevice");
struct device_node *dn = NULL; struct device_node *dn;
int rc; int rc;
if (!parent) if (!parent)
return NULL; return NULL;
while ((dn = of_get_next_child(parent, dn))) { for_each_child_of_node(parent, dn) {
rc = rpaphp_check_drc_props(dn, drc_name, NULL); rc = rpaphp_check_drc_props(dn, drc_name, NULL);
if (rc == 0) if (rc == 0)
break; break;
...@@ -60,10 +60,10 @@ static struct device_node *find_vio_slot_node(char *drc_name) ...@@ -60,10 +60,10 @@ static struct device_node *find_vio_slot_node(char *drc_name)
static struct device_node *find_php_slot_pci_node(char *drc_name, static struct device_node *find_php_slot_pci_node(char *drc_name,
char *drc_type) char *drc_type)
{ {
struct device_node *np = NULL; struct device_node *np;
int rc; int rc;
while ((np = of_find_node_by_name(np, "pci"))) { for_each_node_by_name(np, "pci") {
rc = rpaphp_check_drc_props(np, drc_name, drc_type); rc = rpaphp_check_drc_props(np, drc_name, drc_type);
if (rc == 0) if (rc == 0)
break; break;
......
...@@ -299,7 +299,6 @@ static int board_added(struct slot *p_slot) ...@@ -299,7 +299,6 @@ static int board_added(struct slot *p_slot)
if (p_slot->status == 0xFF) { if (p_slot->status == 0xFF) {
/* power fault occurred, but it was benign */ /* power fault occurred, but it was benign */
ctrl_dbg(ctrl, "%s: Power fault\n", __func__); ctrl_dbg(ctrl, "%s: Power fault\n", __func__);
rc = POWER_FAILURE;
p_slot->status = 0; p_slot->status = 0;
goto err_exit; goto err_exit;
} }
......
...@@ -4717,9 +4717,7 @@ static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active, ...@@ -4717,9 +4717,7 @@ static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active,
} }
if (active && ret) if (active && ret)
msleep(delay); msleep(delay);
else if (ret != active)
pci_info(pdev, "Data Link Layer Link Active not %s in 1000 msec\n",
active ? "set" : "cleared");
return ret == active; return ret == active;
} }
...@@ -4844,6 +4842,7 @@ void pci_bridge_wait_for_secondary_bus(struct pci_dev *dev) ...@@ -4844,6 +4842,7 @@ void pci_bridge_wait_for_secondary_bus(struct pci_dev *dev)
delay); delay);
if (!pcie_wait_for_link_delay(dev, true, delay)) { if (!pcie_wait_for_link_delay(dev, true, delay)) {
/* Did not train, no need to wait any further */ /* Did not train, no need to wait any further */
pci_info(dev, "Data Link Layer Link Active not set in 1000 msec\n");
return; return;
} }
} }
......
...@@ -103,7 +103,8 @@ pci_ers_result_t dpc_reset_link(struct pci_dev *pdev) ...@@ -103,7 +103,8 @@ pci_ers_result_t dpc_reset_link(struct pci_dev *pdev)
* Wait until the Link is inactive, then clear DPC Trigger Status * Wait until the Link is inactive, then clear DPC Trigger Status
* to allow the Port to leave DPC. * to allow the Port to leave DPC.
*/ */
pcie_wait_for_link(pdev, false); if (!pcie_wait_for_link(pdev, false))
pci_info(pdev, "Data Link Layer Link Active not cleared in 1000 msec\n");
if (pdev->dpc_rp_extensions && dpc_wait_rp_inactive(pdev)) if (pdev->dpc_rp_extensions && dpc_wait_rp_inactive(pdev))
return PCI_ERS_RESULT_DISCONNECT; return PCI_ERS_RESULT_DISCONNECT;
...@@ -111,8 +112,10 @@ pci_ers_result_t dpc_reset_link(struct pci_dev *pdev) ...@@ -111,8 +112,10 @@ pci_ers_result_t dpc_reset_link(struct pci_dev *pdev)
pci_write_config_word(pdev, cap + PCI_EXP_DPC_STATUS, pci_write_config_word(pdev, cap + PCI_EXP_DPC_STATUS,
PCI_EXP_DPC_STATUS_TRIGGER); PCI_EXP_DPC_STATUS_TRIGGER);
if (!pcie_wait_for_link(pdev, true)) if (!pcie_wait_for_link(pdev, true)) {
pci_info(pdev, "Data Link Layer Link Active not set in 1000 msec\n");
return PCI_ERS_RESULT_DISCONNECT; return PCI_ERS_RESULT_DISCONNECT;
}
return PCI_ERS_RESULT_RECOVERED; return PCI_ERS_RESULT_RECOVERED;
} }
......
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