[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#402447: [patch] proper fix for pci_set_power_state()



The feedback from the netdev list is that this should be fixed in the
PCI subsystem instead.  Attached is a suggested patch against the
current stable kernel source (2.6.18.dfsg.1-12etch1).


Bjørn


--- linux-source-2.6.18/drivers/pci/pci.c.orig	2006-09-20 05:42:06.000000000 +0200
+++ linux-source-2.6.18/drivers/pci/pci.c	2007-05-10 21:46:21.000000000 +0200
@@ -299,6 +299,13 @@
 	int pm, need_restore = 0;
 	u16 pmcsr, pmc;
 
+	/* find PCI PM capability in list */
+	pm = pci_find_capability(dev, PCI_CAP_ID_PM);
+	
+	/* abort if the device doesn't support PM capabilities */
+	if (!pm)
+		return -EIO; 
+
 	/* bound the state we're entering */
 	if (state > PCI_D3hot)
 		state = PCI_D3hot;
@@ -322,13 +329,6 @@
 	if ((state == PCI_D1 || state == PCI_D2) && pci_no_d1d2(dev))
 		return 0;
 
-	/* find PCI PM capability in list */
-	pm = pci_find_capability(dev, PCI_CAP_ID_PM);
-	
-	/* abort if the device doesn't support PM capabilities */
-	if (!pm)
-		return -EIO; 
-
 	pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc);
 	if ((pmc & PCI_PM_CAP_VER_MASK) > 3) {
 		printk(KERN_DEBUG

Reply to: