public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Niklas Neronin <niklas.neronin@linux.intel.com>
To: mathias.nyman@linux.intel.com
Cc: linux-usb@vger.kernel.org, raoxu@uniontech.com,
	Niklas Neronin <niklas.neronin@linux.intel.com>
Subject: [PATCH 2/2] usb: xhci: add interrupter type
Date: Wed, 28 Jan 2026 14:15:04 +0100	[thread overview]
Message-ID: <20260128131504.124322-3-niklas.neronin@linux.intel.com> (raw)
In-Reply-To: <20260128131504.124322-1-niklas.neronin@linux.intel.com>

xhci-sideband creates a secondary interrupter without an associated IRQ.
Such interrupters are non-operational and cannot enabled or disabled.

Add a type field to struct 'xhci_interrupter' to distinguish
non-operational interrupters. When the type is set to 'INTR_NOOP',
the interrupter enable/disable helpers become no-ops.

This allows callers to iterate over all allocated interrupters without
special-casing, while ensuring that actions are applied only to
operational interrupters. It also provides a simple extension point
for adding additional interrupter types in the future.

Operational interrupters remain the default; no-op interrupters are the
exception.

No functional changes are introduced; behavior remains the same.

Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
---
 drivers/usb/host/xhci-sideband.c | 1 +
 drivers/usb/host/xhci.c          | 6 ++++++
 drivers/usb/host/xhci.h          | 8 ++++++++
 3 files changed, 15 insertions(+)

diff --git a/drivers/usb/host/xhci-sideband.c b/drivers/usb/host/xhci-sideband.c
index 2bd77255032b..21ee4e96bc70 100644
--- a/drivers/usb/host/xhci-sideband.c
+++ b/drivers/usb/host/xhci-sideband.c
@@ -352,6 +352,7 @@ xhci_sideband_create_interrupter(struct xhci_sideband *sb, int num_seg,
 	ret = usb_offload_get(udev);
 
 	sb->ir->ip_autoclear = ip_autoclear;
+	sb->ir->type = INTR_NOOP;
 
 	return ret;
 }
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index fcf8b486b0e0..c4e0c1cfb94e 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -314,6 +314,9 @@ int xhci_enable_interrupter(struct xhci_interrupter *ir)
 {
 	u32 iman;
 
+	if (ir->type == INTR_NOOP)
+		return 0;
+
 	if (!ir || !ir->ir_set)
 		return -EINVAL;
 
@@ -331,6 +334,9 @@ int xhci_disable_interrupter(struct xhci_hcd *xhci, struct xhci_interrupter *ir)
 {
 	u32 iman;
 
+	if (ir->type == INTR_NOOP)
+		return 0;
+
 	if (!ir || !ir->ir_set)
 		return -EINVAL;
 
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 2b0796f6d00e..59840d613e94 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1443,6 +1443,13 @@ struct xhci_bus_state {
 	unsigned long		resuming_ports;
 };
 
+enum interrupter_type {
+	/* Normal interrupter, e.g. Primary */
+	INTR_DEFAULT = 0,
+	/* Non-operational, e.g. xhci-sideband */
+	INTR_NOOP,
+};
+
 struct xhci_interrupter {
 	struct xhci_ring	*event_ring;
 	struct xhci_erst	erst;
@@ -1450,6 +1457,7 @@ struct xhci_interrupter {
 	unsigned int		intr_num;
 	bool			ip_autoclear;
 	u32			isoc_bei_interval;
+	enum interrupter_type	type;
 	/* For interrupter registers save and restore over suspend/resume */
 	u32	s3_iman;
 	u32	s3_imod;
-- 
2.50.1


  parent reply	other threads:[~2026-01-28 13:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-28 13:15 [PATCH 0/2] usb: xhci: simplify interrupter handling Niklas Neronin
2026-01-28 13:15 ` [PATCH 1/2] usb: xhci: move Primary Interrupter IMODI setup Niklas Neronin
2026-01-28 13:15 ` Niklas Neronin [this message]
2026-01-29  6:59   ` [PATCH 2/2] usb: xhci: add interrupter type Dan Carpenter
2026-02-04  1:17   ` Wesley Cheng
2026-02-05 10:41     ` Neronin, Niklas

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=20260128131504.124322-3-niklas.neronin@linux.intel.com \
    --to=niklas.neronin@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=raoxu@uniontech.com \
    /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