diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2006-12-01 17:29:37 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-12-02 00:22:30 -0500 |
commit | b0a20ded562cfa60b0d45d269e416f541f2d5aaf (patch) | |
tree | 2ccfccb13bf0f7852105f18d4434562b788720d8 /drivers/net/sky2.c | |
parent | 794b2bd20f620892616b09466186ff27101d9e5b (diff) |
[PATCH] sky2: msi enhancements.
If using Message Signaled Interrupts (MSI) then the IRQ will never
be shared. Don't call pci_disable_msi() unless using MSI.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r-- | drivers/net/sky2.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index b95b9b7cce00..0ef1848b9761 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -3311,7 +3311,7 @@ static irqreturn_t __devinit sky2_test_intr(int irq, void *dev_id) | |||
3311 | return IRQ_NONE; | 3311 | return IRQ_NONE; |
3312 | 3312 | ||
3313 | if (status & Y2_IS_IRQ_SW) { | 3313 | if (status & Y2_IS_IRQ_SW) { |
3314 | hw->msi_detected = 1; | 3314 | hw->msi = 1; |
3315 | wake_up(&hw->msi_wait); | 3315 | wake_up(&hw->msi_wait); |
3316 | sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ); | 3316 | sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ); |
3317 | } | 3317 | } |
@@ -3330,7 +3330,7 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw) | |||
3330 | 3330 | ||
3331 | sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW); | 3331 | sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW); |
3332 | 3332 | ||
3333 | err = request_irq(pdev->irq, sky2_test_intr, IRQF_SHARED, DRV_NAME, hw); | 3333 | err = request_irq(pdev->irq, sky2_test_intr, 0, DRV_NAME, hw); |
3334 | if (err) { | 3334 | if (err) { |
3335 | printk(KERN_ERR PFX "%s: cannot assign irq %d\n", | 3335 | printk(KERN_ERR PFX "%s: cannot assign irq %d\n", |
3336 | pci_name(pdev), pdev->irq); | 3336 | pci_name(pdev), pdev->irq); |
@@ -3340,9 +3340,9 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw) | |||
3340 | sky2_write8(hw, B0_CTST, CS_ST_SW_IRQ); | 3340 | sky2_write8(hw, B0_CTST, CS_ST_SW_IRQ); |
3341 | sky2_read8(hw, B0_CTST); | 3341 | sky2_read8(hw, B0_CTST); |
3342 | 3342 | ||
3343 | wait_event_timeout(hw->msi_wait, hw->msi_detected, HZ/10); | 3343 | wait_event_timeout(hw->msi_wait, hw->msi, HZ/10); |
3344 | 3344 | ||
3345 | if (!hw->msi_detected) { | 3345 | if (!hw->msi) { |
3346 | /* MSI test failed, go back to INTx mode */ | 3346 | /* MSI test failed, go back to INTx mode */ |
3347 | printk(KERN_INFO PFX "%s: No interrupt generated using MSI, " | 3347 | printk(KERN_INFO PFX "%s: No interrupt generated using MSI, " |
3348 | "switching to INTx mode.\n", | 3348 | "switching to INTx mode.\n", |
@@ -3475,7 +3475,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
3475 | goto err_out_free_netdev; | 3475 | goto err_out_free_netdev; |
3476 | } | 3476 | } |
3477 | 3477 | ||
3478 | err = request_irq(pdev->irq, sky2_intr, IRQF_SHARED, dev->name, hw); | 3478 | err = request_irq(pdev->irq, sky2_intr, hw->msi ? 0 : IRQF_SHARED, |
3479 | dev->name, hw); | ||
3479 | if (err) { | 3480 | if (err) { |
3480 | printk(KERN_ERR PFX "%s: cannot assign irq %d\n", | 3481 | printk(KERN_ERR PFX "%s: cannot assign irq %d\n", |
3481 | pci_name(pdev), pdev->irq); | 3482 | pci_name(pdev), pdev->irq); |
@@ -3505,7 +3506,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
3505 | return 0; | 3506 | return 0; |
3506 | 3507 | ||
3507 | err_out_unregister: | 3508 | err_out_unregister: |
3508 | pci_disable_msi(pdev); | 3509 | if (hw->msi) |
3510 | pci_disable_msi(pdev); | ||
3509 | unregister_netdev(dev); | 3511 | unregister_netdev(dev); |
3510 | err_out_free_netdev: | 3512 | err_out_free_netdev: |
3511 | free_netdev(dev); | 3513 | free_netdev(dev); |
@@ -3548,7 +3550,8 @@ static void __devexit sky2_remove(struct pci_dev *pdev) | |||
3548 | sky2_read8(hw, B0_CTST); | 3550 | sky2_read8(hw, B0_CTST); |
3549 | 3551 | ||
3550 | free_irq(pdev->irq, hw); | 3552 | free_irq(pdev->irq, hw); |
3551 | pci_disable_msi(pdev); | 3553 | if (hw->msi) |
3554 | pci_disable_msi(pdev); | ||
3552 | pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma); | 3555 | pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma); |
3553 | pci_release_regions(pdev); | 3556 | pci_release_regions(pdev); |
3554 | pci_disable_device(pdev); | 3557 | pci_disable_device(pdev); |