Skip to content

Commit a402006

Browse files
khayash1kwilczynski
authored andcommitted
misc: pci_endpoint_test: Remove global 'irq_type' and 'no_msi'
The global variable "irq_type" preserves the current value of ioctl(GET_IRQTYPE). However, all tests that use interrupts first call ioctl(SET_IRQTYPE) to set "test->irq_type", then write the value of test->irq_type into the register pointed by test_reg_bar, and request the interrupt to the endpoint. The endpoint function driver, pci-epf-test, refers to the register, and determine which type of interrupt to raise. The global variable "irq_type" is never used in the actual test, so remove the variable and replace it with "test->irq_type". Also, for the same reason, the variable "no_msi" can be removed. Initially, "test->irq_type" has IRQ_TYPE_UNDEFINED, and the ioctl(GET_IRQTYPE) before calling ioctl(SET_IRQTYPE) will return an error. Suggested-by: Niklas Cassel <[email protected]> Suggested-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Kunihiko Hayashi <[email protected]> [kwilczynski: commit log] Signed-off-by: Krzysztof Wilczyński <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent baaef0a commit a402006

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

drivers/misc/pci_endpoint_test.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,6 @@ static DEFINE_IDA(pci_endpoint_test_ida);
9696
#define to_endpoint_test(priv) container_of((priv), struct pci_endpoint_test, \
9797
miscdev)
9898

99-
static bool no_msi;
100-
module_param(no_msi, bool, 0444);
101-
MODULE_PARM_DESC(no_msi, "Disable MSI interrupt in pci_endpoint_test");
102-
103-
static int irq_type = IRQ_TYPE_MSI;
104-
module_param(irq_type, int, 0444);
105-
MODULE_PARM_DESC(irq_type, "IRQ mode selection in pci_endpoint_test (0 - Legacy, 1 - MSI, 2 - MSI-X)");
106-
10799
enum pci_barno {
108100
BAR_0,
109101
BAR_1,
@@ -833,7 +825,6 @@ static int pci_endpoint_test_set_irq(struct pci_endpoint_test *test,
833825
return ret;
834826
}
835827

836-
irq_type = test->irq_type;
837828
return 0;
838829
}
839830

@@ -882,7 +873,7 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd,
882873
ret = pci_endpoint_test_set_irq(test, arg);
883874
break;
884875
case PCITEST_GET_IRQTYPE:
885-
ret = irq_type;
876+
ret = test->irq_type;
886877
break;
887878
case PCITEST_CLEAR_IRQ:
888879
ret = pci_endpoint_test_clear_irq(test);
@@ -939,15 +930,12 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
939930
test->pdev = pdev;
940931
test->irq_type = IRQ_TYPE_UNDEFINED;
941932

942-
if (no_msi)
943-
irq_type = IRQ_TYPE_INTX;
944-
945933
data = (struct pci_endpoint_test_data *)ent->driver_data;
946934
if (data) {
947935
test_reg_bar = data->test_reg_bar;
948936
test->test_reg_bar = test_reg_bar;
949937
test->alignment = data->alignment;
950-
irq_type = data->irq_type;
938+
test->irq_type = data->irq_type;
951939
}
952940

953941
init_completion(&test->irq_raised);
@@ -969,7 +957,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
969957

970958
pci_set_master(pdev);
971959

972-
ret = pci_endpoint_test_alloc_irq_vectors(test, irq_type);
960+
ret = pci_endpoint_test_alloc_irq_vectors(test, test->irq_type);
973961
if (ret)
974962
goto err_disable_irq;
975963

0 commit comments

Comments
 (0)