Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb add USBHIST_CALLARGS() frontend to KERNHIST_CALL...
details: https://anonhg.NetBSD.org/src/rev/095ab8d90dcf
branches: trunk
changeset: 453596:095ab8d90dcf
user: mrg <mrg%NetBSD.org@localhost>
date: Mon Aug 19 06:35:14 2019 +0000
description:
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.
diffstat:
sys/dev/usb/usbhist.h | 8 +++++++-
sys/dev/usb/usbnet.c | 15 ++++++++++-----
2 files changed, 17 insertions(+), 6 deletions(-)
diffs (100 lines):
diff -r 5f411846b34a -r 095ab8d90dcf sys/dev/usb/usbhist.h
--- a/sys/dev/usb/usbhist.h Mon Aug 19 05:25:38 2019 +0000
+++ b/sys/dev/usb/usbhist.h Mon Aug 19 06:35:14 2019 +0000
@@ -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 @@
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 @@
#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()
diff -r 5f411846b34a -r 095ab8d90dcf sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c Mon Aug 19 05:25:38 2019 +0000
+++ b/sys/dev/usb/usbnet.c Mon Aug 19 06:35:14 2019 +0000
@@ -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 @@
#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 @@
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 @@
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_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 @@
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_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;
}
Home |
Main Index |
Thread Index |
Old Index