Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb convert pairs of USBHIST_CALLED()+USBHIST_LOG*()...
details: https://anonhg.NetBSD.org/src/rev/633052f03097
branches: trunk
changeset: 1002927:633052f03097
user: mrg <mrg%NetBSD.org@localhost>
date: Wed Aug 21 10:48:37 2019 +0000
description:
convert pairs of USBHIST_CALLED()+USBHIST_LOG*() into
USBHIST_CALLARGS() calls. this reduces the number of
kernel history lines consumed by these callers, and
for the +LOGN versions, add useful log info to a
message that just says "called!".
reduces the line spam which means the total info in a
full log is significantly increased.
diffstat:
sys/dev/usb/uhub.c | 24 ++++----
sys/dev/usb/usb.c | 19 +++---
sys/dev/usb/usb_mem.c | 12 ++--
sys/dev/usb/usb_subr.c | 62 ++++++++++++-----------
sys/dev/usb/usbdi.c | 78 ++++++++++++++---------------
sys/dev/usb/usbdi_util.c | 124 ++++++++++++++++++++++++----------------------
sys/dev/usb/usbroothub.c | 19 +++---
7 files changed, 171 insertions(+), 167 deletions(-)
diffs (truncated from 1043 to 300 lines):
diff -r 97b4ab43a8c3 -r 633052f03097 sys/dev/usb/uhub.c
--- a/sys/dev/usb/uhub.c Wed Aug 21 10:01:53 2019 +0000
+++ b/sys/dev/usb/uhub.c Wed Aug 21 10:48:37 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhub.c,v 1.142 2019/05/05 03:17:54 mrg Exp $ */
+/* $NetBSD: uhub.c,v 1.143 2019/08/21 10:48:37 mrg Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
/* $OpenBSD: uhub.c,v 1.86 2015/06/29 18:27:40 mpi Exp $ */
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.142 2019/05/05 03:17:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.143 2019/08/21 10:48:37 mrg Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -98,8 +98,10 @@
#define DPRINTF(FMT,A,B,C,D) USBHIST_LOGN(uhubdebug,1,FMT,A,B,C,D)
#define DPRINTFN(N,FMT,A,B,C,D) USBHIST_LOGN(uhubdebug,N,FMT,A,B,C,D)
-#define UHUBHIST_FUNC() USBHIST_FUNC()
-#define UHUBHIST_CALLED(name) USBHIST_CALLED(uhubdebug)
+#define UHUBHIST_FUNC() USBHIST_FUNC()
+#define UHUBHIST_CALLED(name) USBHIST_CALLED(uhubdebug)
+#define UHUBHIST_CALLARGS(FMT,A,B,C,D) \
+ USBHIST_CALLARGS(uhubdebug,FMT,A,B,C,D)
struct uhub_softc {
device_t sc_dev; /* base device */
@@ -486,9 +488,8 @@
int port;
int change, status, reconnect;
- UHUBHIST_FUNC(); UHUBHIST_CALLED();
-
- DPRINTFN(10, "uhub%jd dev=%#jx addr=%jd speed=%ju",
+ UHUBHIST_FUNC();
+ UHUBHIST_CALLARGS("uhub%jd dev=%#jx addr=%jd speed=%ju",
device_unit(sc->sc_dev), (uintptr_t)dev, dev->ud_addr,
dev->ud_speed);
@@ -759,8 +760,8 @@
dev->ud_depth + 1, speed, port, up);
/* XXX retry a few times? */
if (err) {
- DPRINTF("usbd_new_device failed, error %jd", err, 0, 0,
- 0);
+ DPRINTF("uhub%jd: usbd_new_device failed, error %jd",
+ device_unit(sc->sc_dev), err, 0, 0);
/* Avoid addressing problems by disabling. */
/* usbd_reset_port(dev, port, &up->status); */
@@ -927,9 +928,8 @@
{
struct uhub_softc *sc = addr;
- UHUBHIST_FUNC(); UHUBHIST_CALLED();
-
- DPRINTFN(5, "uhub%jd", device_unit(sc->sc_dev), 0, 0, 0);
+ UHUBHIST_FUNC(); UHUBHIST_CALLARGS("called! uhub%jd status=%jx",
+ device_unit(sc->sc_dev), status, 0, 0);
if (status == USBD_STALLED)
usbd_clear_endpoint_stall_async(sc->sc_ipipe);
diff -r 97b4ab43a8c3 -r 633052f03097 sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Wed Aug 21 10:01:53 2019 +0000
+++ b/sys/dev/usb/usb.c Wed Aug 21 10:48:37 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.179 2019/05/05 03:17:54 mrg Exp $ */
+/* $NetBSD: usb.c,v 1.180 2019/08/21 10:48:37 mrg Exp $ */
/*
* Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.179 2019/05/05 03:17:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.180 2019/08/21 10:48:37 mrg Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -585,10 +585,11 @@
struct usb_taskq *taskq;
bool mpsafe;
- USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
+ taskq = arg;
- taskq = arg;
- DPRINTF("start taskq %#jx", (uintptr_t)taskq, 0, 0, 0);
+ USBHIST_FUNC();
+ USBHIST_CALLARGS(usbdebug, "start taskq %#jx",
+ (uintptr_t)taskq, 0, 0, 0);
mutex_enter(&taskq->lock);
for (;;) {
@@ -737,7 +738,7 @@
struct usb_softc *sc;
int unit = minor(devt);
- USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
+ USBHIST_FUNC(); USBHIST_CALLARGS(usbdebug, "cmd %#jx", cmd, 0, 0, 0);
if (unit == USB_DEV_MINOR) {
switch (cmd) {
@@ -765,7 +766,6 @@
return EIO;
int error = 0;
- DPRINTF("cmd %#jx", cmd, 0, 0, 0);
switch (cmd) {
#ifdef USB_DEBUG
case USB_SETDEBUG:
@@ -1149,9 +1149,8 @@
usb_schedsoftintr(struct usbd_bus *bus)
{
- USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
-
- DPRINTFN(10, "polling=%jd", bus->ub_usepolling, 0, 0, 0);
+ USBHIST_FUNC();
+ USBHIST_CALLARGS(usbdebug, "polling=%jd", bus->ub_usepolling, 0, 0, 0);
/* In case the bus never finished setting up. */
if (__predict_false(bus->ub_soft == NULL))
diff -r 97b4ab43a8c3 -r 633052f03097 sys/dev/usb/usb_mem.c
--- a/sys/dev/usb/usb_mem.c Wed Aug 21 10:01:53 2019 +0000
+++ b/sys/dev/usb/usb_mem.c Wed Aug 21 10:48:37 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_mem.c,v 1.70 2017/10/28 00:37:12 pgoyette Exp $ */
+/* $NetBSD: usb_mem.c,v 1.71 2019/08/21 10:48:37 mrg Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.70 2017/10/28 00:37:12 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.71 2019/08/21 10:48:37 mrg Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -115,8 +115,8 @@
usb_dma_block_t *b;
int error;
- USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
- DPRINTFN(5, "size=%ju align=%ju", size, align, 0, 0);
+ USBHIST_FUNC();
+ USBHIST_CALLARGS(usbdebug, "size=%ju align=%ju", size, align, 0, 0);
ASSERT_SLEEPABLE();
KASSERT(size != 0);
@@ -236,11 +236,11 @@
Static void
usb_block_freemem(usb_dma_block_t *b)
{
+ USBHIST_FUNC();
+ USBHIST_CALLARGS(usbdebug, "size=%ju", b->size, 0, 0, 0);
KASSERT(mutex_owned(&usb_blk_lock));
- USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
- DPRINTFN(6, "size=%ju", b->size, 0, 0, 0);
#ifdef DEBUG
LIST_REMOVE(b, next);
#endif
diff -r 97b4ab43a8c3 -r 633052f03097 sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c Wed Aug 21 10:01:53 2019 +0000
+++ b/sys/dev/usb/usb_subr.c Wed Aug 21 10:48:37 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_subr.c,v 1.237 2019/08/07 08:47:09 maxv Exp $ */
+/* $NetBSD: usb_subr.c,v 1.238 2019/08/21 10:48:37 mrg Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.237 2019/08/07 08:47:09 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.238 2019/08/21 10:48:37 mrg Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -313,7 +313,7 @@
usbd_status
usbd_reset_port(struct usbd_device *dev, int port, usb_port_status_t *ps)
{
- USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
+ USBHIST_FUNC(); USBHIST_CALLARGS(usbdebug, "port %jd", port, 0, 0, 0);
usb_device_request_t req;
usbd_status err;
int n;
@@ -356,7 +356,9 @@
usb_interface_descriptor_t *
usbd_find_idesc(usb_config_descriptor_t *cd, int ifaceidx, int altidx)
{
- USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
+ USBHIST_FUNC();
+ USBHIST_CALLARGS(usbdebug, "iface/alt idx %jd/%jd",
+ ifaceidx, altidx, 0, 0);
char *p = (char *)cd;
char *end = p + UGETW(cd->wTotalLength);
usb_descriptor_t *desc;
@@ -443,13 +445,14 @@
usbd_status
usbd_fill_iface_data(struct usbd_device *dev, int ifaceidx, int altidx)
{
- USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
+ USBHIST_FUNC();
+ USBHIST_CALLARGS(usbdebug, "ifaceidx=%jd altidx=%jd",
+ ifaceidx, altidx, 0, 0);
struct usbd_interface *ifc = &dev->ud_ifaces[ifaceidx];
usb_interface_descriptor_t *idesc;
char *p, *end;
int endpt, nendpt;
- DPRINTFN(4, "ifaceidx=%jd altidx=%jd", ifaceidx, altidx, 0, 0);
idesc = usbd_find_idesc(dev->ud_cdesc, ifaceidx, altidx);
if (idesc == NULL)
return USBD_INVAL;
@@ -542,10 +545,11 @@
Static usbd_status
usbd_set_config(struct usbd_device *dev, int conf)
{
- USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
usb_device_request_t req;
- DPRINTFN(5, "dev %#jx conf %jd", (uintptr_t)dev, conf, 0, 0);
+ USBHIST_FUNC();
+ USBHIST_CALLARGS(usbdebug, "dev %#jx conf %jd",
+ (uintptr_t)dev, conf, 0, 0);
req.bmRequestType = UT_WRITE_DEVICE;
req.bRequest = UR_SET_CONFIG;
@@ -558,7 +562,7 @@
usbd_status
usbd_set_config_no(struct usbd_device *dev, int no, int msg)
{
- USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
+ USBHIST_FUNC(); USBHIST_CALLARGS(usbdebug, "%jd", no, 0, 0, 0);
usb_config_descriptor_t cd;
usbd_status err;
int index;
@@ -566,7 +570,6 @@
if (no == USB_UNCONFIG_NO)
return usbd_set_config_index(dev, USB_UNCONFIG_INDEX, msg);
- DPRINTFN(5, "%jd", no, 0, 0, 0);
/* Figure out what config index to use. */
for (index = 0; index < dev->ud_ddesc.bNumConfigurations; index++) {
err = usbd_get_config_desc(dev, index, &cd);
@@ -581,13 +584,14 @@
usbd_status
usbd_set_config_index(struct usbd_device *dev, int index, int msg)
{
- USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
+ USBHIST_FUNC();
+ USBHIST_CALLARGS(usbdebug, "dev=%#jx index=%jd",
+ (uintptr_t)dev, index, 0, 0);
usb_config_descriptor_t cd, *cdp;
usb_bos_descriptor_t *bdp = NULL;
usbd_status err;
int i, ifcidx, nifc, len, selfpowered, power;
- DPRINTFN(5, "dev=%#jx index=%jd", (uintptr_t)dev, index, 0, 0);
if (index >= dev->ud_ddesc.bNumConfigurations &&
index != USB_UNCONFIG_INDEX) {
@@ -806,13 +810,13 @@
usbd_setup_pipe_flags(struct usbd_device *dev, struct usbd_interface *iface,
struct usbd_endpoint *ep, int ival, struct usbd_pipe **pipe, uint8_t flags)
{
- USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
+ USBHIST_FUNC();
+ USBHIST_CALLARGS(usbdebug, "dev=%#jx addr=%jd iface=%#jx ep=%#jx",
+ (uintptr_t)dev, dev->ud_addr, (uintptr_t)iface, (uintptr_t)ep);
struct usbd_pipe *p;
usbd_status err;
p = kmem_alloc(dev->ud_bus->ub_pipesize, KM_SLEEP);
- DPRINTFN(1, "dev=%#jx addr=%jd iface=%#jx ep=%#jx",
- (uintptr_t)dev, dev->ud_addr, (uintptr_t)iface, (uintptr_t)ep);
DPRINTFN(1, "pipe=%#jx", (uintptr_t)p, 0, 0, 0);
p->up_dev = dev;
p->up_iface = iface;
@@ -1044,13 +1048,13 @@
usbd_probe_and_attach(device_t parent, struct usbd_device *dev,
int port, int addr)
{
- USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
+ USBHIST_FUNC();
+ USBHIST_CALLARGS(usbdebug, "trying device specific drivers", 0, 0, 0, 0);
usb_device_descriptor_t *dd = &dev->ud_ddesc;
int confi, nifaces;
Home |
Main Index |
Thread Index |
Old Index