aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2006-04-18 21:06:51 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-11 14:02:27 -0700
commit04d9c1a1100b6bdeffa7e1bfc30080bdac28e183 (patch)
treee061dccae70aa1f2faec0171d8e23d56ad2b9a80 /drivers/pci/pci.c
parent8d92bc2270d67a43b1d7e94a8cb6f81f1435fe9a (diff)
downloadkernel_samsung_crespo-04d9c1a1100b6bdeffa7e1bfc30080bdac28e183.zip
kernel_samsung_crespo-04d9c1a1100b6bdeffa7e1bfc30080bdac28e183.tar.gz
kernel_samsung_crespo-04d9c1a1100b6bdeffa7e1bfc30080bdac28e183.tar.bz2
[PATCH] PCI: Improve PCI config space writeback
At least one laptop blew up on resume from suspend with a black screen due to a lack of this patch. By only writing back config space that is different, we minimise the possibility of accidents like this. Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 2329f94..d252045 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -461,9 +461,19 @@ int
pci_restore_state(struct pci_dev *dev)
{
int i;
-
- for (i = 0; i < 16; i++)
- pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]);
+ int val;
+
+ for (i = 0; i < 16; i++) {
+ pci_read_config_dword(dev, i * 4, &val);
+ if (val != dev->saved_config_space[i]) {
+ printk(KERN_DEBUG "PM: Writing back config space on "
+ "device %s at offset %x (was %x, writing %x)\n",
+ pci_name(dev), i,
+ val, (int)dev->saved_config_space[i]);
+ pci_write_config_dword(dev,i * 4,
+ dev->saved_config_space[i]);
+ }
+ }
pci_restore_msi_state(dev);
pci_restore_msix_state(dev);
return 0;