diff options
author | Dave Jones <davej@redhat.com> | 2006-04-19 00:06:51 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-11 17:02:27 -0400 |
commit | 04d9c1a1100b6bdeffa7e1bfc30080bdac28e183 (patch) | |
tree | e061dccae70aa1f2faec0171d8e23d56ad2b9a80 /drivers/pci | |
parent | 8d92bc2270d67a43b1d7e94a8cb6f81f1435fe9a (diff) |
[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')
-rw-r--r-- | drivers/pci/pci.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 2329f941a0dc..d2520451f36b 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -461,9 +461,19 @@ int | |||
461 | pci_restore_state(struct pci_dev *dev) | 461 | pci_restore_state(struct pci_dev *dev) |
462 | { | 462 | { |
463 | int i; | 463 | int i; |
464 | 464 | int val; | |
465 | for (i = 0; i < 16; i++) | 465 | |
466 | pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]); | 466 | for (i = 0; i < 16; i++) { |
467 | pci_read_config_dword(dev, i * 4, &val); | ||
468 | if (val != dev->saved_config_space[i]) { | ||
469 | printk(KERN_DEBUG "PM: Writing back config space on " | ||
470 | "device %s at offset %x (was %x, writing %x)\n", | ||
471 | pci_name(dev), i, | ||
472 | val, (int)dev->saved_config_space[i]); | ||
473 | pci_write_config_dword(dev,i * 4, | ||
474 | dev->saved_config_space[i]); | ||
475 | } | ||
476 | } | ||
467 | pci_restore_msi_state(dev); | 477 | pci_restore_msi_state(dev); |
468 | pci_restore_msix_state(dev); | 478 | pci_restore_msix_state(dev); |
469 | return 0; | 479 | return 0; |