From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from acsinet15.oracle.com ([141.146.126.227]:59940 "EHLO acsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754544Ab2AUJxA (ORCPT ); Sat, 21 Jan 2012 04:53:00 -0500 From: Yinghai Lu To: Jesse Barnes Cc: Linus Torvalds , Kenji Kaneshige , Matthew Wilcox , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu , Yinghai Lu Subject: [PATCH 5/7] pciehp: Add pcie_wait_link_not_active() Date: Sat, 21 Jan 2012 01:52:17 -0800 Message-Id: <1327139539-14301-6-git-send-email-yinghai@kernel.org> In-Reply-To: <1327139539-14301-1-git-send-email-yinghai@kernel.org> References: <1327139539-14301-1-git-send-email-yinghai@kernel.org> Sender: linux-pci-owner@vger.kernel.org List-ID: Will use for link disable status checking Signed-off-by: Yinghai Lu --- drivers/pci/hotplug/pciehp_hpc.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index a1a9879..ea54aef 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -257,19 +257,30 @@ static bool check_link_active(struct controller *ctrl) return ret; } -static void pcie_wait_link_active(struct controller *ctrl) +static void __pcie_wait_link_active(struct controller *ctrl, bool active) { int timeout = 1000; - if (check_link_active(ctrl)) + if (check_link_active(ctrl) == active) return; while (timeout > 0) { msleep(10); timeout -= 10; - if (check_link_active(ctrl)) + if (check_link_active(ctrl) == active) return; } - ctrl_dbg(ctrl, "Data Link Layer Link Active not set in 1000 msec\n"); + ctrl_dbg(ctrl, "Data Link Layer Link Active not %s in 1000 msec\n", + active ? "set" : "cleared"); +} + +static void pcie_wait_link_active(struct controller *ctrl) +{ + __pcie_wait_link_active(ctrl, true); +} + +static void pcie_wait_link_not_active(struct controller *ctrl) +{ + __pcie_wait_link_active(ctrl, false); } static bool pci_bus_check_dev(struct pci_bus *bus, int devfn) -- 1.7.7