misc: pci_endpoint_test: Add ioctl to clear IRQ
authorKishon Vijay Abraham I <kishon@ti.com>
Tue, 17 Mar 2020 10:01:55 +0000 (15:31 +0530)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Thu, 2 Apr 2020 16:57:10 +0000 (17:57 +0100)
Add ioctl to clear IRQ which can be used to free the allocated
IRQ vectors and free the requested IRQ.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
drivers/misc/pci_endpoint_test.c
include/uapi/linux/pcitest.h

index ca680635d7a9504d88126ad72430ea4dacfc8f0b..bb8b94ac8d3bfc82f4259846bb65938cacd08f4e 100644 (file)
@@ -652,6 +652,13 @@ err:
        return ret;
 }
 
+static bool pci_endpoint_test_clear_irq(struct pci_endpoint_test *test)
+{
+       pci_endpoint_test_release_irq(test);
+       pci_endpoint_test_free_irq_vectors(test);
+       return true;
+}
+
 static bool pci_endpoint_test_set_irq(struct pci_endpoint_test *test,
                                      int req_irq_type)
 {
@@ -722,6 +729,9 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd,
        case PCITEST_GET_IRQTYPE:
                ret = irq_type;
                break;
+       case PCITEST_CLEAR_IRQ:
+               ret = pci_endpoint_test_clear_irq(test);
+               break;
        }
 
 ret:
index 8b868761f8b4372c123fc6442c2698a0efa550c3..c3ab4c826297c9d4aa82724a7a8f1d6f084885a1 100644 (file)
@@ -19,6 +19,7 @@
 #define PCITEST_MSIX           _IOW('P', 0x7, int)
 #define PCITEST_SET_IRQTYPE    _IOW('P', 0x8, int)
 #define PCITEST_GET_IRQTYPE    _IO('P', 0x9)
+#define PCITEST_CLEAR_IRQ      _IO('P', 0x10)
 
 #define PCITEST_FLAGS_USE_DMA  0x00000001