From: Niklas Cassel <cassel@kernel.org>
To: bhelgaas@google.com, kw@linux.com, manivannan.sadhasivam@linaro.org
Cc: linux-pci@vger.kernel.org, Damien Le Moal <dlemoal@kernel.org>,
Kunihiko Hayashi <hayashi.kunihiko@socionext.com>,
Niklas Cassel <cassel@kernel.org>
Subject: [PATCH 2/7] misc: pci_endpoint_test: Use IRQ_TYPE_* defines from UAPI header
Date: Mon, 10 Mar 2025 12:10:19 +0100 [thread overview]
Message-ID: <20250310111016.859445-11-cassel@kernel.org> (raw)
In-Reply-To: <20250310111016.859445-9-cassel@kernel.org>
Use the IRQ_TYPE_* defines from the UAPI header rather than duplicating
these defines in the driver itself.
No functional change.
Signed-off-by: Niklas Cassel <cassel@kernel.org>
---
drivers/misc/pci_endpoint_test.c | 46 ++++++++++++++++----------------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index e3d9638b7a1b..849d730ba14d 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -28,11 +28,6 @@
#define DRV_MODULE_NAME "pci-endpoint-test"
-#define IRQ_TYPE_UNDEFINED -1
-#define IRQ_TYPE_INTX 0
-#define IRQ_TYPE_MSI 1
-#define IRQ_TYPE_MSIX 2
-
#define PCI_ENDPOINT_TEST_MAGIC 0x0
#define PCI_ENDPOINT_TEST_COMMAND 0x4
@@ -157,7 +152,7 @@ static void pci_endpoint_test_free_irq_vectors(struct pci_endpoint_test *test)
struct pci_dev *pdev = test->pdev;
pci_free_irq_vectors(pdev);
- test->irq_type = IRQ_TYPE_UNDEFINED;
+ test->irq_type = PCITEST_IRQ_TYPE_UNDEFINED;
}
static int pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test,
@@ -168,7 +163,7 @@ static int pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test,
struct device *dev = &pdev->dev;
switch (type) {
- case IRQ_TYPE_INTX:
+ case PCITEST_IRQ_TYPE_INTX:
irq = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_INTX);
if (irq < 0) {
dev_err(dev, "Failed to get Legacy interrupt\n");
@@ -176,7 +171,7 @@ static int pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test,
}
break;
- case IRQ_TYPE_MSI:
+ case PCITEST_IRQ_TYPE_MSI:
irq = pci_alloc_irq_vectors(pdev, 1, 32, PCI_IRQ_MSI);
if (irq < 0) {
dev_err(dev, "Failed to get MSI interrupts\n");
@@ -184,7 +179,7 @@ static int pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test,
}
break;
- case IRQ_TYPE_MSIX:
+ case PCITEST_IRQ_TYPE_MSIX:
irq = pci_alloc_irq_vectors(pdev, 1, 2048, PCI_IRQ_MSIX);
if (irq < 0) {
dev_err(dev, "Failed to get MSI-X interrupts\n");
@@ -233,16 +228,16 @@ static int pci_endpoint_test_request_irq(struct pci_endpoint_test *test)
fail:
switch (test->irq_type) {
- case IRQ_TYPE_INTX:
+ case PCITEST_IRQ_TYPE_INTX:
dev_err(dev, "Failed to request IRQ %d for Legacy\n",
pci_irq_vector(pdev, i));
break;
- case IRQ_TYPE_MSI:
+ case PCITEST_IRQ_TYPE_MSI:
dev_err(dev, "Failed to request IRQ %d for MSI %d\n",
pci_irq_vector(pdev, i),
i + 1);
break;
- case IRQ_TYPE_MSIX:
+ case PCITEST_IRQ_TYPE_MSIX:
dev_err(dev, "Failed to request IRQ %d for MSI-X %d\n",
pci_irq_vector(pdev, i),
i + 1);
@@ -408,7 +403,7 @@ static int pci_endpoint_test_intx_irq(struct pci_endpoint_test *test)
u32 val;
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE,
- IRQ_TYPE_INTX);
+ PCITEST_IRQ_TYPE_INTX);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, 0);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND,
COMMAND_RAISE_INTX_IRQ);
@@ -428,7 +423,8 @@ static int pci_endpoint_test_msi_irq(struct pci_endpoint_test *test,
int ret;
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_TYPE,
- msix ? IRQ_TYPE_MSIX : IRQ_TYPE_MSI);
+ msix ? PCITEST_IRQ_TYPE_MSIX :
+ PCITEST_IRQ_TYPE_MSI);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_IRQ_NUMBER, msi_num);
pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_COMMAND,
msix ? COMMAND_RAISE_MSIX_IRQ :
@@ -504,7 +500,8 @@ static int pci_endpoint_test_copy(struct pci_endpoint_test *test,
if (use_dma)
flags |= FLAG_USE_DMA;
- if (irq_type < IRQ_TYPE_INTX || irq_type > IRQ_TYPE_MSIX) {
+ if (irq_type < PCITEST_IRQ_TYPE_INTX ||
+ irq_type > PCITEST_IRQ_TYPE_MSIX) {
dev_err(dev, "Invalid IRQ type option\n");
return -EINVAL;
}
@@ -636,7 +633,8 @@ static int pci_endpoint_test_write(struct pci_endpoint_test *test,
if (use_dma)
flags |= FLAG_USE_DMA;
- if (irq_type < IRQ_TYPE_INTX || irq_type > IRQ_TYPE_MSIX) {
+ if (irq_type < PCITEST_IRQ_TYPE_INTX ||
+ irq_type > PCITEST_IRQ_TYPE_MSIX) {
dev_err(dev, "Invalid IRQ type option\n");
return -EINVAL;
}
@@ -732,7 +730,8 @@ static int pci_endpoint_test_read(struct pci_endpoint_test *test,
if (use_dma)
flags |= FLAG_USE_DMA;
- if (irq_type < IRQ_TYPE_INTX || irq_type > IRQ_TYPE_MSIX) {
+ if (irq_type < PCITEST_IRQ_TYPE_INTX ||
+ irq_type > PCITEST_IRQ_TYPE_MSIX) {
dev_err(dev, "Invalid IRQ type option\n");
return -EINVAL;
}
@@ -802,7 +801,8 @@ static int pci_endpoint_test_set_irq(struct pci_endpoint_test *test,
struct device *dev = &pdev->dev;
int ret;
- if (req_irq_type < IRQ_TYPE_INTX || req_irq_type > IRQ_TYPE_MSIX) {
+ if (req_irq_type < PCITEST_IRQ_TYPE_INTX ||
+ req_irq_type > PCITEST_IRQ_TYPE_MSIX) {
dev_err(dev, "Invalid IRQ type option\n");
return -EINVAL;
}
@@ -926,7 +926,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
test->test_reg_bar = 0;
test->alignment = 0;
test->pdev = pdev;
- test->irq_type = IRQ_TYPE_UNDEFINED;
+ test->irq_type = PCITEST_IRQ_TYPE_UNDEFINED;
data = (struct pci_endpoint_test_data *)ent->driver_data;
if (data) {
@@ -1077,23 +1077,23 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
static const struct pci_endpoint_test_data default_data = {
.test_reg_bar = BAR_0,
.alignment = SZ_4K,
- .irq_type = IRQ_TYPE_MSI,
+ .irq_type = PCITEST_IRQ_TYPE_MSI,
};
static const struct pci_endpoint_test_data am654_data = {
.test_reg_bar = BAR_2,
.alignment = SZ_64K,
- .irq_type = IRQ_TYPE_MSI,
+ .irq_type = PCITEST_IRQ_TYPE_MSI,
};
static const struct pci_endpoint_test_data j721e_data = {
.alignment = 256,
- .irq_type = IRQ_TYPE_MSI,
+ .irq_type = PCITEST_IRQ_TYPE_MSI,
};
static const struct pci_endpoint_test_data rk3588_data = {
.alignment = SZ_64K,
- .irq_type = IRQ_TYPE_MSI,
+ .irq_type = PCITEST_IRQ_TYPE_MSI,
};
/*
--
2.48.1
next prev parent reply other threads:[~2025-03-10 11:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 11:10 [PATCH 0/7] pci_endpoint_test: Add support for PCITEST_IRQ_TYPE_AUTO Niklas Cassel
2025-03-10 11:10 ` [PATCH 1/7] PCI: endpoint: pcitest: Add IRQ_TYPE_* defines to UAPI header Niklas Cassel
2025-03-10 11:10 ` Niklas Cassel [this message]
2025-03-10 11:10 ` [PATCH 3/7] selftests: pci_endpoint: Use IRQ_TYPE_* defines from " Niklas Cassel
2025-03-10 11:10 ` [PATCH 4/7] PCI: endpoint: Add intx_capable to epc_features Niklas Cassel
2025-03-21 21:50 ` Bjorn Helgaas
2025-03-21 21:55 ` Niklas Cassel
2025-03-21 22:42 ` Bjorn Helgaas
2025-03-26 6:25 ` Krzysztof Wilczyński
2025-03-10 11:10 ` [PATCH 5/7] PCI: dw-rockchip: EP mode cannot raise INTx interrupts Niklas Cassel
2025-03-10 11:10 ` [PATCH 6/7] PCI: endpoint: pci-epf-test: Expose supported IRQ types in CAPS register Niklas Cassel
2025-03-10 11:10 ` [PATCH 7/7] misc: pci_endpoint_test: Add support for PCITEST_IRQ_TYPE_AUTO Niklas Cassel
2025-03-14 12:45 ` Manivannan Sadhasivam
2025-03-14 17:25 ` Niklas Cassel
2025-03-18 8:56 ` Manivannan Sadhasivam
2025-03-18 9:45 ` Niklas Cassel
2025-03-18 10:38 ` Niklas Cassel
2025-03-10 13:47 ` [PATCH 0/7] " Krzysztof Wilczyński
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250310111016.859445-11-cassel@kernel.org \
--to=cassel@kernel.org \
--cc=bhelgaas@google.com \
--cc=dlemoal@kernel.org \
--cc=hayashi.kunihiko@socionext.com \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox