diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-06-08 15:23:51 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-07-30 09:29:09 -0700 |
commit | f3ec4f87d607f40497afdb5ac03f11e2ea253d52 (patch) | |
tree | b485337aee10cb1c0fcb1593d8947b5370aa73ff /drivers/net/e1000e | |
parent | a2dccdb2055abeb8a7ce8e45e5f83de9c980a00c (diff) | |
download | blackbird-op-linux-f3ec4f87d607f40497afdb5ac03f11e2ea253d52.tar.gz blackbird-op-linux-f3ec4f87d607f40497afdb5ac03f11e2ea253d52.zip |
PCI: change device runtime PM settings for probe and remove
This patch (as1388) changes the way the PCI core handles runtime PM
settings when probing or unbinding drivers. Now the core will make
sure the device is enabled for runtime PM, with a usage count >= 1,
when a driver is probed. It does the same when calling a driver's
remove method.
If the driver wants to use runtime PM, all it has to do is call
pm_runtime_pu_noidle() near the end of its probe routine (to cancel
the core's usage increment) and pm_runtime_get_noresume() near the
start of its remove routine (to restore the usage count). It does not
need to mess around with setting the runtime state to enabled,
disabled, active, or suspended.
The patch updates e1000e and r8169, the only PCI drivers that already
use the existing runtime PM interface.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r-- | drivers/net/e1000e/netdev.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 57a7e41da69e..4afc8dd9b935 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -5721,11 +5721,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, e1000_print_device_info(adapter); - if (pci_dev_run_wake(pdev)) { - pm_runtime_set_active(&pdev->dev); - pm_runtime_enable(&pdev->dev); - } - pm_schedule_suspend(&pdev->dev, MSEC_PER_SEC); + if (pci_dev_run_wake(pdev)) + pm_runtime_put_noidle(&pdev->dev); return 0; @@ -5771,8 +5768,6 @@ static void __devexit e1000_remove(struct pci_dev *pdev) struct e1000_adapter *adapter = netdev_priv(netdev); bool down = test_bit(__E1000_DOWN, &adapter->state); - pm_runtime_get_sync(&pdev->dev); - /* * flush_scheduled work may reschedule our watchdog task, so * explicitly disable watchdog tasks from being rescheduled @@ -5797,11 +5792,8 @@ static void __devexit e1000_remove(struct pci_dev *pdev) clear_bit(__E1000_DOWN, &adapter->state); unregister_netdev(netdev); - if (pci_dev_run_wake(pdev)) { - pm_runtime_disable(&pdev->dev); - pm_runtime_set_suspended(&pdev->dev); - } - pm_runtime_put_noidle(&pdev->dev); + if (pci_dev_run_wake(pdev)) + pm_runtime_get_noresume(&pdev->dev); /* * Release control of h/w to f/w. If f/w is AMT enabled, this |