Skip to content

Commit 4c50f93

Browse files
damien-lemoalbjorn-helgaas
authored andcommitted
misc: pci_endpoint_test: Simplify pci_endpoint_test_msi_irq()
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/[email protected] Signed-off-by: Damien Le Moal <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]>
1 parent 168e6f6 commit 4c50f93

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

drivers/misc/pci_endpoint_test.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -313,21 +313,17 @@ static bool pci_endpoint_test_msi_irq(struct pci_endpoint_test *test,
313313
struct pci_dev *pdev = test->pdev;
314314

315315
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE,
316-
msix == false ? IRQ_TYPE_MSI :
317-
IRQ_TYPE_MSIX);
316+
msix ? IRQ_TYPE_MSIX : IRQ_TYPE_MSI);
318317
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, msi_num);
319318
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND,
320-
msix == false ? COMMAND_RAISE_MSI_IRQ :
321-
COMMAND_RAISE_MSIX_IRQ);
319+
msix ? COMMAND_RAISE_MSIX_IRQ :
320+
COMMAND_RAISE_MSI_IRQ);
322321
val = wait_for_completion_timeout(&test->irq_raised,
323322
msecs_to_jiffies(1000));
324323
if (!val)
325324
return false;
326325

327-
if (pci_irq_vector(pdev, msi_num - 1) == test->last_irq)
328-
return true;
329-
330-
return false;
326+
return pci_irq_vector(pdev, msi_num - 1) == test->last_irq;
331327
}
332328

333329
static int pci_endpoint_test_validate_xfer_params(struct device *dev,

0 commit comments

Comments
 (0)