PCI: Use msleep instead of cpu_relax during ASPM link retraining
authorAndrew Patterson <andrew.patterson@hp.com>
Mon, 5 Jan 2009 23:21:04 +0000 (16:21 -0700)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Wed, 7 Jan 2009 19:13:28 +0000 (11:13 -0800)
commit987a4c783a8bbf3baf554e6b8ff588b26e06e020
tree68cae4e999c8f318bf3f95ff703d36699b2061ab
parentd9347371c538544a7309d5b6475ec011d98d40e6
PCI: Use msleep instead of cpu_relax during ASPM link retraining

The cpu_relax() function can be a noop on certain architectures like
IA-64 when CPU threads are disabled, so use msleep instead during link
retraining busy/wait loop.

Introduce define LINK_RETRAIN_TIMEOUT instead of hard-coding timeout in
pcie_aspm_configure_common_clock.

Use time_after() to avoid jiffy wraparound when checking for expired
timeout.

After timeout expires, recheck link status register link training bit
instead of checking for expired timeout to avoid possible false
positive.

Note that Matthew Wilcox came up with the first rough version of this
patch.

Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/pcie/aspm.c