netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 3Com PCI 3c905 causes annoying pci_set_power_state() messages
@ 2007-05-07  7:30 Bjørn Mork
  0 siblings, 0 replies; 2+ messages in thread
From: Bjørn Mork @ 2007-05-07  7:30 UTC (permalink / raw)
  To: netdev

[-- Attachment #1: Type: text/plain, Size: 1383 bytes --]

[previously posted to linux-net@vger.kernel.org, but resent here after a
helpful hint that this is the proper list for such messages.  Thanks]

I don't know if this is the correct place for 3c59x bugs.  Couldn't find
a maintainer entry for it.  Please redirect as appropriate.

pci_set_power_state() is a bit weird, causing a failure if a device
doesn't support PM and the driver tries to

 1) save it's power_state, 
 2) wake up and do something, and 
 3) then reset to the saved state.

The 3c59x driver does this in it's ioctl function.


pci_set_power_state() will never set current_state for such devices,
causing them to remain in PCI_UNKNOWN (5) forever.  But if you try to
set the state to PCI_UNKNOWN, bounding will kick in, limiting the state
to PCI_D3hot (3).  Then pci_set_power_state() will complain because 
PCI_D3hot < current_state, printing useless messages like this:

 pci_set_power_state(): 0000:00:09.0: state=3, current state=5
 pci_set_power_state(): 0000:00:09.0: state=3, current state=5

and returning -EINVAL.

I believe this is wrong because pci_set_power_state() is supposed to
return -EIO if device does not support PCI PM.

But the drivers should probably also take care, not to call 
pci_set_power_state() requesting PCI_UNKNOWN as the new state.
The attached patch against 2.6.21.1 fixes this for 3c905.


Bjørn


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: linux-2.6.21.1.3c59x.c.diff --]
[-- Type: text/x-diff, Size: 425 bytes --]

--- linux-2.6.21.1/drivers/net/3c59x.c.orig	2007-04-27 14:18:23.000000000 +0200
+++ linux-2.6.21.1/drivers/net/3c59x.c	2007-05-05 00:00:41.000000000 +0200
@@ -2903,7 +2903,7 @@
 	unsigned long flags;
 	int state = 0;
 
-	if(VORTEX_PCI(vp))
+	if(VORTEX_PCI(vp) && pci_find_capability(VORTEX_PCI(vp), PCI_CAP_ID_PM)) 
 		state = VORTEX_PCI(vp)->current_state;
 
 	/* The kernel core really should have pci_get_power_state() */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] 3Com PCI 3c905 causes annoying pci_set_power_state() messages
       [not found] <87ejlwmd8k.fsf@obelix.mork.no>
@ 2007-05-08  5:40 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2007-05-08  5:40 UTC (permalink / raw)
  To: Bjørn Mork; +Cc: netdev, Greg KH

Bjørn Mork wrote:
> I don't know if this is the correct place for 3c59x bugs.  Couldn't find
> a maintainer entry for it.  Please redirect as appropriate.
> 
> pci_set_power_state() is a bit weird, causing a failure if a device
> doesn't support PM and the driver tries to
> 
>  1) save it's power_state, 
>  2) wake up and do something, and 
>  3) then reset to the saved state.
> 
> The 3c59x driver does this in it's ioctl function.
> 
> 
> pci_set_power_state() will never set current_state for such devices,
> causing them to remain in PCI_UNKNOWN (5) forever.  But if you try to
> set the state to PCI_UNKNOWN, bounding will kick in, limiting the state
> to PCI_D3hot (3).  Then pci_set_power_state() will complain because 
> PCI_D3hot < current_state, printing useless messages like this:
> 
>  pci_set_power_state(): 0000:00:09.0: state=3, current state=5
>  pci_set_power_state(): 0000:00:09.0: state=3, current state=5
> 
> and returning -EINVAL.
> 
> I believe this is wrong because pci_set_power_state() is supposed to
> return -EIO if device does not support PCI PM.

Yes, please fix PCI.

	Jeff




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-08  5:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87ejlwmd8k.fsf@obelix.mork.no>
2007-05-08  5:40 ` [PATCH] 3Com PCI 3c905 causes annoying pci_set_power_state() messages Jeff Garzik
2007-05-07  7:30 Bjørn Mork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).