static void __pcie_wait_link_active(struct controller *ctrl, bool active) { int timeout = 1000; if (pciehp_check_link_active(ctrl) == active) return; while (timeout > 0) { msleep(10); timeout -= 10; if (pciehp_check_link_active(ctrl) == active) return; } ctrl_dbg(ctrl, "Data Link Layer Link Active not %s in 1000 msec\n", active ? "set" : "cleared"); }
void pciehp_handle_linkstate_change(struct slot *p_slot) { u32 event_type; struct controller *ctrl = p_slot->ctrl; /* Link Status Change */ ctrl_dbg(ctrl, "Data Link Layer State change\n"); if (pciehp_check_link_active(ctrl)) { ctrl_info(ctrl, "slot(%s): Link Up event\n", slot_name(p_slot)); event_type = INT_LINK_UP; } else { ctrl_info(ctrl, "slot(%s): Link Down event\n", slot_name(p_slot)); event_type = INT_LINK_DOWN; } queue_interrupt_event(p_slot, event_type); }