misc: pci_endpoint_test: Simplify pci_endpoint_test_msi_irq()
authorDamien Le Moal <dlemoal@kernel.org>
Sat, 15 Apr 2023 02:35:42 +0000 (11:35 +0900)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 23 Jun 2023 20:04:15 +0000 (15:04 -0500)
Simplify the code of pci_endpoint_test_msi_irq() by correctly using
booleans: remove the msix comparison to false as that variable is already a
boolean, and directly return the result of the comparison of the raised
interrupt number.

Link: https://lore.kernel.org/r/20230415023542.77601-18-dlemoal@kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
drivers/misc/pci_endpoint_test.c

index afd2577261f8b4f4fec25918b88fef430a2b9865..ed4d0ef5e5c3193b22cd65f1377ca7a922459e17 100644 (file)
@@ -313,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,