Module Name:    src
Committed By:   gson
Date:           Tue Nov 26 10:24:17 UTC 2019

Modified Files:
        src/sys/dev/usb: if_urtwn.c

Log Message:
Convert debug printfs to usbhist.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/usb/if_urtwn.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.73 src/sys/dev/usb/if_urtwn.c:1.74
--- src/sys/dev/usb/if_urtwn.c:1.73	Thu Oct 10 23:30:02 2019
+++ src/sys/dev/usb/if_urtwn.c	Tue Nov 26 10:24:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.73 2019/10/10 23:30:02 bad Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.74 2019/11/26 10:24:17 gson Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.73 2019/10/10 23:30:02 bad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.74 2019/11/26 10:24:17 gson Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -73,6 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v
 #include <dev/usb/usbdivar.h>
 #include <dev/usb/usbdi_util.h>
 #include <dev/usb/usbdevs.h>
+#include <dev/usb/usbhist.h>
 
 #include <dev/ic/rtwnreg.h>
 #include <dev/ic/rtwn_data.h>
@@ -95,10 +96,27 @@ __KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v
 #define	DBG_REG		__BIT(6)
 #define	DBG_ALL		0xffffffffU
 u_int urtwn_debug = 0;
-#define DPRINTFN(n, s)	\
-	do { if (urtwn_debug & (n)) printf s; } while (/*CONSTCOND*/0)
+#define DPRINTFN(n, fmt, a, b, c, d) do {			\
+	if (urtwn_debug & (n)) {				\
+		KERNHIST_LOG(usbhist, fmt, a, b, c, d);		\
+	}							\
+} while (/*CONSTCOND*/0)
+#define URTWNHIST_FUNC() USBHIST_FUNC()
+#define URTWNHIST_CALLED() do {					\
+	if (urtwn_debug & DBG_FN) {				\
+		KERNHIST_CALLED(usbhist);			\
+	}							\
+} while(/*CONSTCOND*/0)
+#define URTWNHIST_CALLARGS(fmt, a, b, c, d) do {		\
+	if (urtwn_debug & DBG_FN) {				\
+		KERNHIST_CALLARGS(usbhist, fmt, a, b, c, d);	\
+	}							\
+} while(/*CONSTCOND*/0)
 #else
-#define DPRINTFN(n, s)
+#define DPRINTFN(n, fmt, a, b, c, d)
+#define URTWNHIST_FUNC()
+#define URTWNHIST_CALLED()
+#define URTWNHIST_CALLARGS(fmt, a, b, c, d)
 #endif
 
 #define URTWN_DEV(v,p)	{ { USB_VENDOR_##v, USB_PRODUCT_##v##_##p }, 0 }
