@@ -98,6 +98,7 @@ struct pci_endpoint_test {
9898 struct completion irq_raised ;
9999 int last_irq ;
100100 int num_irqs ;
101+ int irq_type ;
101102 /* mutex to protect the ioctls */
102103 struct mutex mutex ;
103104 struct miscdevice miscdev ;
@@ -157,6 +158,7 @@ static void pci_endpoint_test_free_irq_vectors(struct pci_endpoint_test *test)
157158 struct pci_dev * pdev = test -> pdev ;
158159
159160 pci_free_irq_vectors (pdev );
161+ test -> irq_type = IRQ_TYPE_UNDEFINED ;
160162}
161163
162164static bool pci_endpoint_test_alloc_irq_vectors (struct pci_endpoint_test * test ,
@@ -191,6 +193,8 @@ static bool pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test,
191193 irq = 0 ;
192194 res = false;
193195 }
196+
197+ test -> irq_type = type ;
194198 test -> num_irqs = irq ;
195199
196200 return res ;
@@ -330,6 +334,7 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, size_t size)
330334 dma_addr_t orig_dst_phys_addr ;
331335 size_t offset ;
332336 size_t alignment = test -> alignment ;
337+ int irq_type = test -> irq_type ;
333338 u32 src_crc32 ;
334339 u32 dst_crc32 ;
335340
@@ -426,6 +431,7 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test, size_t size)
426431 dma_addr_t orig_phys_addr ;
427432 size_t offset ;
428433 size_t alignment = test -> alignment ;
434+ int irq_type = test -> irq_type ;
429435 u32 crc32 ;
430436
431437 if (size > SIZE_MAX - alignment )
@@ -494,6 +500,7 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test, size_t size)
494500 dma_addr_t orig_phys_addr ;
495501 size_t offset ;
496502 size_t alignment = test -> alignment ;
503+ int irq_type = test -> irq_type ;
497504 u32 crc32 ;
498505
499506 if (size > SIZE_MAX - alignment )
@@ -555,7 +562,7 @@ static bool pci_endpoint_test_set_irq(struct pci_endpoint_test *test,
555562 return false;
556563 }
557564
558- if (irq_type == req_irq_type )
565+ if (test -> irq_type == req_irq_type )
559566 return true;
560567
561568 pci_endpoint_test_release_irq (test );
@@ -567,12 +574,10 @@ static bool pci_endpoint_test_set_irq(struct pci_endpoint_test *test,
567574 if (!pci_endpoint_test_request_irq (test ))
568575 goto err ;
569576
570- irq_type = req_irq_type ;
571577 return true;
572578
573579err :
574580 pci_endpoint_test_free_irq_vectors (test );
575- irq_type = IRQ_TYPE_UNDEFINED ;
576581 return false;
577582}
578583
@@ -633,7 +638,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
633638{
634639 int err ;
635640 int id ;
636- char name [20 ];
641+ char name [24 ];
637642 enum pci_barno bar ;
638643 void __iomem * base ;
639644 struct device * dev = & pdev -> dev ;
@@ -652,6 +657,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
652657 test -> test_reg_bar = 0 ;
653658 test -> alignment = 0 ;
654659 test -> pdev = pdev ;
660+ test -> irq_type = IRQ_TYPE_UNDEFINED ;
655661
656662 if (no_msi )
657663 irq_type = IRQ_TYPE_LEGACY ;
0 commit comments