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()
This commit is contained in:
Коммит
5cfdc750bc
|
@ -73,10 +73,8 @@ static int board_added(struct controller *ctrl)
|
|||
|
||||
/* Check link training status */
|
||||
retval = pciehp_check_link_status(ctrl);
|
||||
if (retval) {
|
||||
ctrl_err(ctrl, "Failed to check link status\n");
|
||||
if (retval)
|
||||
goto err_exit;
|
||||
}
|
||||
|
||||
/* Check for a power fault */
|
||||
if (ctrl->power_fault_detected || pciehp_query_power_fault(ctrl)) {
|
||||
|
|
|
@ -283,8 +283,6 @@ static void pcie_wait_for_presence(struct pci_dev *pdev)
|
|||
msleep(10);
|
||||
timeout -= 10;
|
||||
} while (timeout > 0);
|
||||
|
||||
pci_info(pdev, "Timeout waiting for Presence Detect\n");
|
||||
}
|
||||
|
||||
int pciehp_check_link_status(struct controller *ctrl)
|
||||
|
@ -293,8 +291,10 @@ int pciehp_check_link_status(struct controller *ctrl)
|
|||
bool found;
|
||||
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;
|
||||
}
|
||||
|
||||
if (ctrl->inband_presence_disabled)
|
||||
pcie_wait_for_presence(pdev);
|
||||
|
@ -311,15 +311,18 @@ int pciehp_check_link_status(struct controller *ctrl)
|
|||
ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status);
|
||||
if ((lnk_status & PCI_EXP_LNKSTA_LT) ||
|
||||
!(lnk_status & PCI_EXP_LNKSTA_NLW)) {
|
||||
ctrl_err(ctrl, "link training error: status %#06x\n",
|
||||
lnk_status);
|
||||
ctrl_info(ctrl, "Slot(%s): Cannot train link: status %#06x\n",
|
||||
slot_name(ctrl), lnk_status);
|
||||
return -1;
|
||||
}
|
||||
|
||||
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 0;
|
||||
}
|
||||
|
|
|
@ -40,13 +40,13 @@ static DEFINE_MUTEX(rpadlpar_mutex);
|
|||
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 *dn = NULL;
|
||||
struct device_node *dn;
|
||||
int rc;
|
||||
|
||||
if (!parent)
|
||||
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);
|
||||
if (rc == 0)
|
||||
break;
|
||||
|
@ -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,
|
||||
char *drc_type)
|
||||
{
|
||||
struct device_node *np = NULL;
|
||||
struct device_node *np;
|
||||
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);
|
||||
if (rc == 0)
|
||||
break;
|
||||
|
|
|
@ -299,7 +299,6 @@ static int board_added(struct slot *p_slot)
|
|||
if (p_slot->status == 0xFF) {
|
||||
/* power fault occurred, but it was benign */
|
||||
ctrl_dbg(ctrl, "%s: Power fault\n", __func__);
|
||||
rc = POWER_FAILURE;
|
||||
p_slot->status = 0;
|
||||
goto err_exit;
|
||||
}
|
||||
|
|
|
@ -4717,9 +4717,7 @@ static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active,
|
|||
}
|
||||
if (active && ret)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -4844,6 +4842,7 @@ void pci_bridge_wait_for_secondary_bus(struct pci_dev *dev)
|
|||
delay);
|
||||
if (!pcie_wait_for_link_delay(dev, true, delay)) {
|
||||
/* Did not train, no need to wait any further */
|
||||
pci_info(dev, "Data Link Layer Link Active not set in 1000 msec\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
* 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))
|
||||
return PCI_ERS_RESULT_DISCONNECT;
|
||||
|
@ -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_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_RECOVERED;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче