2828
2929#define DRV_MODULE_NAME "pci-endpoint-test"
3030
31- #define IRQ_TYPE_UNDEFINED -1
32- #define IRQ_TYPE_INTX 0
33- #define IRQ_TYPE_MSI 1
34- #define IRQ_TYPE_MSIX 2
35-
3631#define PCI_ENDPOINT_TEST_MAGIC 0x0
3732
3833#define PCI_ENDPOINT_TEST_COMMAND 0x4
@@ -158,7 +153,7 @@ static void pci_endpoint_test_free_irq_vectors(struct pci_endpoint_test *test)
158153 struct pci_dev * pdev = test -> pdev ;
159154
160155 pci_free_irq_vectors (pdev );
161- test -> irq_type = IRQ_TYPE_UNDEFINED ;
156+ test -> irq_type = PCITEST_IRQ_TYPE_UNDEFINED ;
162157}
163158
164159static int pci_endpoint_test_alloc_irq_vectors (struct pci_endpoint_test * test ,
@@ -169,23 +164,23 @@ static int pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test,
169164 struct device * dev = & pdev -> dev ;
170165
171166 switch (type ) {
172- case IRQ_TYPE_INTX :
167+ case PCITEST_IRQ_TYPE_INTX :
173168 irq = pci_alloc_irq_vectors (pdev , 1 , 1 , PCI_IRQ_INTX );
174169 if (irq < 0 ) {
175170 dev_err (dev , "Failed to get Legacy interrupt\n" );
176171 return irq ;
177172 }
178173
179174 break ;
180- case IRQ_TYPE_MSI :
175+ case PCITEST_IRQ_TYPE_MSI :
181176 irq = pci_alloc_irq_vectors (pdev , 1 , 32 , PCI_IRQ_MSI );
182177 if (irq < 0 ) {
183178 dev_err (dev , "Failed to get MSI interrupts\n" );
184179 return irq ;
185180 }
186181
187182 break ;
188- case IRQ_TYPE_MSIX :
183+ case PCITEST_IRQ_TYPE_MSIX :
189184 irq = pci_alloc_irq_vectors (pdev , 1 , 2048 , PCI_IRQ_MSIX );
190185 if (irq < 0 ) {
191186 dev_err (dev , "Failed to get MSI-X interrupts\n" );
@@ -234,16 +229,16 @@ static int pci_endpoint_test_request_irq(struct pci_endpoint_test *test)
234229
235230fail :
236231 switch (test -> irq_type ) {
237- case IRQ_TYPE_INTX :
232+ case PCITEST_IRQ_TYPE_INTX :
238233 dev_err (dev , "Failed to request IRQ %d for Legacy\n" ,
239234 pci_irq_vector (pdev , i ));
240235 break ;
241- case IRQ_TYPE_MSI :
236+ case PCITEST_IRQ_TYPE_MSI :
242237 dev_err (dev , "Failed to request IRQ %d for MSI %d\n" ,
243238 pci_irq_vector (pdev , i ),
244239 i + 1 );
245240 break ;
246- case IRQ_TYPE_MSIX :
241+ case PCITEST_IRQ_TYPE_MSIX :
247242 dev_err (dev , "Failed to request IRQ %d for MSI-X %d\n" ,
248243 pci_irq_vector (pdev , i ),
249244 i + 1 );
@@ -409,7 +404,7 @@ static int pci_endpoint_test_intx_irq(struct pci_endpoint_test *test)
409404 u32 val ;
410405
411406 pci_endpoint_test_writel (test , PCI_ENDPOINT_TEST_IRQ_TYPE ,
412- IRQ_TYPE_INTX );
407+ PCITEST_IRQ_TYPE_INTX );
413408 pci_endpoint_test_writel (test , PCI_ENDPOINT_TEST_IRQ_NUMBER , 0 );
414409 pci_endpoint_test_writel (test , PCI_ENDPOINT_TEST_COMMAND ,
415410 COMMAND_RAISE_INTX_IRQ );
@@ -429,7 +424,8 @@ static int pci_endpoint_test_msi_irq(struct pci_endpoint_test *test,
429424 int ret ;
430425
431426 pci_endpoint_test_writel (test , PCI_ENDPOINT_TEST_IRQ_TYPE ,
432- msix ? IRQ_TYPE_MSIX : IRQ_TYPE_MSI );
427+ msix ? PCITEST_IRQ_TYPE_MSIX :
428+ PCITEST_IRQ_TYPE_MSI );
433429 pci_endpoint_test_writel (test , PCI_ENDPOINT_TEST_IRQ_NUMBER , msi_num );
434430 pci_endpoint_test_writel (test , PCI_ENDPOINT_TEST_COMMAND ,
435431 msix ? COMMAND_RAISE_MSIX_IRQ :
@@ -505,7 +501,8 @@ static int pci_endpoint_test_copy(struct pci_endpoint_test *test,
505501 if (use_dma )
506502 flags |= FLAG_USE_DMA ;
507503
508- if (irq_type < IRQ_TYPE_INTX || irq_type > IRQ_TYPE_MSIX ) {
504+ if (irq_type < PCITEST_IRQ_TYPE_INTX ||
505+ irq_type > PCITEST_IRQ_TYPE_MSIX ) {
509506 dev_err (dev , "Invalid IRQ type option\n" );
510507 return - EINVAL ;
511508 }
@@ -637,7 +634,8 @@ static int pci_endpoint_test_write(struct pci_endpoint_test *test,
637634 if (use_dma )
638635 flags |= FLAG_USE_DMA ;
639636
640- if (irq_type < IRQ_TYPE_INTX || irq_type > IRQ_TYPE_MSIX ) {
637+ if (irq_type < PCITEST_IRQ_TYPE_INTX ||
638+ irq_type > PCITEST_IRQ_TYPE_MSIX ) {
641639 dev_err (dev , "Invalid IRQ type option\n" );
642640 return - EINVAL ;
643641 }
@@ -733,7 +731,8 @@ static int pci_endpoint_test_read(struct pci_endpoint_test *test,
733731 if (use_dma )
734732 flags |= FLAG_USE_DMA ;
735733
736- if (irq_type < IRQ_TYPE_INTX || irq_type > IRQ_TYPE_MSIX ) {
734+ if (irq_type < PCITEST_IRQ_TYPE_INTX ||
735+ irq_type > PCITEST_IRQ_TYPE_MSIX ) {
737736 dev_err (dev , "Invalid IRQ type option\n" );
738737 return - EINVAL ;
739738 }
@@ -803,7 +802,8 @@ static int pci_endpoint_test_set_irq(struct pci_endpoint_test *test,
803802 struct device * dev = & pdev -> dev ;
804803 int ret ;
805804
806- if (req_irq_type < IRQ_TYPE_INTX || req_irq_type > IRQ_TYPE_MSIX ) {
805+ if (req_irq_type < PCITEST_IRQ_TYPE_INTX ||
806+ req_irq_type > PCITEST_IRQ_TYPE_MSIX ) {
807807 dev_err (dev , "Invalid IRQ type option\n" );
808808 return - EINVAL ;
809809 }
@@ -927,7 +927,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
927927 test -> test_reg_bar = 0 ;
928928 test -> alignment = 0 ;
929929 test -> pdev = pdev ;
930- test -> irq_type = IRQ_TYPE_UNDEFINED ;
930+ test -> irq_type = PCITEST_IRQ_TYPE_UNDEFINED ;
931931
932932 data = (struct pci_endpoint_test_data * )ent -> driver_data ;
933933 if (data ) {
@@ -1078,23 +1078,23 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
10781078static const struct pci_endpoint_test_data default_data = {
10791079 .test_reg_bar = BAR_0 ,
10801080 .alignment = SZ_4K ,
1081- .irq_type = IRQ_TYPE_MSI ,
1081+ .irq_type = PCITEST_IRQ_TYPE_MSI ,
10821082};
10831083
10841084static const struct pci_endpoint_test_data am654_data = {
10851085 .test_reg_bar = BAR_2 ,
10861086 .alignment = SZ_64K ,
1087- .irq_type = IRQ_TYPE_MSI ,
1087+ .irq_type = PCITEST_IRQ_TYPE_MSI ,
10881088};
10891089
10901090static const struct pci_endpoint_test_data j721e_data = {
10911091 .alignment = 256 ,
1092- .irq_type = IRQ_TYPE_MSI ,
1092+ .irq_type = PCITEST_IRQ_TYPE_MSI ,
10931093};
10941094
10951095static const struct pci_endpoint_test_data rk3588_data = {
10961096 .alignment = SZ_64K ,
1097- .irq_type = IRQ_TYPE_MSI ,
1097+ .irq_type = PCITEST_IRQ_TYPE_MSI ,
10981098};
10991099
11001100/*
0 commit comments