Module Name: src Committed By: mrg Date: Mon Aug 19 06:35:14 UTC 2019
Modified Files: src/sys/dev/usb: usbhist.h usbnet.c Log Message: add USBHIST_CALLARGS() frontend to KERNHIST_CALLARGS(). add USBNETHIST_CALLARGS() frontend to USBHIST_CALLARGS(). use both in read/write reg, instead of aprint. use %jx and (uintptr_t) and fix the 32 bit debug build. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/usb/usbhist.h cvs rdiff -u -r1.18 -r1.19 src/sys/dev/usb/usbnet.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/usbhist.h diff -u src/sys/dev/usb/usbhist.h:1.4 src/sys/dev/usb/usbhist.h:1.5 --- src/sys/dev/usb/usbhist.h:1.4 Sat Apr 23 10:15:32 2016 +++ src/sys/dev/usb/usbhist.h Mon Aug 19 06:35:14 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: usbhist.h,v 1.4 2016/04/23 10:15:32 skrll Exp $ */ +/* $NetBSD: usbhist.h,v 1.5 2019/08/19 06:35:14 mrg Exp $ */ /* * Copyright (c) 2012 Matthew R. Green @@ -69,6 +69,11 @@ extern int usbdebug; KERNHIST_CALLED(usbhist); \ } \ } while (0) +#define USBHIST_CALLARGS(NAME,FMT,A,B,C,D) do { \ + if ((NAME) != 0) { \ + KERNHIST_CALLARGS(usbhist,FMT,A,B,C,D); \ + } \ +} while (0) #define USBHIST_FUNC() KERNHIST_FUNC(__func__) USBHIST_DECL(usbhist); @@ -83,6 +88,7 @@ USBHIST_DECL(usbhist); #define USBHIST_LOGN(N,NAME,FMT,A,B,C,D) do { } while(0) #define USBHIST_LOGM(N,NAME,FMT,A,B,C,D) do { } while(0) #define USBHIST_LOG(NAME,FMT,A,B,C,D) do { } while(0) +#define USBHIST_CALLARGS(NAME,FMT,A,B,C,D) #define USBHIST_CALLED(NAME) #define USBHIST_FUNC() Index: src/sys/dev/usb/usbnet.c diff -u src/sys/dev/usb/usbnet.c:1.18 src/sys/dev/usb/usbnet.c:1.19 --- src/sys/dev/usb/usbnet.c:1.18 Sun Aug 18 09:46:58 2019 +++ src/sys/dev/usb/usbnet.c Mon Aug 19 06:35:14 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: usbnet.c,v 1.18 2019/08/18 09:46:58 mrg Exp $ */ +/* $NetBSD: usbnet.c,v 1.19 2019/08/19 06:35:14 mrg Exp $ */ /* * Copyright (c) 2019 Matthew R. Green @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.18 2019/08/18 09:46:58 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.19 2019/08/19 06:35:14 mrg Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -134,6 +134,8 @@ fail: #define DPRINTFN(N,FMT,A,B,C,D) USBHIST_LOGN(usbnetdebug,N,FMT,A,B,C,D) #define USBNETHIST_FUNC() USBHIST_FUNC() #define USBNETHIST_CALLED(name) USBHIST_CALLED(usbnetdebug) +#define USBNETHIST_CALLARGS(FMT,A,B,C,D) \ + USBHIST_CALLARGS(usbnetdebug,FMT,A,B,C,D) /* Callback vectors. */ @@ -274,7 +276,8 @@ usbnet_input(struct usbnet * const un, u struct mbuf *m; usbnet_isowned_rx(un); - DPRINTFN(0, "called! un %p buf %p len %ju", un, buf, buflen, 0); + DPRINTFN(0, "called! un %jx buf %jx len %ju", + (uintmax_t)un, (uintmax_t)buf, buflen, 0); m = usbnet_newbuf(buflen); if (m == NULL) { @@ -860,6 +863,7 @@ usbnet_mutex_mii(struct usbnet *un) int usbnet_mii_readreg(device_t dev, int phy, int reg, uint16_t *val) { + USBNETHIST_FUNC(); struct usbnet * const un = device_private(dev); struct usbnet_private * const unp = un->un_pri; usbd_status err; @@ -876,7 +880,7 @@ usbnet_mii_readreg(device_t dev, int phy usbnet_unlock_mii(un); if (err) { - aprint_error_dev(un->un_dev, "read PHY failed: %d\n", err); + USBNETHIST_CALLARGS("read PHY failed: %d", err, 0, 0, 0); return EIO; } @@ -886,6 +890,7 @@ usbnet_mii_readreg(device_t dev, int phy int usbnet_mii_writereg(device_t dev, int phy, int reg, uint16_t val) { + USBNETHIST_FUNC(); struct usbnet * const un = device_private(dev); struct usbnet_private * const unp = un->un_pri; usbd_status err; @@ -902,7 +907,7 @@ usbnet_mii_writereg(device_t dev, int ph usbnet_unlock_mii(un); if (err) { - aprint_error_dev(un->un_dev, "write PHY failed: %d\n", err); + USBNETHIST_CALLARGS("write PHY failed: %d", err, 0, 0, 0); return EIO; }