Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Apr 2022 23:09:27 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ffd8101e9313 - main - usb: Add a __usbdebug_used for variables only used under #ifdef USB_DEBUG.
Message-ID:  <202204132309.23DN9Rul074412@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb:

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

commit ffd8101e93136667e974fe232f380d6330e15f60
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-04-13 23:08:20 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-04-13 23:08:20 +0000

    usb: Add a __usbdebug_used for variables only used under #ifdef USB_DEBUG.
    
    Use it for various variables only used in DPRINTF debug traces
    conditional on USB_DEBUG.
---
 sys/dev/usb/controller/ohci.c | 2 +-
 sys/dev/usb/input/uep.c       | 2 +-
 sys/dev/usb/net/if_cdce.c     | 2 +-
 sys/dev/usb/usb_debug.h       | 2 ++
 sys/dev/usb/usb_msctest.c     | 2 +-
 5 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys/dev/usb/controller/ohci.c b/sys/dev/usb/controller/ohci.c
index 7268af06a602..880e2e347619 100644
--- a/sys/dev/usb/controller/ohci.c
+++ b/sys/dev/usb/controller/ohci.c
@@ -1578,7 +1578,7 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last)
 static void
 ohci_root_intr(ohci_softc_t *sc)
 {
-	uint32_t hstatus;
+	uint32_t hstatus __usbdebug_used;
 	uint16_t i;
 	uint16_t m;
 
diff --git a/sys/dev/usb/input/uep.c b/sys/dev/usb/input/uep.c
index 5b96a31b1dee..5fece855e650 100644
--- a/sys/dev/usb/input/uep.c
+++ b/sys/dev/usb/input/uep.c
@@ -177,7 +177,7 @@ get_pkt_len(u_char *buf)
 static void
 uep_process_pkt(struct uep_softc *sc, u_char *buf)
 {
-	int32_t x, y;
+	int32_t x __usbdebug_used, y __usbdebug_used;
 #ifdef EVDEV_SUPPORT
 	int touch;
 #endif
diff --git a/sys/dev/usb/net/if_cdce.c b/sys/dev/usb/net/if_cdce.c
index f3c73567b7ce..b5fa4944974c 100644
--- a/sys/dev/usb/net/if_cdce.c
+++ b/sys/dev/usb/net/if_cdce.c
@@ -1590,7 +1590,7 @@ cdce_ncm_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error)
 	struct usb_page_cache *pc = usbd_xfer_get_frame(xfer, 0);
 	struct ifnet *ifp = uether_getifp(&sc->sc_ue);
 	struct mbuf *m;
-	int sumdata;
+	int sumdata __usbdebug_used;
 	int sumlen;
 	int actlen;
 	int aframes;
diff --git a/sys/dev/usb/usb_debug.h b/sys/dev/usb/usb_debug.h
index 87c0dcfe3d5f..9bcbaec70ef4 100644
--- a/sys/dev/usb/usb_debug.h
+++ b/sys/dev/usb/usb_debug.h
@@ -44,9 +44,11 @@ extern int usb_debug;
   }						\
 } while (0)
 #define	DPRINTF(...)	DPRINTFN(1, __VA_ARGS__)
+#define	__usbdebug_used
 #else
 #define	DPRINTF(...) do { } while (0)
 #define	DPRINTFN(...) do { } while (0)
+#define	__usbdebug_used __unused
 #endif
 #endif
 
diff --git a/sys/dev/usb/usb_msctest.c b/sys/dev/usb/usb_msctest.c
index 5dcf8d151119..bf60e5852598 100644
--- a/sys/dev/usb/usb_msctest.c
+++ b/sys/dev/usb/usb_msctest.c
@@ -964,7 +964,7 @@ usb_error_t
 usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method)
 {
 	struct bbb_transfer *sc;
-	usb_error_t err;
+	usb_error_t err __usbdebug_used;
 
 	sc = bbb_attach(udev, iface_index, UICLASS_MASS);
 	if (sc == NULL)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202204132309.23DN9Rul074412>