@@ -350,6 +368,8 @@ urtwn_attach(device_t parent, device_t s
 	size_t i;
 	int error;
 
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
+
 	sc->sc_dev = self;
 	sc->sc_udev = uaa->uaa_device;
 
@@ -363,8 +383,6 @@ urtwn_attach(device_t parent, device_t s
 	aprint_naive("\n");
 	aprint_normal("\n");
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
-
 	devinfop = usbd_devinfo_alloc(sc->sc_udev, 0);
 	aprint_normal_dev(self, "%s\n", devinfop);
 	usbd_devinfo_free(devinfop);
@@ -539,7 +557,7 @@ urtwn_detach(device_t self, int flags)
 	struct ifnet *ifp = &sc->sc_if;
 	int s;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	pmf_device_deregister(self);
 
@@ -589,7 +607,7 @@ urtwn_activate(device_t self, enum devac
 {
 	struct urtwn_softc *sc = device_private(self);
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	switch (act) {
 	case DVACT_DEACTIVATE:
@@ -611,7 +629,7 @@ urtwn_open_pipes(struct urtwn_softc *sc)
 	size_t i, ntx = 0, nrx = 0;
 	int error;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	/* Determine the number of bulk-out pipes. */
 	id = usbd_get_interface_descriptor(sc->sc_iface);
@@ -641,8 +659,8 @@ urtwn_open_pipes(struct urtwn_softc *sc)
 		    "%zd: invalid number of Tx bulk pipes\n", ntx);
 		return EIO;
 	}
-	DPRINTFN(DBG_INIT, ("%s: %s: found %zd/%zd bulk-in/out pipes\n",
-	    device_xname(sc->sc_dev), __func__, nrx, ntx));
+	DPRINTFN(DBG_INIT, "found %jd/%jd bulk-in/out pipes",
+	    nrx, ntx, 0, 0);
 	sc->rx_npipe = nrx;
 	sc->tx_npipe = ntx;
 
@@ -688,7 +706,7 @@ urtwn_close_pipes(struct urtwn_softc *sc
 	struct usbd_pipe *pipe;
 	size_t i;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	/* Close Rx pipes. */
 	CTASSERT(sizeof(pipe) == sizeof(void *));
@@ -715,7 +733,7 @@ urtwn_alloc_rx_list(struct urtwn_softc *
 	size_t i;
 	int error = 0;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	for (size_t j = 0; j < sc->rx_npipe; j++) {
 		TAILQ_INIT(&sc->rx_free_list[j]);
@@ -747,7 +765,7 @@ urtwn_free_rx_list(struct urtwn_softc *s
 	struct usbd_xfer *xfer;
 	size_t i;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	/* NB: Caller must abort pipe first. */
 	for (size_t j = 0; j < sc->rx_npipe; j++) {
@@ -767,7 +785,7 @@ urtwn_alloc_tx_list(struct urtwn_softc *
 	size_t i;
 	int error = 0;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	mutex_enter(&sc->sc_tx_mtx);
 	for (size_t j = 0; j < sc->tx_npipe; j++) {
@@ -808,7 +826,7 @@ urtwn_free_tx_list(struct urtwn_softc *s
 	struct usbd_xfer *xfer;
 	size_t i;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	/* NB: Caller must abort pipe first. */
 	for (size_t j = 0; j < sc->tx_npipe; j++) {
@@ -839,7 +857,7 @@ urtwn_task(void *arg)
 	struct urtwn_host_cmd *cmd;
 	int s;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 	if (ic->ic_state == IEEE80211_S_RUN && 
 	    (ic->ic_opmode == IEEE80211_M_HOSTAP ||
 	    ic->ic_opmode == IEEE80211_M_IBSS)) {
@@ -887,8 +905,9 @@ urtwn_do_async(struct urtwn_softc *sc, v
 	struct urtwn_host_cmd *cmd;
 	int s;
 
-	DPRINTFN(DBG_FN, ("%s: %s: cb=%p, arg=%p, len=%d\n",
-	    device_xname(sc->sc_dev), __func__, cb, arg, len));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("cb=%#jx, arg=%#jx, len=%jd",
+	    (uintptr_t)cb, (uintptr_t)arg, len, 0);
 
 	s = splusb();
 	mutex_spin_enter(&sc->sc_task_mtx);
@@ -911,7 +930,7 @@ static void
 urtwn_wait_async(struct urtwn_softc *sc)
 {
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	/* Wait for all queued asynchronous commands to complete. */
 	while (sc->cmdq.queued > 0)
@@ -925,6 +944,7 @@ urtwn_write_region_1(struct urtwn_softc 
 	usb_device_request_t req;
 	usbd_status error;
 
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
 	req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
@@ -934,8 +954,8 @@ urtwn_write_region_1(struct urtwn_softc 
 	USETW(req.wLength, len);
 	error = usbd_do_request(sc->sc_udev, &req, buf);
 	if (error != USBD_NORMAL_COMPLETION) {
-		DPRINTFN(DBG_REG, ("%s: %s: error=%d: addr=0x%x, len=%d\n",
-		    device_xname(sc->sc_dev), __func__, error, addr, len));
+		DPRINTFN(DBG_REG, "error=%jd: addr=0x%jx, len=%jd",
+		    error, addr, len, 0);
 	}
 	return error;
 }
@@ -944,8 +964,8 @@ static void
 urtwn_write_1(struct urtwn_softc *sc, uint16_t addr, uint8_t val)
 {
 
-	DPRINTFN(DBG_REG, ("%s: %s: addr=0x%x, val=0x%x\n",
-	    device_xname(sc->sc_dev), __func__, addr, val));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
+	DPRINTFN(DBG_REG, "addr=0x%jx, val=0x%jx", addr, val, 0, 0);
 
 	urtwn_write_region_1(sc, addr, &val, 1);
 }
@@ -955,8 +975,8 @@ urtwn_write_2(struct urtwn_softc *sc, ui
 {
 	uint8_t buf[2];
 
-	DPRINTFN(DBG_REG, ("%s: %s: addr=0x%x, val=0x%x\n",
-	    device_xname(sc->sc_dev), __func__, addr, val));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
+	DPRINTFN(DBG_REG, "addr=0x%jx, val=0x%jx", addr, val, 0, 0);
 
 	buf[0] = (uint8_t)val;
 	buf[1] = (uint8_t)(val >> 8);
@@ -968,8 +988,8 @@ urtwn_write_4(struct urtwn_softc *sc, ui
 {
 	uint8_t buf[4];
 
-	DPRINTFN(DBG_REG, ("%s: %s: addr=0x%x, val=0x%x\n",
-	    device_xname(sc->sc_dev), __func__, addr, val));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
+	DPRINTFN(DBG_REG, "addr=0x%jx, val=0x%jx", addr, val, 0, 0);
 
 	buf[0] = (uint8_t)val;
 	buf[1] = (uint8_t)(val >> 8);
@@ -982,8 +1002,8 @@ static int
 urtwn_write_region(struct urtwn_softc *sc, uint16_t addr, uint8_t *buf, int len)
 {
 
-	DPRINTFN(DBG_REG, ("%s: %s: addr=0x%x, len=0x%x\n",
-	    device_xname(sc->sc_dev), __func__, addr, len));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("addr=0x%jx, len=0x%jx", addr, len, 0, 0);
 
 	return urtwn_write_region_1(sc, addr, buf, len);
 }
@@ -995,6 +1015,8 @@ urtwn_read_region_1(struct urtwn_softc *
 	usb_device_request_t req;
 	usbd_status error;
 
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
+
 	req.bmRequestType = UT_READ_VENDOR_DEVICE;
 	req.bRequest = R92C_REQ_REGS;
 	USETW(req.wValue, addr);
@@ -1002,8 +1024,8 @@ urtwn_read_region_1(struct urtwn_softc *
 	USETW(req.wLength, len);
 	error = usbd_do_request(sc->sc_udev, &req, buf);
 	if (error != USBD_NORMAL_COMPLETION) {
-		DPRINTFN(DBG_REG, ("%s: %s: error=%d: addr=0x%x, len=%d\n",
-		    device_xname(sc->sc_dev), __func__, error, addr, len));
+		DPRINTFN(DBG_REG, "error=%jd: addr=0x%jx, len=%jd",
+		    error, addr, len, 0);
 	}
 	return error;
 }
@@ -1013,11 +1035,12 @@ urtwn_read_1(struct urtwn_softc *sc, uin
 {
 	uint8_t val;
 
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
+
 	if (urtwn_read_region_1(sc, addr, &val, 1) != USBD_NORMAL_COMPLETION)
 		return 0xff;
 
-	DPRINTFN(DBG_REG, ("%s: %s: addr=0x%x, val=0x%x\n",
-	    device_xname(sc->sc_dev), __func__, addr, val));
+	DPRINTFN(DBG_REG, "addr=0x%jx, val=0x%jx", addr, val, 0, 0);
 	return val;
 }
 
@@ -1027,12 +1050,13 @@ urtwn_read_2(struct urtwn_softc *sc, uin
 	uint8_t buf[2];
 	uint16_t val;
 
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
+
 	if (urtwn_read_region_1(sc, addr, buf, 2) != USBD_NORMAL_COMPLETION)
 		return 0xffff;
 
 	val = LE_READ_2(&buf[0]);
-	DPRINTFN(DBG_REG, ("%s: %s: addr=0x%x, val=0x%x\n",
-	    device_xname(sc->sc_dev), __func__, addr, val));
+	DPRINTFN(DBG_REG, "addr=0x%jx, val=0x%jx", addr, val, 0, 0);
 	return val;
 }
 
@@ -1042,12 +1066,13 @@ urtwn_read_4(struct urtwn_softc *sc, uin
 	uint8_t buf[4];
 	uint32_t val;
 
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
+
 	if (urtwn_read_region_1(sc, addr, buf, 4) != USBD_NORMAL_COMPLETION)
 		return 0xffffffff;
 
 	val = LE_READ_4(&buf[0]);
-	DPRINTFN(DBG_REG, ("%s: %s: addr=0x%x, val=0x%x\n",
-	    device_xname(sc->sc_dev), __func__, addr, val));
+	DPRINTFN(DBG_REG, "addr=0x%jx, val=0x%jx", addr, val, 0, 0);
 	return val;
 }
 
@@ -1059,8 +1084,8 @@ urtwn_fw_cmd(struct urtwn_softc *sc, uin
 	int fwcur;
 	int ntries;
 
-	DPRINTFN(DBG_REG, ("%s: %s: id=%d, buf=%p, len=%d\n",
-	    device_xname(sc->sc_dev), __func__, id, buf, len));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
+	DPRINTFN(DBG_REG, "id=%jd, buf=%#jx, len=%jd", id, (uintptr_t)buf, len, 0);
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -1234,7 +1259,7 @@ urtwn_efuse_read(struct urtwn_softc *sc)
 	uint8_t off, msk;
 	size_t i;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -1259,13 +1284,9 @@ urtwn_efuse_read(struct urtwn_softc *sc)
 		}
 	}
 #ifdef URTWN_DEBUG
-	if (urtwn_debug & DBG_INIT) {
-		/* Dump ROM content. */
-		printf("%s: %s", device_xname(sc->sc_dev), __func__);
-		for (i = 0; i < (int)sizeof(sc->rom); i++)
-			printf(":%02x", rom[i]);
-		printf("\n");
-	}
+	/* Dump ROM content. */
+	for (i = 0; i < (int)sizeof(sc->rom); i++)
+		DPRINTFN(DBG_INIT, "%04jx: %02jx", i, rom[i], 0, 0);
 #endif
 }
 
@@ -1297,7 +1318,7 @@ urtwn_read_chipid(struct urtwn_softc *sc
 {
 	uint32_t reg;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	if (ISSET(sc->chip, URTWN_CHIP_88E) ||
 	    ISSET(sc->chip, URTWN_CHIP_92EU))
@@ -1414,7 +1435,7 @@ urtwn_read_rom(struct urtwn_softc *sc)
 	struct ieee80211com *ic = &sc->sc_ic;
 	struct r92c_rom *rom = &sc->rom;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	mutex_enter(&sc->sc_write_mtx);
 
@@ -1431,9 +1452,8 @@ urtwn_read_rom(struct urtwn_softc *sc)
 	sc->regulatory = MS(rom->rf_opt1, R92C_ROM_RF1_REGULATORY);
 
 	DPRINTFN(DBG_INIT,
-	    ("%s: %s: PA setting=0x%x, board=0x%x, regulatory=%d\n",
-	    device_xname(sc->sc_dev), __func__, sc->pa_setting,
-	    sc->board_type, sc->regulatory));
+	    "PA setting=0x%jx, board=0x%jx, regulatory=%jd",
+	    sc->pa_setting, sc->board_type, sc->regulatory, 0);
 
 	IEEE80211_ADDR_COPY(ic->ic_myaddr, rom->macaddr);
 
@@ -1454,7 +1474,7 @@ urtwn_r88e_read_rom(struct urtwn_softc *
 	uint8_t off, msk, tmp;
 	int i;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	mutex_enter(&sc->sc_write_mtx);
 
@@ -1521,12 +1541,9 @@ urtwn_r88e_read_rom(struct urtwn_softc *
 static int
 urtwn_media_change(struct ifnet *ifp)
 {
-#ifdef URTWN_DEBUG
-	struct urtwn_softc *sc = ifp->if_softc;
-#endif
 	int error;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	if ((error = ieee80211_media_change(ifp)) != ENETRESET)
 		return error;
@@ -1557,7 +1574,7 @@ urtwn_ra_init(struct urtwn_softc *sc)
 	size_t maxrate, maxbasicrate, i, j;
 	int error;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -1593,10 +1610,10 @@ urtwn_ra_init(struct urtwn_softc *sc)
 	} else {
 		mode = R92C_RAID_11BG;
 	}
-	DPRINTFN(DBG_INIT, ("%s: %s: mode=0x%x rates=0x%x, basicrates=0x%x, "
-	    "maxrate=%zx, maxbasicrate=%zx\n",
-	    device_xname(sc->sc_dev), __func__, mode, rates, basicrates,
-	    maxrate, maxbasicrate));
+	DPRINTFN(DBG_INIT, "mode=0x%jx", mode, 0, 0, 0);
+	DPRINTFN(DBG_INIT, "rates=0x%jx, basicrates=0x%jx, "
+	    "maxrate=%jx, maxbasicrate=%jx",
+	    rates, basicrates, maxrate, maxbasicrate);
 
 	if (ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_PREAMBLE) {
 		maxbasicrate |= R92C_RATE_SHORTGI;
@@ -1615,8 +1632,7 @@ urtwn_ra_init(struct urtwn_softc *sc)
 		return error;
 	}
 	/* Set initial MRR rate. */
-	DPRINTFN(DBG_INIT, ("%s: %s: maxbasicrate=%zd\n",
-	    device_xname(sc->sc_dev), __func__, maxbasicrate));
+	DPRINTFN(DBG_INIT, "maxbasicrate=%jd", maxbasicrate, 0, 0, 0);
 	urtwn_write_1(sc, R92C_INIDATA_RATE_SEL(RTWN_MACID_BC), maxbasicrate);
 
 	/* Set rates mask for unicast frames. */
@@ -1630,8 +1646,7 @@ urtwn_ra_init(struct urtwn_softc *sc)
 		return error;
 	}
 	/* Set initial MRR rate. */
-	DPRINTFN(DBG_INIT, ("%s: %s: maxrate=%zd\n", device_xname(sc->sc_dev),
-	    __func__, maxrate));
+	DPRINTFN(DBG_INIT, "maxrate=%jd", maxrate, 0, 0, 0);
 	urtwn_write_1(sc, R92C_INIDATA_RATE_SEL(RTWN_MACID_BSS), maxrate);
 
 	rrsr_rate = ic->ic_fixed_rate;
@@ -1653,7 +1668,7 @@ urtwn_get_nettype(struct urtwn_softc *sc
 	struct ieee80211com *ic = &sc->sc_ic;
 	int type;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	switch (ic->ic_opmode) {
 	case IEEE80211_M_STA:
@@ -1677,8 +1692,8 @@ urtwn_set_nettype0_msr(struct urtwn_soft
 {
 	uint8_t	reg;
 
-	DPRINTFN(DBG_FN, ("%s: %s: type=%d\n", device_xname(sc->sc_dev),
-	    __func__, type));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("type=%jd", type, 0, 0, 0);
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -1692,7 +1707,7 @@ urtwn_tsf_sync_enable(struct urtwn_softc
 	struct ieee80211_node *ni = sc->sc_ic.ic_bss;
 	uint64_t tsf;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -1721,8 +1736,8 @@ urtwn_set_led(struct urtwn_softc *sc, in
 {
 	uint8_t reg;
 
-	DPRINTFN(DBG_FN, ("%s: %s: led=%d, on=%d\n", device_xname(sc->sc_dev),
-	    __func__, led, on));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("led=%jd, on=%jd", led, on, 0, 0);
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -1764,7 +1779,7 @@ urtwn_calib_to(void *arg)
 {
 	struct urtwn_softc *sc = arg;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	if (sc->sc_dying)
 		return;
@@ -1780,7 +1795,7 @@ urtwn_calib_to_cb(struct urtwn_softc *sc
 	struct r92c_fw_cmd_rssi cmd;
 	struct r92e_fw_cmd_rssi cmde;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	if (sc->sc_ic.ic_state != IEEE80211_S_RUN)
 		goto restart_timer;
@@ -1794,8 +1809,8 @@ urtwn_calib_to_cb(struct urtwn_softc *sc
 		cmde.macid = 0;	/* BSS. */
 		cmd.pwdb = sc->avg_pwdb;
 		cmde.pwdb = sc->avg_pwdb;
-		DPRINTFN(DBG_RF, ("%s: %s: sending RSSI command avg=%d\n",
-		    device_xname(sc->sc_dev), __func__, sc->avg_pwdb));
+		DPRINTFN(DBG_RF, "sending RSSI command avg=%jd",
+		    sc->avg_pwdb, 0, 0, 0);
 		if (!ISSET(sc->chip, URTWN_CHIP_92EU)) {
 			urtwn_fw_cmd(sc, R92C_CMD_RSSI_SETTING, &cmd,
 			    sizeof(cmd));
@@ -1822,7 +1837,7 @@ urtwn_next_scan(void *arg)
 	struct urtwn_softc *sc = arg;
 	int s;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	if (sc->sc_dying)
 		return;
@@ -1836,8 +1851,15 @@ urtwn_next_scan(void *arg)
 static void
 urtwn_newassoc(struct ieee80211_node *ni, int isnew)
 {
-	DPRINTFN(DBG_FN, ("%s: new node %s\n", __func__,
-	    ether_sprintf(ni->ni_macaddr)));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("new node %06jx%06jx",
+	    ni->ni_macaddr[0] << 2 |
+	    ni->ni_macaddr[1] << 1 |
+	    ni->ni_macaddr[2],
+	    ni->ni_macaddr[3] << 2 |
+	    ni->ni_macaddr[4] << 1 |
+	    ni->ni_macaddr[5],
+	    0, 0);
 	/* start with lowest Tx rate */
 	ni->ni_txrate = 0;
 }
@@ -1848,9 +1870,8 @@ urtwn_newstate(struct ieee80211com *ic, 
 	struct urtwn_softc *sc = ic->ic_ifp->if_softc;
 	struct urtwn_cmd_newstate cmd;
 
-	DPRINTFN(DBG_FN, ("%s: %s: nstate=%s(%d), arg=%d\n",
-	    device_xname(sc->sc_dev), __func__,
-	    ieee80211_state_name[nstate], nstate, arg));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("nstate=%jd, arg=%jd", nstate, arg, 0, 0);
 
 	callout_stop(&sc->sc_scan_to);
 	callout_stop(&sc->sc_calib_to);
@@ -1874,10 +1895,8 @@ urtwn_newstate_cb(struct urtwn_softc *sc
 	uint8_t sifs_time, msr;
 	int s;
 
-	DPRINTFN(DBG_FN|DBG_STM, ("%s: %s: %s(%d)->%s(%d)\n",
-	    device_xname(sc->sc_dev), __func__,
-	    ieee80211_state_name[ostate], ostate,
-	    ieee80211_state_name[nstate], nstate));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
+	DPRINTFN(DBG_STM, "%jd->%jd", ostate, nstate, 0, 0);
 
 	s = splnet();
 	mutex_enter(&sc->sc_write_mtx);
@@ -2163,7 +2182,7 @@ urtwn_wme_update(struct ieee80211com *ic
 {
 	struct urtwn_softc *sc = ic->ic_ifp->if_softc;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	/* don't override default WME values if WME is not actually enabled */
 	if (!(ic->ic_flags & IEEE80211_F_WME))
@@ -2188,8 +2207,8 @@ urtwn_wme_update_cb(struct urtwn_softc *
 	int ac, aifs, slottime;
 	int s;
 
-	DPRINTFN(DBG_FN|DBG_STM, ("%s: %s\n", device_xname(sc->sc_dev),
-	    __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
+	DPRINTFN(DBG_STM, "called", 0, 0, 0, 0);
 
 	s = splnet();
 	mutex_enter(&sc->sc_write_mtx);
@@ -2213,8 +2232,8 @@ urtwn_update_avgrssi(struct urtwn_softc 
 {
 	int pwdb;
 
-	DPRINTFN(DBG_FN, ("%s: %s: rate=%d, rsst=%d\n",
-	    device_xname(sc->sc_dev), __func__, rate, rssi));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("rate=%jd, rsst=%jd", rate, rssi, 0, 0);
 
 	/* Convert antenna signal to percentage. */
 	if (rssi <= -100 || rssi >= 20)
@@ -2246,9 +2265,8 @@ urtwn_update_avgrssi(struct urtwn_softc 
 	else
 		sc->avg_pwdb = ((sc->avg_pwdb * 19 + pwdb) / 20);
 
-	DPRINTFN(DBG_RF, ("%s: %s: rate=%d rssi=%d PWDB=%d EMA=%d\n",
-		     device_xname(sc->sc_dev), __func__,
-		     rate, rssi, pwdb, sc->avg_pwdb));
+	DPRINTFN(DBG_RF, "rate=%jd rssi=%jd PWDB=%jd EMA=%jd",
+	    rate, rssi, pwdb, sc->avg_pwdb);
 }
 
 static int8_t
@@ -2260,8 +2278,8 @@ urtwn_get_rssi(struct urtwn_softc *sc, i
 	uint8_t rpt;
 	int8_t rssi;
 
-	DPRINTFN(DBG_FN, ("%s: %s: rate=%d\n", device_xname(sc->sc_dev),
-	    __func__, rate));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("rate=%jd", rate, 0, 0, 0);
 
 	if (rate <= 3) {
 		cck = (struct r92c_rx_cck *)physt;
@@ -2288,8 +2306,8 @@ urtwn_r88e_get_rssi(struct urtwn_softc *
 	uint8_t cck_agc_rpt, lna_idx, vga_idx;
 	int8_t rssi;
 
-	DPRINTFN(DBG_FN, ("%s: %s: rate=%d\n", device_xname(sc->sc_dev),
-	    __func__, rate));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("rate=%jd", rate, 0, 0, 0);
 
 	rssi = 0;
 	if (rate <= 3) {
@@ -2348,8 +2366,8 @@ urtwn_rx_frame(struct urtwn_softc *sc, u
 	int8_t rssi = 0;
 	int s, infosz;
 
-	DPRINTFN(DBG_FN, ("%s: %s: buf=%p, pktlen=%d\n",
-	    device_xname(sc->sc_dev), __func__, buf, pktlen));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("buf=%jp, pktlen=%#jd", (uintptr_t)buf, pktlen, 0, 0);
 
 	stat = (struct r92c_rx_desc_usb *)buf;
 	rxdw0 = le32toh(stat->rxdw0);
@@ -2360,8 +2378,7 @@ urtwn_rx_frame(struct urtwn_softc *sc, u
 		 * This should not happen since we setup our Rx filter
 		 * to not receive these frames.
 		 */
-		DPRINTFN(DBG_RX, ("%s: %s: CRC error\n",
-		    device_xname(sc->sc_dev), __func__));
+		DPRINTFN(DBG_RX, "CRC error", 0, 0, 0, 0);
 		ifp->if_ierrors++;
 		return;
 	}
@@ -2371,15 +2388,13 @@ urtwn_rx_frame(struct urtwn_softc *sc, u
 	 */
 //	if (__predict_false(pktlen < (int)sizeof(*wh))) {
 	if (__predict_false(pktlen < (int)sizeof(struct ieee80211_frame_ack))) {
-		DPRINTFN(DBG_RX, ("%s: %s: packet too short %d\n",
-		    device_xname(sc->sc_dev), __func__, pktlen));
+		DPRINTFN(DBG_RX, "packet too short %jd", pktlen, 0, 0, 0);
 		ic->ic_stats.is_rx_tooshort++;
 		ifp->if_ierrors++;
 		return;
 	}
 	if (__predict_false(pktlen > MCLBYTES)) {
-		DPRINTFN(DBG_RX, ("%s: %s: packet too big %d\n",
-		    device_xname(sc->sc_dev), __func__, pktlen));
+		DPRINTFN(DBG_RX, "packet too big %jd", pktlen, 0, 0, 0);
 		ifp->if_ierrors++;
 		return;
 	}
@@ -2397,8 +2412,8 @@ urtwn_rx_frame(struct urtwn_softc *sc, u
 		urtwn_update_avgrssi(sc, rate, rssi);
 	}
 
-	DPRINTFN(DBG_RX, ("%s: %s: Rx frame len=%d rate=%d infosz=%d rssi=%d\n",
-	    device_xname(sc->sc_dev), __func__, pktlen, rate, infosz, rssi));
+	DPRINTFN(DBG_RX, "Rx frame len=%jd rate=%jd infosz=%jd rssi=%jd",
+	    pktlen, rate, infosz, rssi);
 
 	MGETHDR(m, M_DONTWAIT, MT_DATA);
 	if (__predict_false(m == NULL)) {
@@ -2480,8 +2495,8 @@ urtwn_rxeof(struct usbd_xfer *xfer, void
 	uint8_t *buf;
 	int len, totlen, pktlen, infosz, npkts;
 
-	DPRINTFN(DBG_FN|DBG_RX, ("%s: %s: status=%d\n",
-	    device_xname(sc->sc_dev), __func__, status));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
+	DPRINTFN(DBG_RX, "status=%jd", status, 0, 0, 0);
 
 	mutex_enter(&sc->sc_rx_mtx);
 	TAILQ_REMOVE(&sc->rx_free_list[pidx], data, next);
@@ -2499,8 +2514,7 @@ urtwn_rxeof(struct usbd_xfer *xfer, void
 	usbd_get_xfer_status(xfer, NULL, NULL, &len, NULL);
 
 	if (__predict_false(len < (int)sizeof(*stat))) {
-		DPRINTFN(DBG_RX, ("%s: %s: xfer too short %d\n",
-		    device_xname(sc->sc_dev), __func__, len));
+		DPRINTFN(DBG_RX, "xfer too short %jd", len, 0, 0, 0);
 		goto resubmit;
 	}
 	buf = data->buf;
@@ -2508,8 +2522,7 @@ urtwn_rxeof(struct usbd_xfer *xfer, void
 	/* Get the number of encapsulated frames. */
 	stat = (struct r92c_rx_desc_usb *)buf;
 	npkts = MS(le32toh(stat->rxdw2), R92C_RXDW2_PKTCNT);
-	DPRINTFN(DBG_RX, ("%s: %s: Rx %d frames in one chunk\n",
-	    device_xname(sc->sc_dev), __func__, npkts));
+	DPRINTFN(DBG_RX, "Rx %jd frames in one chunk", npkts, 0, 0, 0);
 
 	if (npkts != 0)
 		rnd_add_uint32(&sc->rnd_source, npkts);
@@ -2517,9 +2530,8 @@ urtwn_rxeof(struct usbd_xfer *xfer, void
 	/* Process all of them. */
 	while (npkts-- > 0) {
 		if (__predict_false(len < (int)sizeof(*stat))) {
-			DPRINTFN(DBG_RX,
-			    ("%s: %s: len(%d) is short than header\n",
-			    device_xname(sc->sc_dev), __func__, len));
+			DPRINTFN(DBG_RX, "len(%jd) is short than header",
+			    len, 0, 0, 0);
 			break;
 		}
 		stat = (struct r92c_rx_desc_usb *)buf;
@@ -2527,8 +2539,7 @@ urtwn_rxeof(struct usbd_xfer *xfer, void
 
 		pktlen = MS(rxdw0, R92C_RXDW0_PKTLEN);
 		if (__predict_false(pktlen == 0)) {
-			DPRINTFN(DBG_RX, ("%s: %s: pktlen is 0 byte\n",
-			    device_xname(sc->sc_dev), __func__));
+			DPRINTFN(DBG_RX, "pktlen is 0 byte", 0, 0, 0, 0);
 			break;
 		}
 
@@ -2537,9 +2548,8 @@ urtwn_rxeof(struct usbd_xfer *xfer, void
 		/* Make sure everything fits in xfer. */
 		totlen = sizeof(*stat) + infosz + pktlen;
 		if (__predict_false(totlen > len)) {
-			DPRINTFN(DBG_RX, ("%s: %s: pktlen %d(%d+%d+%d) > %d\n",
-			    device_xname(sc->sc_dev), __func__, totlen,
-			    (int)sizeof(*stat), infosz, pktlen, len));
+			DPRINTFN(DBG_RX, "pktlen (%jd+%jd+%jd) > %jd",
+			    (int)sizeof(*stat), infosz, pktlen, len);
 			break;
 		}
 
@@ -2568,8 +2578,8 @@ urtwn_txeof(struct usbd_xfer *xfer, void
 	size_t pidx = data->pidx;
 	int s;
 
-	DPRINTFN(DBG_FN|DBG_TX, ("%s: %s: status=%d\n",
-	    device_xname(sc->sc_dev), __func__, status));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
+	DPRINTFN(DBG_TX, "status=%jd", status, 0, 0, 0);
 
 	mutex_enter(&sc->sc_tx_mtx);
 	/* Put this Tx buffer back to our free list. */
@@ -2612,7 +2622,7 @@ urtwn_tx(struct urtwn_softc *sc, struct 
 	uint8_t raid, type, tid;
 	int s, hasqos, error;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	wh = mtod(m, struct ieee80211_frame *);
 	type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
@@ -2679,8 +2689,7 @@ urtwn_tx(struct urtwn_softc *sc, struct 
 
 	/* fix pad field */
 	if (padsize > 0) {
-		DPRINTFN(DBG_TX, ("%s: %s: padding: size=%zd\n",
-		    device_xname(sc->sc_dev), __func__, padsize));
+		DPRINTFN(DBG_TX, "padding: size=%jd", padsize, 0, 0, 0);
 		txd->txdw1 |= htole32(SM(R92C_TXDW1_PKTOFF, (padsize / 8)));
 	}
 
@@ -2690,9 +2699,8 @@ urtwn_tx(struct urtwn_softc *sc, struct 
 			raid = R92C_RAID_11B;
 		else
 			raid = R92C_RAID_11BG;
-		DPRINTFN(DBG_TX,
-		    ("%s: %s: data packet: tid=%d, raid=%d\n",
-		    device_xname(sc->sc_dev), __func__, tid, raid));
+		DPRINTFN(DBG_TX, "data packet: tid=%jd, raid=%jd",
+		    tid, raid, 0, 0);
 
 		if (!ISSET(sc->chip, URTWN_CHIP_92C)) {
 			txd->txdw1 |= htole32(
@@ -2735,8 +2743,7 @@ urtwn_tx(struct urtwn_softc *sc, struct 
 		else
 			txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11));
 	} else if (type == IEEE80211_FC0_TYPE_MGT) {
-		DPRINTFN(DBG_TX, ("%s: %s: mgmt packet\n",
-		    device_xname(sc->sc_dev), __func__));
+		DPRINTFN(DBG_TX, "mgmt packet", 0, 0, 0, 0);
 		txd->txdw1 |= htole32(
 		    SM(R92C_TXDW1_MACID, RTWN_MACID_BSS) |
 		    SM(R92C_TXDW1_QSEL, R92C_TXDW1_QSEL_MGNT) |
@@ -2748,8 +2755,7 @@ urtwn_tx(struct urtwn_softc *sc, struct 
 		txd->txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 0));
 	} else {
 		/* broadcast or multicast packets */
-		DPRINTFN(DBG_TX, ("%s: %s: bc or mc packet\n",
-		    device_xname(sc->sc_dev), __func__));
+		DPRINTFN(DBG_TX, "bc or mc packet", 0, 0, 0, 0);
 		txd->txdw1 |= htole32(
 		    SM(R92C_TXDW1_MACID, RTWN_MACID_BC) |
 		    SM(R92C_TXDW1_RAID, R92C_RAID_11B));
@@ -2796,8 +2802,7 @@ urtwn_tx(struct urtwn_softc *sc, struct 
 	if (__predict_false(error != USBD_NORMAL_COMPLETION &&
 	    error != USBD_IN_PROGRESS)) {
 		splx(s);
-		DPRINTFN(DBG_TX, ("%s: %s: transfer failed %d\n",
-		    device_xname(sc->sc_dev), __func__, error));
+		DPRINTFN(DBG_TX, "transfer failed %jd", error, 0, 0, 0);
 		return error;
 	}
 	splx(s);
@@ -2829,7 +2834,7 @@ urtwn_start(struct ifnet *ifp)
 	struct ieee80211_node *ni;
 	struct mbuf *m;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
 		return;
@@ -2845,8 +2850,8 @@ urtwn_start(struct ifnet *ifp)
 
 			if (data == NULL) {
 				ifp->if_flags |= IFF_OACTIVE;
-				DPRINTFN(DBG_TX, ("%s: empty tx_free_list\n",
-					    device_xname(sc->sc_dev)));
+				DPRINTFN(DBG_TX, "empty tx_free_list",
+				    0, 0, 0, 0);
 				return;
 			}
 			IF_DEQUEUE(&ic->ic_mgtq, m);
@@ -2877,8 +2882,7 @@ urtwn_start(struct ifnet *ifp)
 
 		if (data == NULL) {
 			ifp->if_flags |= IFF_OACTIVE;
-			DPRINTFN(DBG_TX, ("%s: empty tx_free_list\n",
-				    device_xname(sc->sc_dev)));
+			DPRINTFN(DBG_TX, "empty tx_free_list", 0, 0, 0, 0);
 			return;
 		}
 		IFQ_DEQUEUE(&ifp->if_snd, m);
@@ -2928,7 +2932,7 @@ urtwn_watchdog(struct ifnet *ifp)
 {
 	struct urtwn_softc *sc = ifp->if_softc;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	ifp->if_timer = 0;
 
@@ -2952,8 +2956,9 @@ urtwn_ioctl(struct ifnet *ifp, u_long cm
 	struct ieee80211com *ic = &sc->sc_ic;
 	int s, error = 0;
 
-	DPRINTFN(DBG_FN, ("%s: %s: cmd=0x%08lx, data=%p\n",
-	    device_xname(sc->sc_dev), __func__, cmd, data));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("cmd=0x%08jx, data=%#jx", cmd, (uintptr_t)data,
+	    0, 0);
 
 	s = splnet();
 
@@ -3029,7 +3034,7 @@ urtwn_r92c_power_on(struct urtwn_softc *
 	uint32_t reg;
 	int ntries;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -3122,7 +3127,7 @@ urtwn_r92e_power_on(struct urtwn_softc *
 	uint32_t val;
 	int ntries;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -3202,7 +3207,7 @@ urtwn_r88e_power_on(struct urtwn_softc *
 	uint8_t val;
 	int ntries;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -3262,7 +3267,7 @@ urtwn_llt_init(struct urtwn_softc *sc)
 	uint32_t val;
 	int error;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -3316,7 +3321,7 @@ urtwn_fw_reset(struct urtwn_softc *sc)
 	uint16_t reg;
 	int ntries;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -3340,7 +3345,7 @@ urtwn_r88e_fw_reset(struct urtwn_softc *
 {
 	uint16_t reg;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -3371,8 +3376,9 @@ urtwn_fw_loadpage(struct urtwn_softc *sc
 	uint32_t reg;
 	int off, mlen, error = 0;
 
-	DPRINTFN(DBG_FN, ("%s: %s: page=%d, buf=%p, len=%d\n",
-	    device_xname(sc->sc_dev), __func__, page, buf, len));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("page=%jd, buf=%#jx, len=%jd",
+	    page, (uintptr_t)buf, len, 0);
 
 	reg = urtwn_read_4(sc, R92C_MCUFWDL);
 	reg = RW(reg, R92C_MCUFWDL_PAGE, page);
@@ -3407,7 +3413,7 @@ urtwn_load_firmware(struct urtwn_softc *
 	uint32_t reg;
 	int mlen, ntries, page, error;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -3452,10 +3458,10 @@ urtwn_load_firmware(struct urtwn_softc *
 	    (le16toh(hdr->signature) >> 4) == 0x88e ||
 	    (le16toh(hdr->signature) >> 4) == 0x92e ||
 	    (le16toh(hdr->signature) >> 4) == 0x92c) {
-		DPRINTFN(DBG_INIT, ("%s: %s: FW V%d.%d %02d-%02d %02d:%02d\n",
-		    device_xname(sc->sc_dev), __func__,
-		    le16toh(hdr->version), le16toh(hdr->subversion),
-		    hdr->month, hdr->date, hdr->hour, hdr->minute));
+		DPRINTFN(DBG_INIT, "FW V%jd.%jd",
+		    le16toh(hdr->version), le16toh(hdr->subversion), 0, 0);
+		DPRINTFN(DBG_INIT, "%02jd-%02jd %02jd:%02jd",
+		    hdr->month, hdr->date, hdr->hour, hdr->minute);
 		ptr += sizeof(*hdr);
 		len -= sizeof(*hdr);
 	}
@@ -3553,7 +3559,7 @@ urtwn_r92c_dma_init(struct urtwn_softc *
 	uint32_t reg;
 	int error;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -3565,8 +3571,7 @@ urtwn_r92c_dma_init(struct urtwn_softc *
 	/* Get Tx queues to USB endpoints mapping. */
 	hashq = hasnq = haslq = 0;
 	reg = urtwn_read_2(sc, R92C_USB_EP + 1);
-	DPRINTFN(DBG_INIT, ("%s: %s: USB endpoints mapping 0x%x\n",
-	    device_xname(sc->sc_dev), __func__, reg));
+	DPRINTFN(DBG_INIT, "USB endpoints mapping 0x%jx", reg, 0, 0, 0);
 	if (MS(reg, R92C_USB_EP_HQ) != 0)
 		hashq = 1;
 	if (MS(reg, R92C_USB_EP_NQ) != 0)
@@ -3642,7 +3647,7 @@ urtwn_r88e_dma_init(struct urtwn_softc *
 	int nqueues;
 	int error;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -3694,7 +3699,7 @@ urtwn_mac_init(struct urtwn_softc *sc)
 {
 	size_t i;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -3722,7 +3727,7 @@ urtwn_bb_init(struct urtwn_softc *sc)
 	uint8_t crystalcap;
 	size_t i;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -3885,7 +3890,7 @@ urtwn_rf_init(struct urtwn_softc *sc)
 	uint32_t reg, mask, saved;
 	size_t i, j, idx;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	/* Select RF programming based on board type. */
 	if (ISSET(sc->chip, URTWN_CHIP_88E))
@@ -3971,7 +3976,7 @@ urtwn_cam_init(struct urtwn_softc *sc)
 	uint8_t idx;
 	size_t i;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 	if (ISSET(sc->chip, URTWN_CHIP_92EU))
@@ -4020,7 +4025,7 @@ urtwn_pa_bias_init(struct urtwn_softc *s
 	uint8_t reg;
 	size_t i;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -4044,7 +4049,7 @@ static void
 urtwn_rxfilter_init(struct urtwn_softc *sc)
 {
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -4069,7 +4074,7 @@ static void
 urtwn_edca_init(struct urtwn_softc *sc)
 {
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -4094,8 +4099,8 @@ urtwn_write_txpower(struct urtwn_softc *
 {
 	uint32_t reg;
 
-	DPRINTFN(DBG_FN, ("%s: %s: chain=%d\n", device_xname(sc->sc_dev),
-	    __func__, chain));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("chain=%jd", chain, 0, 0, 0);
 
 	/* Write per-CCK rate Tx power. */
 	if (chain == 0) {
@@ -4162,8 +4167,8 @@ urtwn_get_txpower(struct urtwn_softc *sc
 	const struct rtwn_txpwr *base;
 	int ridx, group;
 
-	DPRINTFN(DBG_FN, ("%s: %s: chain=%zd, chan=%d\n",
-	    device_xname(sc->sc_dev), __func__, chain, chan));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("chain=%jd, chan=%jd", chain, chan, 0, 0);
 
 	/* Determine channel group. */
 	if (chan <= 3) {
@@ -4256,13 +4261,9 @@ urtwn_get_txpower(struct urtwn_softc *sc
 #ifdef URTWN_DEBUG
 	if (urtwn_debug & DBG_RF) {
 		/* Dump per-rate Tx power values. */
-		printf("%s: %s: Tx power for chain %zd:\n",
-		    device_xname(sc->sc_dev), __func__, chain);
-		for (ridx = 0; ridx < URTWN_RIDX_COUNT; ridx++) {
-			printf("%s: %s: Rate %d = %u\n",
-			    device_xname(sc->sc_dev), __func__, ridx,
-			    power[ridx]);
-		}
+		DPRINTFN(DBG_RF, "Tx power for chain %jd:", chain, 0, 0, 0);
+		for (ridx = 0; ridx < URTWN_RIDX_COUNT; ridx++)
+			DPRINTFN(DBG_RF, "Rate %jd = %ju", ridx, power[ridx], 0, 0);
 	}
 #endif
 }
@@ -4275,8 +4276,8 @@ urtwn_r88e_get_txpower(struct urtwn_soft
 	const struct rtwn_r88e_txpwr *base;
 	int ridx, group;
 
-	DPRINTFN(DBG_FN, ("%s: %s: chain=%zd, chan=%d\n",
-	    device_xname(sc->sc_dev), __func__, chain, chan));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("chain=%jd, chan=%jd", chain, chan, 0, 0);
 
 	/* Determine channel group. */
 	if (chan <= 2)
@@ -4342,7 +4343,7 @@ urtwn_set_txpower(struct urtwn_softc *sc
 	uint16_t power[URTWN_RIDX_COUNT];
 	size_t i;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	for (i = 0; i < sc->ntxchains; i++) {
 		/* Compute per-rate Tx power values. */
@@ -4365,8 +4366,8 @@ urtwn_set_chan(struct urtwn_softc *sc, s
 
 	chan = ieee80211_chan2ieee(ic, c);	/* XXX center freq! */
 
-	DPRINTFN(DBG_FN, ("%s: %s: chan=%d\n", device_xname(sc->sc_dev),
-	    __func__, chan));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("chan=%jd", chan, 0, 0, 0);
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -4450,8 +4451,8 @@ static void
 urtwn_iq_calib(struct urtwn_softc *sc, bool inited)
 {
 
-	DPRINTFN(DBG_FN, ("%s: %s: inited=%d\n", device_xname(sc->sc_dev),
-	    __func__, inited));
+	URTWNHIST_FUNC();
+	URTWNHIST_CALLARGS("inited=%jd", inited, 0, 0, 0);
 
 	uint32_t addaBackup[16], iqkBackup[4], piMode;
 
@@ -4601,7 +4602,7 @@ urtwn_lc_calib(struct urtwn_softc *sc)
 	uint8_t txmode;
 	size_t i;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -4647,7 +4648,7 @@ urtwn_temp_calib(struct urtwn_softc *sc)
 {
 	int temp, t_meter_reg;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	KASSERT(mutex_owned(&sc->sc_write_mtx));
 
@@ -4658,8 +4659,7 @@ urtwn_temp_calib(struct urtwn_softc *sc)
 
 	if (sc->thcal_state == 0) {
 		/* Start measuring temperature. */
-		DPRINTFN(DBG_RF, ("%s: %s: start measuring temperature\n",
-		    device_xname(sc->sc_dev), __func__));
+		DPRINTFN(DBG_RF, "start measuring temperature", 0, 0, 0, 0);
 		urtwn_rf_write(sc, 0, t_meter_reg, 0x60);
 		sc->thcal_state = 1;
 		return;
@@ -4668,8 +4668,7 @@ urtwn_temp_calib(struct urtwn_softc *sc)
 
 	/* Read measured temperature. */
 	temp = urtwn_rf_read(sc, 0, R92C_RF_T_METER) & 0x1f;
-	DPRINTFN(DBG_RF, ("%s: %s: temperature=%d\n", device_xname(sc->sc_dev),
-	    __func__, temp));
+	DPRINTFN(DBG_RF, "temperature=%jd", temp, 0, 0, 0);
 	if (temp == 0)		/* Read failed, skip. */
 		return;
 
@@ -4681,10 +4680,8 @@ urtwn_temp_calib(struct urtwn_softc *sc)
 		/* First LC calibration is performed in urtwn_init(). */
 		sc->thcal_lctemp = temp;
 	} else if (abs(temp - sc->thcal_lctemp) > 1) {
-		DPRINTFN(DBG_RF,
-		    ("%s: %s: LC calib triggered by temp: %d -> %d\n",
-		    device_xname(sc->sc_dev), __func__, sc->thcal_lctemp,
-		    temp));
+		DPRINTFN(DBG_RF, "LC calib triggered by temp: %jd -> %jd",
+		    sc->thcal_lctemp, temp, 0, 0);
 		urtwn_lc_calib(sc);
 		/* Record temperature of last LC calibration. */
 		sc->thcal_lctemp = temp;
@@ -4701,7 +4698,7 @@ urtwn_init(struct ifnet *ifp)
 	size_t i;
 	int error;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	urtwn_stop(ifp, 0);
 
@@ -4969,7 +4966,7 @@ urtwn_stop(struct ifnet *ifp, int disabl
 	size_t i;
 	int s;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	s = splusb();
 	ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
@@ -5024,7 +5021,7 @@ urtwn_chip_stop(struct urtwn_softc *sc)
 	uint32_t reg;
 	bool disabled = true;
 
-	DPRINTFN(DBG_FN, ("%s: %s\n", device_xname(sc->sc_dev), __func__));
+	URTWNHIST_FUNC(); URTWNHIST_CALLED();
 
 	if (ISSET(sc->chip, URTWN_CHIP_88E) ||
 	    ISSET(sc->chip, URTWN_CHIP_92EU))

Reply via email to