]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
PCI: pciehp: Add pcie_wait_link_not_active()
authorYinghai Lu <yinghai@kernel.org>
Fri, 27 Jan 2012 18:55:13 +0000 (10:55 -0800)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Tue, 14 Feb 2012 16:45:01 +0000 (08:45 -0800)
Will use it for link disable status checking.

Signed-off-by: Yinghai Lu <yinghai.lu@oracle.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/hotplug/pciehp_hpc.c

index a8c1f74a1e367d7ec2d3aa3afcdcb551369f76a2..4ebdc1de2cb4dfe10902ff9f1ce6061b1071226c 100644 (file)
@@ -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)