diff options
author | Brice Goglin <brice@myri.com> | 2006-12-18 05:52:02 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-12-26 16:28:20 -0500 |
commit | 83f6e1524586119df84f70b7127688c57349664a (patch) | |
tree | 20c87534d015b854ec921560dc209e53c74eda20 /drivers/net | |
parent | 3621cec5b5847348248e749c647219f409550f2f (diff) |
myri10ge: no need to save MSI and PCIe state in the driver
The PCI MSI and express state are already saved and restored by the
current versions of pci_save_state/pci_restore_state.
Therefore it is no longer necessary for the driver to do it.
Signed-off-by: Brice Goglin <brice@myri.com>
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/myri10ge/myri10ge.c | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index 1ce3c9e5c890..9bc5dab949fd 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -199,8 +199,6 @@ struct myri10ge_priv { | |||
199 | unsigned long serial_number; | 199 | unsigned long serial_number; |
200 | int vendor_specific_offset; | 200 | int vendor_specific_offset; |
201 | int fw_multicast_support; | 201 | int fw_multicast_support; |
202 | u32 devctl; | ||
203 | u16 msi_flags; | ||
204 | u32 read_dma; | 202 | u32 read_dma; |
205 | u32 write_dma; | 203 | u32 write_dma; |
206 | u32 read_write_dma; | 204 | u32 read_write_dma; |
@@ -2520,34 +2518,6 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp) | |||
2520 | } | 2518 | } |
2521 | } | 2519 | } |
2522 | 2520 | ||
2523 | static void myri10ge_save_state(struct myri10ge_priv *mgp) | ||
2524 | { | ||
2525 | struct pci_dev *pdev = mgp->pdev; | ||
2526 | int cap; | ||
2527 | |||
2528 | pci_save_state(pdev); | ||
2529 | /* now save PCIe and MSI state that Linux will not | ||
2530 | * save for us */ | ||
2531 | cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); | ||
2532 | pci_read_config_dword(pdev, cap + PCI_EXP_DEVCTL, &mgp->devctl); | ||
2533 | cap = pci_find_capability(pdev, PCI_CAP_ID_MSI); | ||
2534 | pci_read_config_word(pdev, cap + PCI_MSI_FLAGS, &mgp->msi_flags); | ||
2535 | } | ||
2536 | |||
2537 | static void myri10ge_restore_state(struct myri10ge_priv *mgp) | ||
2538 | { | ||
2539 | struct pci_dev *pdev = mgp->pdev; | ||
2540 | int cap; | ||
2541 | |||
2542 | /* restore PCIe and MSI state that linux will not */ | ||
2543 | cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); | ||
2544 | pci_write_config_dword(pdev, cap + PCI_CAP_ID_EXP, mgp->devctl); | ||
2545 | cap = pci_find_capability(pdev, PCI_CAP_ID_MSI); | ||
2546 | pci_write_config_word(pdev, cap + PCI_MSI_FLAGS, mgp->msi_flags); | ||
2547 | |||
2548 | pci_restore_state(pdev); | ||
2549 | } | ||
2550 | |||
2551 | #ifdef CONFIG_PM | 2521 | #ifdef CONFIG_PM |
2552 | 2522 | ||
2553 | static int myri10ge_suspend(struct pci_dev *pdev, pm_message_t state) | 2523 | static int myri10ge_suspend(struct pci_dev *pdev, pm_message_t state) |
@@ -2568,7 +2538,7 @@ static int myri10ge_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2568 | rtnl_unlock(); | 2538 | rtnl_unlock(); |
2569 | } | 2539 | } |
2570 | myri10ge_dummy_rdma(mgp, 0); | 2540 | myri10ge_dummy_rdma(mgp, 0); |
2571 | myri10ge_save_state(mgp); | 2541 | pci_save_state(pdev); |
2572 | pci_disable_device(pdev); | 2542 | pci_disable_device(pdev); |
2573 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 2543 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
2574 | return 0; | 2544 | return 0; |
@@ -2593,7 +2563,8 @@ static int myri10ge_resume(struct pci_dev *pdev) | |||
2593 | mgp->dev->name); | 2563 | mgp->dev->name); |
2594 | return -EIO; | 2564 | return -EIO; |
2595 | } | 2565 | } |
2596 | myri10ge_restore_state(mgp); | 2566 | |
2567 | pci_restore_state(pdev); | ||
2597 | 2568 | ||
2598 | status = pci_enable_device(pdev); | 2569 | status = pci_enable_device(pdev); |
2599 | if (status < 0) { | 2570 | if (status < 0) { |
@@ -2608,7 +2579,7 @@ static int myri10ge_resume(struct pci_dev *pdev) | |||
2608 | 2579 | ||
2609 | /* Save configuration space to be restored if the | 2580 | /* Save configuration space to be restored if the |
2610 | * nic resets due to a parity error */ | 2581 | * nic resets due to a parity error */ |
2611 | myri10ge_save_state(mgp); | 2582 | pci_save_state(pdev); |
2612 | 2583 | ||
2613 | if (netif_running(netdev)) { | 2584 | if (netif_running(netdev)) { |
2614 | rtnl_lock(); | 2585 | rtnl_lock(); |
@@ -2674,10 +2645,10 @@ static void myri10ge_watchdog(struct work_struct *work) | |||
2674 | * when the driver was loaded, or the last time the | 2645 | * when the driver was loaded, or the last time the |
2675 | * nic was resumed from power saving mode. | 2646 | * nic was resumed from power saving mode. |
2676 | */ | 2647 | */ |
2677 | myri10ge_restore_state(mgp); | 2648 | pci_restore_state(mgp->pdev); |
2678 | 2649 | ||
2679 | /* save state again for accounting reasons */ | 2650 | /* save state again for accounting reasons */ |
2680 | myri10ge_save_state(mgp); | 2651 | pci_save_state(mgp->pdev); |
2681 | 2652 | ||
2682 | } else { | 2653 | } else { |
2683 | /* if we get back -1's from our slot, perhaps somebody | 2654 | /* if we get back -1's from our slot, perhaps somebody |
@@ -2917,7 +2888,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2917 | 2888 | ||
2918 | /* Save configuration space to be restored if the | 2889 | /* Save configuration space to be restored if the |
2919 | * nic resets due to a parity error */ | 2890 | * nic resets due to a parity error */ |
2920 | myri10ge_save_state(mgp); | 2891 | pci_save_state(pdev); |
2921 | 2892 | ||
2922 | /* Setup the watchdog timer */ | 2893 | /* Setup the watchdog timer */ |
2923 | setup_timer(&mgp->watchdog_timer, myri10ge_watchdog_timer, | 2894 | setup_timer(&mgp->watchdog_timer, myri10ge_watchdog_timer, |
@@ -2937,7 +2908,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2937 | return 0; | 2908 | return 0; |
2938 | 2909 | ||
2939 | abort_with_state: | 2910 | abort_with_state: |
2940 | myri10ge_restore_state(mgp); | 2911 | pci_restore_state(pdev); |
2941 | 2912 | ||
2942 | abort_with_firmware: | 2913 | abort_with_firmware: |
2943 | myri10ge_dummy_rdma(mgp, 0); | 2914 | myri10ge_dummy_rdma(mgp, 0); |
@@ -2992,7 +2963,7 @@ static void myri10ge_remove(struct pci_dev *pdev) | |||
2992 | myri10ge_dummy_rdma(mgp, 0); | 2963 | myri10ge_dummy_rdma(mgp, 0); |
2993 | 2964 | ||
2994 | /* avoid a memory leak */ | 2965 | /* avoid a memory leak */ |
2995 | myri10ge_restore_state(mgp); | 2966 | pci_restore_state(pdev); |
2996 | 2967 | ||
2997 | bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry); | 2968 | bytes = myri10ge_max_intr_slots * sizeof(*mgp->rx_done.entry); |
2998 | dma_free_coherent(&pdev->dev, bytes, | 2969 | dma_free_coherent(&pdev->dev, bytes, |