]> Git Repo - linux.git/blobdiff - drivers/misc/pci_endpoint_test.c
net: bgmac: Fix return value check for fixed_phy_register()
[linux.git] / drivers / misc / pci_endpoint_test.c
index a7244de081ec9c28c95a9d7b36e89943558d87e9..ed4d0ef5e5c3193b22cd65f1377ca7a922459e17 100644 (file)
@@ -159,10 +159,7 @@ static irqreturn_t pci_endpoint_test_irqhandler(int irq, void *dev_id)
        if (reg & STATUS_IRQ_RAISED) {
                test->last_irq = irq;
                complete(&test->irq_raised);
-               reg &= ~STATUS_IRQ_RAISED;
        }
-       pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_STATUS,
-                                reg);
 
        return IRQ_HANDLED;
 }
@@ -316,21 +313,17 @@ static bool pci_endpoint_test_msi_irq(struct pci_endpoint_test *test,
        struct pci_dev *pdev = test->pdev;
 
        pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE,
-                                msix == false ? IRQ_TYPE_MSI :
-                                IRQ_TYPE_MSIX);
+                                msix ? IRQ_TYPE_MSIX : IRQ_TYPE_MSI);
        pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, msi_num);
        pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND,
-                                msix == false ? COMMAND_RAISE_MSI_IRQ :
-                                COMMAND_RAISE_MSIX_IRQ);
+                                msix ? COMMAND_RAISE_MSIX_IRQ :
+                                COMMAND_RAISE_MSI_IRQ);
        val = wait_for_completion_timeout(&test->irq_raised,
                                          msecs_to_jiffies(1000));
        if (!val)
                return false;
 
-       if (pci_irq_vector(pdev, msi_num - 1) == test->last_irq)
-               return true;
-
-       return false;
+       return pci_irq_vector(pdev, msi_num - 1) == test->last_irq;
 }
 
 static int pci_endpoint_test_validate_xfer_params(struct device *dev,
@@ -729,6 +722,10 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd,
        struct pci_dev *pdev = test->pdev;
 
        mutex_lock(&test->mutex);
+
+       reinit_completion(&test->irq_raised);
+       test->last_irq = -ENODATA;
+
        switch (cmd) {
        case PCITEST_BAR:
                bar = arg;
@@ -938,6 +935,9 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
        if (id < 0)
                return;
 
+       pci_endpoint_test_release_irq(test);
+       pci_endpoint_test_free_irq_vectors(test);
+
        misc_deregister(&test->miscdev);
        kfree(misc_device->name);
        kfree(test->name);
@@ -947,9 +947,6 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
                        pci_iounmap(pdev, test->bar[bar]);
        }
 
-       pci_endpoint_test_release_irq(test);
-       pci_endpoint_test_free_irq_vectors(test);
-
        pci_release_regions(pdev);
        pci_disable_device(pdev);
 }
This page took 0.034469 seconds and 4 git commands to generate.