thunderbolt: Fix INVARIANTS compilation

The problem is that THUNDERBOLT_DEBUG triggers the use of some
variables, but it is independent of INVARIANTS and the variables it uses
were tagged with '__diagused'.

Fix this by using '__maybe_unused' in those places.

Fixes:          1836330791 ("thunderbolt: make code -Wunused clean")
Fixes:          886164895f ("amd64: complete thunderbolt KERNCONF integration")
Sponsored by:   The FreeBSD Foundation
This commit is contained in:
Olivier Certner
2026-06-03 17:57:50 +02:00
parent 521afce6a8
commit 9a133eee1e
4 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -834,7 +834,7 @@ static int
nhi_tx_complete(struct nhi_ring_pair *r, struct nhi_tx_buffer_desc *desc,
struct nhi_cmd_frame *cmd)
{
struct nhi_softc *sc __diagused;
struct nhi_softc *sc __maybe_unused;
struct nhi_pdf_dispatch *txpdf;
u_int sof;
@@ -868,10 +868,10 @@ static int
nhi_rx_complete(struct nhi_ring_pair *r, struct nhi_rx_post_desc *desc,
struct nhi_cmd_frame *cmd)
{
struct nhi_softc *sc __diagused;
struct nhi_softc *sc __maybe_unused;
struct nhi_pdf_dispatch *rxpdf;
u_int eof;
u_int len __diagused;
u_int len __maybe_unused;
sc = r->sc;
eof = desc->eof_len >> RX_BUFFER_DESC_EOF_SHIFT;
+2 -2
View File
@@ -278,7 +278,7 @@ _tb_router_attach(struct router_softc *sc)
struct tb_cfg_router *cfg;
uint32_t *buf;
int error;
int up __diagused;
int up __maybe_unused;
buf = malloc(9 * 4, M_THUNDERBOLT, M_NOWAIT|M_ZERO);
if (buf == NULL)
@@ -720,7 +720,7 @@ router_notify_intr(void *context, union nhi_ring_desc *ring, struct nhi_cmd_fram
struct router_softc *sc;
struct router_command *cmd;
struct tb_cfg_notify event;
u_int adap __diagused;
u_int adap __maybe_unused;
u_int ev;
KASSERT(context != NULL, ("context cannot be NULL\n"));
+1 -1
View File
@@ -120,7 +120,7 @@ tb_acpi_pcib_attach(device_t dev)
ACPI_OBJECT_LIST list;
ACPI_OBJECT arg;
ACPI_BUFFER buf;
ACPI_STATUS s __diagused;
ACPI_STATUS s __maybe_unused;
tb_debug(sc, DBG_BRIDGE, "Executing OSUP\n");
+1 -1
View File
@@ -304,7 +304,7 @@ static int
tb_pcib_detach(device_t dev)
{
struct tb_pcib_softc *sc;
int error __diagused;
int error __maybe_unused;
sc = device_get_softc(dev);