tg3: Refine power management and WOL code
authorMatt Carlson <mcarlson@broadcom.com>
Tue, 4 Nov 2008 00:53:46 +0000 (16:53 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Nov 2008 00:53:46 +0000 (16:53 -0800)
commit05ac4cb7dff4515447dce6e9a56c4de6b7e426d5
tree51445add708f53d22ed919b0b7b5d6f98b102b7c
parentdf59c9403557397aafbe291533d113b752da7661
tg3: Refine power management and WOL code

Commit 12dac0756d357325b107fe6ec24921ec38661839 ("tg3: adapt tg3 to
use reworked PCI PM code") introduced the new PCI PM API to the tg3
driver.  The patch was understandably conservative, so this patch
elaborates on that work.

The patch starts by creating a single point in tg3_set_power_state()
to decide whether or not to enable WOL.  The rest of the code in
tg3_set_power_state() was then pivoted to use the result of this
decision.

The patch then makes sure the device is allowed to wakeup before
reporting whether or not WOL is currently enabled.  The final hunks of
the patch consolidate where the WOL capability and WOL enabled flags
are set to a single location.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tg3.c