Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/dwc2 Make dwc2debug sysctl'able



details:   https://anonhg.NetBSD.org/src/rev/dfe4ce94a4d6
branches:  trunk
changeset: 967241:dfe4ce94a4d6
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Dec 03 11:25:43 2019 +0000

description:
Make dwc2debug sysctl'able

diffstat:

 sys/external/bsd/dwc2/dwc2.c |  31 +++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 2 deletions(-)

diffs (52 lines):

diff -r dcac03cd3f9e -r dfe4ce94a4d6 sys/external/bsd/dwc2/dwc2.c
--- a/sys/external/bsd/dwc2/dwc2.c      Tue Dec 03 11:25:19 2019 +0000
+++ b/sys/external/bsd/dwc2/dwc2.c      Tue Dec 03 11:25:43 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc2.c,v 1.60 2019/12/03 11:22:06 skrll Exp $  */
+/*     $NetBSD: dwc2.c,v 1.61 2019/12/03 11:25:43 skrll Exp $  */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.60 2019/12/03 11:22:06 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.61 2019/12/03 11:25:43 skrll Exp $");
 
 #include "opt_usb.h"
 
@@ -75,6 +75,33 @@
 } while (0)
 #define        DPRINTF(...)    DPRINTFN(1, __VA_ARGS__)
 int dwc2debug = 0;
+
+SYSCTL_SETUP(sysctl_hw_dwc2_setup, "sysctl hw.dwc2 setup")
+{
+       int err;
+       const struct sysctlnode *rnode;
+       const struct sysctlnode *cnode;
+
+       err = sysctl_createv(clog, 0, NULL, &rnode,
+           CTLFLAG_PERMANENT, CTLTYPE_NODE, "dwc2",
+           SYSCTL_DESCR("dwc2 global controls"),
+           NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL);
+
+       if (err)
+               goto fail;
+
+       /* control debugging printfs */
+       err = sysctl_createv(clog, 0, &rnode, &cnode,
+           CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT,
+           "debug", SYSCTL_DESCR("Enable debugging output"),
+           NULL, 0, &dwc2debug, sizeof(dwc2debug), CTL_CREATE, CTL_EOL);
+       if (err)
+               goto fail;
+
+       return;
+fail:
+       aprint_error("%s: sysctl_createv failed (err = %d)\n", __func__, err);
+}
 #else
 #define        DPRINTF(...) do { } while (0)
 #define        DPRINTFN(...) do { } while (0)



Home | Main Index | Thread Index | Old Index