[PATCH 2/7] misc: pci_endpoint_test: Do not request or allocate IRQs in probe

From: Kishon Vijay Abraham I
Date: Mon Dec 30 2019 - 07:31:39 EST


Allocation of IRQ vectors and requesting IRQ is done as part of
PCITEST_SET_IRQTYPE. Do not request or allocate IRQs in probe for
AM654 and J721E so that the user space test script has better control
of the devices for which the IRQs are configured.

Signed-off-by: Kishon Vijay Abraham I <kishon@xxxxxx>
---
drivers/misc/pci_endpoint_test.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 743ff4dcb3f0..04505890eae9 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -70,6 +70,9 @@
#define is_am654_pci_dev(pdev) \
((pdev)->device == PCI_DEVICE_ID_TI_AM654)

+#define is_j721e_pci_dev(pdev) \
+ ((pdev)->device == PCI_DEVICE_ID_TI_J721E)
+
static DEFINE_IDA(pci_endpoint_test_ida);

#define to_endpoint_test(priv) container_of((priv), struct pci_endpoint_test, \
@@ -688,11 +691,13 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,

pci_set_master(pdev);

- if (!pci_endpoint_test_alloc_irq_vectors(test, irq_type))
- goto err_disable_irq;
+ if (!(is_am654_pci_dev(pdev) || is_j721e_pci_dev(pdev))) {
+ if (!pci_endpoint_test_alloc_irq_vectors(test, irq_type))
+ goto err_disable_irq;

- if (!pci_endpoint_test_request_irq(test))
- goto err_disable_irq;
+ if (!pci_endpoint_test_request_irq(test))
+ goto err_disable_irq;
+ }

for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
--
2.17.1