]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: Fix regression in pci_restore_state(), v3
authorRafael J. Wysocki <rjw@sisk.pl>
Sun, 15 Apr 2012 19:40:40 +0000 (21:40 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 15 Apr 2012 20:06:29 +0000 (13:06 -0700)
commitb8d6f0a8f15ea2460b2671144b69d99dc6b8a519
tree03da364fee4f182d3e0e2f98e8e20519c0b040b7
parent20af538eef33505f2649ebf6ce63fb23894af3e4
PCI: Fix regression in pci_restore_state(), v3

Commit b446fce748f0 ("PCI: check for pci bar restore completion and
retry") attempted to address problems with PCI BAR restoration on
systems where FLR had not been completed before pci_restore_state() was
called, but it did that in an utterly wrong way.

First off, instead of retrying the writes for the BAR registers only, it
did that for all of the PCI config space of the device, including the
status register (whose value after the write quite obviously need not be
the same as the written one).  Second, it added arbitrary delay to
pci_restore_state() even for systems where the PCI config space
restoration was successful at first attempt.  Finally, the mdelay(10) it
added to every iteration of the writing loop was way too much of a delay
for any reasonable device.

All of this actually caused resume failures for some devices on Mikko's
system.

To fix the regression, make pci_restore_state() only retry the writes
for BAR registers and only wait if the first read from the register
doesn't return the written value.  Additionaly, make it wait for 1 ms,
instead of 10 ms, after every failing attempt to write into config
space.

Reported-by: Mikko Vinni <mmvinni@yahoo.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/pci/pci.c