diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-01-27 13:55:13 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2012-02-14 11:45:01 -0500 |
commit | bffe4f72fcdd92bfb24909d586d1636e5cec500d (patch) | |
tree | 838c8a55fcafd065a01c2b054119f483e25c6e78 /drivers/pci/hotplug | |
parent | 4e2ce405b24eef9f4cc947bf5f430ca27b474f1f (diff) |
PCI: pciehp: Add pcie_wait_link_not_active()
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>
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r-- | 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 a8c1f74a1e36..4ebdc1de2cb4 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) | |||
257 | return ret; | 257 | return ret; |
258 | } | 258 | } |
259 | 259 | ||
260 | static void pcie_wait_link_active(struct controller *ctrl) | 260 | static void __pcie_wait_link_active(struct controller *ctrl, bool active) |
261 | { | 261 | { |
262 | int timeout = 1000; | 262 | int timeout = 1000; |
263 | 263 | ||
264 | if (check_link_active(ctrl)) | 264 | if (check_link_active(ctrl) == active) |
265 | return; | 265 | return; |
266 | while (timeout > 0) { | 266 | while (timeout > 0) { |
267 | msleep(10); | 267 | msleep(10); |
268 | timeout -= 10; | 268 | timeout -= 10; |
269 | if (check_link_active(ctrl)) | 269 | if (check_link_active(ctrl) == active) |
270 | return; | 270 | return; |
271 | } | 271 | } |
272 | ctrl_dbg(ctrl, "Data Link Layer Link Active not set in 1000 msec\n"); | 272 | ctrl_dbg(ctrl, "Data Link Layer Link Active not %s in 1000 msec\n", |
273 | active ? "set" : "cleared"); | ||
274 | } | ||
275 | |||
276 | static void pcie_wait_link_active(struct controller *ctrl) | ||
277 | { | ||
278 | __pcie_wait_link_active(ctrl, true); | ||
279 | } | ||
280 | |||
281 | static void pcie_wait_link_not_active(struct controller *ctrl) | ||
282 | { | ||
283 | __pcie_wait_link_active(ctrl, false); | ||
273 | } | 284 | } |
274 | 285 | ||
275 | static bool pci_bus_check_dev(struct pci_bus *bus, int devfn) | 286 | static bool pci_bus_check_dev(struct pci_bus *bus, int devfn) |