git: 174d86a01bf6 - main - tws: fix "set but not used" in the tws driver

From: Robert Wing <rew_at_FreeBSD.org>
Date: Sun, 09 Jan 2022 23:31:19 UTC
The branch main has been updated by rew:

URL: https://cgit.FreeBSD.org/src/commit/?id=174d86a01bf69a042ff34902ecb6c4d490b36996

commit 174d86a01bf69a042ff34902ecb6c4d490b36996
Author:     Robert Wing <rew@FreeBSD.org>
AuthorDate: 2022-01-09 23:28:08 +0000
Commit:     Robert Wing <rew@FreeBSD.org>
CommitDate: 2022-01-09 23:28:08 +0000

    tws: fix "set but not used" in the tws driver
    
    With __diagused, these warnings were still emitted since INVARIANTS was
    defined but TWS_DEBUG was not.
    
    Fixes:  a21f086a3316 ("Fix "set but not used" in the tws driver")
    Differential Revision:  https://reviews.freebsd.org/D33784
---
 sys/dev/tws/tws.c          | 2 +-
 sys/dev/tws/tws_hdm.c      | 2 +-
 sys/dev/tws/tws_services.h | 2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/dev/tws/tws.c b/sys/dev/tws/tws.c
index 00446252b2af..de7d20bf900b 100644
--- a/sys/dev/tws/tws.c
+++ b/sys/dev/tws/tws.c
@@ -349,7 +349,7 @@ tws_detach(device_t dev)
 {
     struct tws_softc *sc = device_get_softc(dev);
     int i;
-    u_int32_t reg __diagused;
+    u_int32_t reg __tws_debug;
 
     TWS_TRACE_DEBUG(sc, "entry", 0, 0);
 
diff --git a/sys/dev/tws/tws_hdm.c b/sys/dev/tws/tws_hdm.c
index 11d9320948a0..bebece529c97 100644
--- a/sys/dev/tws/tws_hdm.c
+++ b/sys/dev/tws/tws_hdm.c
@@ -82,7 +82,7 @@ void tws_display_ctlr_info(struct tws_softc *sc);
 int 
 tws_init_ctlr(struct tws_softc *sc)
 {
-    u_int64_t reg __diagused;
+    u_int64_t reg __tws_debug;
     u_int32_t regh, regl;
 
     TWS_TRACE_DEBUG(sc, "entry", sc, sc->is64bit);
diff --git a/sys/dev/tws/tws_services.h b/sys/dev/tws/tws_services.h
index e0e5b756981a..079697e9b186 100644
--- a/sys/dev/tws/tws_services.h
+++ b/sys/dev/tws/tws_services.h
@@ -61,10 +61,12 @@ void tws_init_qs(struct tws_softc *sc);
 #endif
 
 #ifdef TWS_TRACE_DEBUG_ON
+    #define __tws_debug
     #define TWS_TRACE_DEBUG(sc, desc, val1, val2) \
             tws_trace(__FILE__, __func__, __LINE__, sc, desc, \
                                    (u_int64_t)val1, (u_int64_t)val2)
 #else
+    #define __tws_debug __unused
     #define TWS_TRACE_DEBUG(sc, desc, val1, val2)
 #endif