pci_set_power_state prints a lot of error messages, patch included

From: Tobias Rupf
Date: Mon Mar 05 2007 - 16:27:18 EST


1. summary: ci_set_power_state prints a lot of error messages
2. description
KDE running with knemo enabled I get a lot of kprint error message if I switch
with CTRL-ALT-F1 to a text console, whicht make the terminal nearly unusable.
The message is:

[17179664.636000] pci_set_power_state(): 0000:00:0a.0: state=3, current
state=5
[17179665.744000] pci_set_power_state(): 0000:00:0a.0: state=3, current
state=5
[17179666.608000] pci_set_power_state(): 0000:00:0a.0: state=3, current
state=5
....

The problem seem not to be KDE-specific as reported here for Gnome:
http://lists.debian.org/debian-user/2006/11/msg00906.html. As far as I have
seen from some research on the Internet this problem does only occur with the
below mentioned card an only if a network monitor program is activ.

relevant output of lspci -vvv:

00:0a.0 Ethernet controller: 3Com Corporation 3c905 100BaseTX [Boomerang]
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B-
Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR-
Latency: 64 (750ns min, 2000ns max)
Interrupt: pin A routed to IRQ 11
Region 0: I/O ports at dc00 [size=64]
[virtual] Expansion ROM at 20000000 [disabled] [size=64K]

This card does not support any power saving features, but the driver seems to
claim the card is in state d5 (does such sate exist at all?)

3. Keywords:
pci_set_power_state, 3Com, Boomerang
4. kernel version
linux version 2.6.18.1-kanotix-1 (root@lisa) (gcc version 4.1.2 20060928
(prerelease) (Ubuntu 4.1.1-13ubuntu5)) #1 SMP PREEMPT Thu Mar 1 19:34:45 CET
2007
The problem still exists in kernel version 2.6.20, I don't know about 2.6.21.

5. output
pci_set_power_state(): 0000:00:0a.0: state=3, current state=5
.....
8.Fix / Patch
With the help of the Internet I have prepared a patch, which will check the
capabilities of the device before doing any other stuff, even before printing
the error message. This has solved the problem for me.
It will just change the order of some lines.

--- a/drivers/pci/pci.c 2006-09-20 05:42:06.000000000 +0200
+++ b/drivers/pci/pci.c 2007-02-11 09:54:00.000000000 +0100
@@ -303,17 +303,6 @@
if (state > PCI_D3hot)
state = PCI_D3hot;

- /* Validate current state:
- * Can enter D0 from any state, but if we can only go deeper
- * to sleep if we're already in a low power state
- */
- if (state != PCI_D0 && dev->current_state > state) {
- printk(KERN_ERR "%s(): %s: state=%d, current state=%d\n",
- __FUNCTION__, pci_name(dev), state, dev->current_state);
- return -EINVAL;
- } else if (dev->current_state == state)
- return 0; /* we're already there */
-
/*
* If the device or the parent bridge can't support PCI PM, ignore
* the request if we're doing anything besides putting it into D0
@@ -337,6 +326,17 @@
return -EIO;
}

+ /* Validate current state:
+ * Can enter D0 from any state, but if we can only go deeper
+ * to sleep if we're already in a low power state
+ */
+ if (state != PCI_D0 && dev->current_state > state) {
+ printk(KERN_ERR "%s(): %s: state=%d, current state=%d\n",
+ __FUNCTION__, pci_name(dev), state, dev->current_state);
+ return -EINVAL;
+ } else if (dev->current_state == state)
+ return 0; /* we're already there */
+
/* check if this device supports the desired state */
if (state == PCI_D1 && !(pmc & PCI_PM_CAP_D1))
return -EIO;



with kind regards

T. Rupf
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/