aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2010-09-12 18:45:39 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-14 17:29:37 -0400
commit068e8a30320e33b1f8d15df9eaef84f04258f96d (patch)
tree19458b3eeec7d5377cecf0f9b395e2ab70d8bbd1
parentbc0ed0be10a4925efa7b81a84af53f12fbdbcb4e (diff)
e1000e: Simplify MSI interrupt testing
The code is quite convoluted, simplify it. This also avoids calling e1000_request_irq() without testing the value it returned, which was bad. Signed-off-by: Jean Delvare <jdelvare@suse.de> Cc: Bruce Allan <bruce.w.allan@intel.com> Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/e1000e/netdev.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index c9b66f4727e4..e2c7e0d767b1 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -3412,22 +3412,16 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter)
3412 3412
3413 if (adapter->flags & FLAG_MSI_TEST_FAILED) { 3413 if (adapter->flags & FLAG_MSI_TEST_FAILED) {
3414 adapter->int_mode = E1000E_INT_MODE_LEGACY; 3414 adapter->int_mode = E1000E_INT_MODE_LEGACY;
3415 err = -EIO; 3415 e_info("MSI interrupt test failed, using legacy interrupt.\n");
3416 e_info("MSI interrupt test failed!\n"); 3416 } else
3417 } 3417 e_dbg("MSI interrupt test succeeded!\n");
3418 3418
3419 free_irq(adapter->pdev->irq, netdev); 3419 free_irq(adapter->pdev->irq, netdev);
3420 pci_disable_msi(adapter->pdev); 3420 pci_disable_msi(adapter->pdev);
3421 3421
3422 if (err == -EIO)
3423 goto msi_test_failed;
3424
3425 /* okay so the test worked, restore settings */
3426 e_dbg("MSI interrupt test succeeded!\n");
3427msi_test_failed: 3422msi_test_failed:
3428 e1000e_set_interrupt_capability(adapter); 3423 e1000e_set_interrupt_capability(adapter);
3429 e1000_request_irq(adapter); 3424 return e1000_request_irq(adapter);
3430 return err;
3431} 3425}
3432 3426
3433/** 3427/**
@@ -3459,21 +3453,6 @@ static int e1000_test_msi(struct e1000_adapter *adapter)
3459 pci_write_config_word(adapter->pdev, PCI_COMMAND, pci_cmd); 3453 pci_write_config_word(adapter->pdev, PCI_COMMAND, pci_cmd);
3460 } 3454 }
3461 3455
3462 /* success ! */
3463 if (!err)
3464 return 0;
3465
3466 /* EIO means MSI test failed */
3467 if (err != -EIO)
3468 return err;
3469
3470 /* back to INTx mode */
3471 e_warn("MSI interrupt test failed, using legacy interrupt.\n");
3472
3473 e1000_free_irq(adapter);
3474
3475 err = e1000_request_irq(adapter);
3476
3477 return err; 3456 return err;
3478} 3457}
3479 3458