aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2013-11-13 19:30:43 -0500
committerDan Williams <dan.j.williams@intel.com>2013-11-14 14:04:42 -0500
commit779e561ae2627727ea3d797a7db2496e8bae3430 (patch)
treeab650d0d60381c7b5b06e34eb7ed9f6e867968cf /drivers
parent4c5d9619e06b960d14f5640341f40e71f78801c2 (diff)
ioat: fix ioat3_irq_reinit
The implementation of ioat3_irq_reinit has two bugs: 1/ The mode is incorrectly set to MSIX for the MSI case 2/ The 'dev_id' parameter to free_irq is the ioatdma_device not the channel in the msi and intx case Include a small cleanup to clarify that ioat3_irq_reinit is only for bwd hardware Cc: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dma/ioat/dma.c2
-rw-r--r--drivers/dma/ioat/dma_v3.c39
2 files changed, 15 insertions, 26 deletions
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index fb879d9f026f..4f67473f3b81 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -934,7 +934,7 @@ msi:
934 pci_disable_msi(pdev); 934 pci_disable_msi(pdev);
935 goto intx; 935 goto intx;
936 } 936 }
937 device->irq_mode = IOAT_MSIX; 937 device->irq_mode = IOAT_MSI;
938 goto done; 938 goto done;
939 939
940intx: 940intx:
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
index 38616634780f..915b1f66f2da 100644
--- a/drivers/dma/ioat/dma_v3.c
+++ b/drivers/dma/ioat/dma_v3.c
@@ -1449,45 +1449,36 @@ static int ioat3_dma_self_test(struct ioatdma_device *device)
1449 1449
1450static int ioat3_irq_reinit(struct ioatdma_device *device) 1450static int ioat3_irq_reinit(struct ioatdma_device *device)
1451{ 1451{
1452 int msixcnt = device->common.chancnt;
1453 struct pci_dev *pdev = device->pdev; 1452 struct pci_dev *pdev = device->pdev;
1454 int i; 1453 int irq = pdev->irq, i;
1455 struct msix_entry *msix; 1454
1456 struct ioat_chan_common *chan; 1455 if (!is_bwd_ioat(pdev))
1457 int err = 0; 1456 return 0;
1458 1457
1459 switch (device->irq_mode) { 1458 switch (device->irq_mode) {
1460 case IOAT_MSIX: 1459 case IOAT_MSIX:
1460 for (i = 0; i < device->common.chancnt; i++) {
1461 struct msix_entry *msix = &device->msix_entries[i];
1462 struct ioat_chan_common *chan;
1461 1463
1462 for (i = 0; i < msixcnt; i++) {
1463 msix = &device->msix_entries[i];
1464 chan = ioat_chan_by_index(device, i); 1464 chan = ioat_chan_by_index(device, i);
1465 devm_free_irq(&pdev->dev, msix->vector, chan); 1465 devm_free_irq(&pdev->dev, msix->vector, chan);
1466 } 1466 }
1467 1467
1468 pci_disable_msix(pdev); 1468 pci_disable_msix(pdev);
1469 break; 1469 break;
1470
1471 case IOAT_MSI: 1470 case IOAT_MSI:
1472 chan = ioat_chan_by_index(device, 0);
1473 devm_free_irq(&pdev->dev, pdev->irq, chan);
1474 pci_disable_msi(pdev); 1471 pci_disable_msi(pdev);
1475 break; 1472 /* fall through */
1476
1477 case IOAT_INTX: 1473 case IOAT_INTX:
1478 chan = ioat_chan_by_index(device, 0); 1474 devm_free_irq(&pdev->dev, irq, device);
1479 devm_free_irq(&pdev->dev, pdev->irq, chan);
1480 break; 1475 break;
1481
1482 default: 1476 default:
1483 return 0; 1477 return 0;
1484 } 1478 }
1485
1486 device->irq_mode = IOAT_NOIRQ; 1479 device->irq_mode = IOAT_NOIRQ;
1487 1480
1488 err = ioat_dma_setup_interrupts(device); 1481 return ioat_dma_setup_interrupts(device);
1489
1490 return err;
1491} 1482}
1492 1483
1493static int ioat3_reset_hw(struct ioat_chan_common *chan) 1484static int ioat3_reset_hw(struct ioat_chan_common *chan)
@@ -1530,14 +1521,12 @@ static int ioat3_reset_hw(struct ioat_chan_common *chan)
1530 } 1521 }
1531 1522
1532 err = ioat2_reset_sync(chan, msecs_to_jiffies(200)); 1523 err = ioat2_reset_sync(chan, msecs_to_jiffies(200));
1533 if (err) { 1524 if (!err)
1534 dev_err(&pdev->dev, "Failed to reset!\n");
1535 return err;
1536 }
1537
1538 if (device->irq_mode != IOAT_NOIRQ && is_bwd_ioat(pdev))
1539 err = ioat3_irq_reinit(device); 1525 err = ioat3_irq_reinit(device);
1540 1526
1527 if (err)
1528 dev_err(&pdev->dev, "Failed to reset: %d\n", err);
1529
1541 return err; 1530 return err;
1542} 1531}
1543 1532