CVS commit: src/sys/dev/pad
Module Name:src Committed By: riastradh Date: Mon Jun 14 00:21:09 UTC 2021 Modified Files: src/sys/dev/pad: pad.c Log Message: pad(4): Some incomplete tidying. - Put pseudo-device softc setup/teardown back in pad_attach/detach, not in the cdev/fops operations which are about file descriptors. - Remove unnecessary sc_dying flag. - Omit needless config_deactivate(sc->sc_audiodev); the only effect of this is already done by config_detach anyway, which is done in the same context. - Issue config_detach_children and free softc stuff in the right order. - Omit needless `if (sc == NULL) return ENXIO'. Survives eight parallel t_mixerctl tests many times over on an 8-thread/4-core machine. XXX TODO: - Remove padconfig; it is not appropriate to hold a mutex over sleeping allocation or autoconf config_attach operations. This should be done another way. - Fix agreement of sc_condvar with locks: is it sc_cond_lock or sc_intr_lock? Can't be both; unclear why both exist. - Determine whether both cdev and fops are really needed -- it is confusing to have two types of paths into all this logic, and it seems to me only one of them should be necessary. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/dev/pad/pad.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/pad/pad.c diff -u src/sys/dev/pad/pad.c:1.67 src/sys/dev/pad/pad.c:1.68 --- src/sys/dev/pad/pad.c:1.67 Sun Jun 13 23:09:22 2021 +++ src/sys/dev/pad/pad.c Mon Jun 14 00:21:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pad.c,v 1.67 2021/06/13 23:09:22 riastradh Exp $ */ +/* $NetBSD: pad.c,v 1.68 2021/06/14 00:21:09 riastradh Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.67 2021/06/13 23:09:22 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.68 2021/06/14 00:21:09 riastradh Exp $"); #include #include @@ -218,21 +218,50 @@ pad_match(device_t parent, cfdata_t data static void pad_attach(device_t parent, device_t self, void *opaque) { + struct pad_softc *sc = device_private(self); aprint_normal_dev(self, "outputs: 44100Hz, 16-bit, stereo\n"); + + sc->sc_dev = self; + sc->sc_dying = false; + + cv_init(>sc_condvar, device_xname(sc->sc_dev)); + mutex_init(>sc_cond_lock, MUTEX_DEFAULT, IPL_NONE); + mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE); + mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_NONE); + callout_init(>sc_pcallout, 0/*XXX?*/); + + sc->sc_swvol = 255; + sc->sc_buflen = 0; + sc->sc_rpos = sc->sc_wpos = 0; + sc->sc_audiodev = audio_attach_mi(_hw_if, sc, sc->sc_dev); + + if (!pmf_device_register(sc->sc_dev, NULL, NULL)) + aprint_error_dev(sc->sc_dev, + "couldn't establish power handler\n"); } static int pad_detach(device_t self, int flags) { - struct pad_softc *sc; + struct pad_softc *sc = device_private(self); int cmaj, mn; + int error; + + error = config_detach_children(self, flags); + if (error) + return error; - sc = device_private(self); cmaj = cdevsw_lookup_major(_cdevsw); mn = device_unit(sc->sc_dev); - if (!sc->sc_dying) - vdevgone(cmaj, mn, mn, VCHR); + vdevgone(cmaj, mn, mn, VCHR); + + pmf_device_deregister(sc->sc_dev); + + mutex_destroy(>sc_cond_lock); + mutex_destroy(>sc_lock); + mutex_destroy(>sc_intr_lock); + cv_destroy(>sc_condvar); return 0; } @@ -242,7 +271,8 @@ pad_childdet(device_t self, device_t chi { struct pad_softc *sc = device_private(self); - sc->sc_audiodev = NULL; + if (child == sc->sc_audiodev) + sc->sc_audiodev = NULL; } static int @@ -340,40 +370,17 @@ cdev_pad_open(dev_t dev, int flags, int return EBUSY; } - sc->sc_dev = paddev; - sc->sc_dying = false; - if (PADUNIT(dev) == PADCLONER) { error = fd_allocfile(, ); if (error) { if (existing == false) -config_detach(sc->sc_dev, 0); +config_detach(paddev, 0); mutex_exit(); return error; } - } - - cv_init(>sc_condvar, device_xname(sc->sc_dev)); - mutex_init(>sc_cond_lock, MUTEX_DEFAULT, IPL_NONE); - mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE); - mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_NONE); - callout_init(>sc_pcallout, 0/*XXX?*/); - - sc->sc_swvol = 255; - sc->sc_buflen = 0; - sc->sc_rpos = sc->sc_wpos = 0; - KERNEL_LOCK(1, NULL); - sc->sc_audiodev = audio_attach_mi(_hw_if, sc, sc->sc_dev); - KERNEL_UNLOCK_ONE(NULL); - - if (!pmf_device_register(sc->sc_dev, NULL, NULL)) - aprint_error_dev(sc->sc_dev, - "couldn't establish power handler\n"); - - if (PADUNIT(dev) == PADCLONER) { error = fd_clone(fp, fd, flags, _fileops, sc); KASSERT(error == EMOVEFD); - } + } sc->sc_open = 1; mutex_exit(); @@ -386,65 +393,42 @@ bad: static int pad_close(struct pad_softc *sc) { - int rc; - - if (sc == NULL) - return ENXIO; - - mutex_enter(); - config_deactivate(sc->sc_audiodev); - - /* Start draining existing accessors of the device. */ - if
CVS commit: src/sys/dev/pad
Module Name:src Committed By: riastradh Date: Sun Jun 13 23:09:23 UTC 2021 Modified Files: src/sys/dev/pad: pad.c Log Message: pad(4): Take kernel lock around autoconf stuff. This is not really enough -- the padconfig locking logic violates rules about sleeping while holding locks, might be deadlocky, and may also be racy. But, it'll serve to make progress. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/dev/pad/pad.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/pad/pad.c diff -u src/sys/dev/pad/pad.c:1.66 src/sys/dev/pad/pad.c:1.67 --- src/sys/dev/pad/pad.c:1.66 Tue Jun 8 09:09:28 2021 +++ src/sys/dev/pad/pad.c Sun Jun 13 23:09:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pad.c,v 1.66 2021/06/08 09:09:28 nia Exp $ */ +/* $NetBSD: pad.c,v 1.67 2021/06/13 23:09:22 riastradh Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.66 2021/06/08 09:09:28 nia Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.67 2021/06/13 23:09:22 riastradh Exp $"); #include #include @@ -362,7 +362,9 @@ cdev_pad_open(dev_t dev, int flags, int sc->sc_swvol = 255; sc->sc_buflen = 0; sc->sc_rpos = sc->sc_wpos = 0; + KERNEL_LOCK(1, NULL); sc->sc_audiodev = audio_attach_mi(_hw_if, sc, sc->sc_dev); + KERNEL_UNLOCK_ONE(NULL); if (!pmf_device_register(sc->sc_dev, NULL, NULL)) aprint_error_dev(sc->sc_dev,
CVS commit: src/tests/lib/libcurses/slave
Module Name:src Committed By: rillig Date: Sun Jun 13 21:54:52 UTC 2021 Modified Files: src/tests/lib/libcurses/slave: curses_commands.c Log Message: tests/libcurses: fix argument handling for mvwget_wch There's currently no test for that function, therefore no functional change. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/tests/lib/libcurses/slave/curses_commands.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/slave/curses_commands.c diff -u src/tests/lib/libcurses/slave/curses_commands.c:1.28 src/tests/lib/libcurses/slave/curses_commands.c:1.29 --- src/tests/lib/libcurses/slave/curses_commands.c:1.28 Sun Jun 13 19:17:53 2021 +++ src/tests/lib/libcurses/slave/curses_commands.c Sun Jun 13 21:54:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: curses_commands.c,v 1.28 2021/06/13 19:17:53 rillig Exp $ */ +/* $NetBSD: curses_commands.c,v 1.29 2021/06/13 21:54:51 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -4084,7 +4084,7 @@ cmd_mvwget_wch(int nargs, char **args) { wchar_t ch; - ARGC(1); /* FIXME: 3 */ + ARGC(3); ARG_WINDOW(win); ARG_INT(y); ARG_INT(x);
CVS commit: src/tests/lib/libcurses/slave
Module Name:src Committed By: rillig Date: Sun Jun 13 19:50:18 UTC 2021 Modified Files: src/tests/lib/libcurses/slave: lint.lua Log Message: tests/libcurses: make error handling in the linter simpler To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libcurses/slave/lint.lua Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/slave/lint.lua diff -u src/tests/lib/libcurses/slave/lint.lua:1.5 src/tests/lib/libcurses/slave/lint.lua:1.6 --- src/tests/lib/libcurses/slave/lint.lua:1.5 Sun Jun 13 19:41:12 2021 +++ src/tests/lib/libcurses/slave/lint.lua Sun Jun 13 19:50:18 2021 @@ -1,5 +1,5 @@ #! /usr/bin/lua --- $NetBSD: lint.lua,v 1.5 2021/06/13 19:41:12 rillig Exp $ +-- $NetBSD: lint.lua,v 1.6 2021/06/13 19:50:18 rillig Exp $ --[[ @@ -24,18 +24,10 @@ local function load_lines(fname) return lines end - -local function new_errors() - local errors = {} - errors.add = function(self, fmt, ...) -table.insert(self, string.format(fmt, ...)) - end - errors.print = function(self) -for _, msg in ipairs(self) do - print(msg) -end - end - return errors +local had_errors = false +local function print_error(fmt, ...) + print(fmt:format(...)) + had_errors = true end @@ -46,7 +38,7 @@ end -- After each macro ARGC, there must be the corresponding macros for ARG. -local function check_args(errors) +local function check_args() local fname = "curses_commands.c" local lines = load_lines(fname) local curr_argc, curr_arg ---@type number|nil, number|nil @@ -66,9 +58,9 @@ local function check_args(errors) curr_argc, curr_arg = nil, nil end elseif line_arg then - errors:add("%s:%d: ARG without preceding ARGC", fname, lineno) + print_error("%s:%d: ARG without preceding ARGC", fname, lineno) elseif curr_arg then - errors:add("%s:%d: expecting ARG %d, got %s", + print_error("%s:%d: expecting ARG %d, got %s", fname, lineno, curr_arg, line) curr_argc, curr_arg = nil, nil end @@ -77,13 +69,5 @@ local function check_args(errors) end end - -local function main(arg) - local errors = new_errors() - check_args(errors) - errors:print() - return #errors == 0 -end - - -os.exit(main(arg)) +check_args() +os.exit(not had_errors)
CVS commit: src/tests/lib/libcurses/slave
Module Name:src Committed By: rillig Date: Sun Jun 13 19:41:12 UTC 2021 Modified Files: src/tests/lib/libcurses/slave: lint.lua Log Message: tests/libcurses: improve code locality in linter No functional change. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libcurses/slave/lint.lua Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/slave/lint.lua diff -u src/tests/lib/libcurses/slave/lint.lua:1.4 src/tests/lib/libcurses/slave/lint.lua:1.5 --- src/tests/lib/libcurses/slave/lint.lua:1.4 Sun Jun 13 19:25:08 2021 +++ src/tests/lib/libcurses/slave/lint.lua Sun Jun 13 19:41:12 2021 @@ -1,5 +1,5 @@ #! /usr/bin/lua --- $NetBSD: lint.lua,v 1.4 2021/06/13 19:25:08 rillig Exp $ +-- $NetBSD: lint.lua,v 1.5 2021/06/13 19:41:12 rillig Exp $ --[[ @@ -53,29 +53,27 @@ local function check_args(errors) for lineno, line in ipairs(lines) do -local line_argc = num(line:match("^\tARGC%((%d)")) -local line_arg = line:match("^\tARG_[%w_]+%(") - +local line_argc = num(line:match("^\tARGC%((%d+)")) if line_argc and line_argc > 0 then curr_argc, curr_arg = line_argc, 0 + goto next end -if line_arg and not curr_arg then - errors:add("%s:%d: ARG without preceding ARGC", fname, lineno) -end - -if not line_arg and curr_arg and not line_argc then - errors:add("%s:%d: expecting ARG %d, got %s", -fname, lineno, curr_arg, line) - curr_argc, curr_arg = nil, nil -end - +local line_arg = line:match("^\tARG_[%w_]+%(") if line_arg and curr_arg then curr_arg = curr_arg + 1 if curr_arg == curr_argc then curr_argc, curr_arg = nil, nil end +elseif line_arg then + errors:add("%s:%d: ARG without preceding ARGC", fname, lineno) +elseif curr_arg then + errors:add("%s:%d: expecting ARG %d, got %s", +fname, lineno, curr_arg, line) + curr_argc, curr_arg = nil, nil end + +::next:: end end
CVS commit: src/tests/lib/libcurses/slave
Module Name:src Committed By: rillig Date: Sun Jun 13 19:25:08 UTC 2021 Modified Files: src/tests/lib/libcurses/slave: lint.lua Log Message: tests/libcurses: improve local variable names in linter To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libcurses/slave/lint.lua Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/slave/lint.lua diff -u src/tests/lib/libcurses/slave/lint.lua:1.3 src/tests/lib/libcurses/slave/lint.lua:1.4 --- src/tests/lib/libcurses/slave/lint.lua:1.3 Sun Jun 13 18:11:44 2021 +++ src/tests/lib/libcurses/slave/lint.lua Sun Jun 13 19:25:08 2021 @@ -1,11 +1,11 @@ #! /usr/bin/lua --- $NetBSD: lint.lua,v 1.3 2021/06/13 18:11:44 rillig Exp $ +-- $NetBSD: lint.lua,v 1.4 2021/06/13 19:25:08 rillig Exp $ --[[ usage: lua ./lint.lua -Check that the boilerplate code does not contain unintended +Check that the argument handling code does not contain unintended inconsistencies. ]] @@ -49,29 +49,31 @@ end local function check_args(errors) local fname = "curses_commands.c" local lines = load_lines(fname) - local argi, argc + local curr_argc, curr_arg ---@type number|nil, number|nil for lineno, line in ipairs(lines) do -local c = num(line:match("^\tARGC%((%d)")) -if c and c > 0 then - argc, argi = c, 0 +local line_argc = num(line:match("^\tARGC%((%d)")) +local line_arg = line:match("^\tARG_[%w_]+%(") + +if line_argc and line_argc > 0 then + curr_argc, curr_arg = line_argc, 0 end -local arg = line:match("^\tARG_[%w_]+%(") -if arg and not argi then +if line_arg and not curr_arg then errors:add("%s:%d: ARG without preceding ARGC", fname, lineno) end -if not arg and argi and not c then - errors:add("%s:%d: expecting ARG %d, got %s", fname, lineno, argi, line) - argc, argi = nil, nil +if not line_arg and curr_arg and not line_argc then + errors:add("%s:%d: expecting ARG %d, got %s", +fname, lineno, curr_arg, line) + curr_argc, curr_arg = nil, nil end -if arg and argi then - argi = argi + 1 - if argi == argc then -argc, argi = nil, nil +if line_arg and curr_arg then + curr_arg = curr_arg + 1 + if curr_arg == curr_argc then +curr_argc, curr_arg = nil, nil end end end
CVS commit: src/tests/lib/libcurses/slave
Module Name:src Committed By: rillig Date: Sun Jun 13 19:17:53 UTC 2021 Modified Files: src/tests/lib/libcurses/slave: curses_commands.c curses_commands.h Log Message: tests/libcurses: unexport argument handling functions No functional change. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/tests/lib/libcurses/slave/curses_commands.c cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libcurses/slave/curses_commands.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/slave/curses_commands.c diff -u src/tests/lib/libcurses/slave/curses_commands.c:1.27 src/tests/lib/libcurses/slave/curses_commands.c:1.28 --- src/tests/lib/libcurses/slave/curses_commands.c:1.27 Sun Jun 13 19:13:20 2021 +++ src/tests/lib/libcurses/slave/curses_commands.c Sun Jun 13 19:17:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: curses_commands.c,v 1.27 2021/06/13 19:13:20 rillig Exp $ */ +/* $NetBSD: curses_commands.c,v 1.28 2021/06/13 19:17:53 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -38,8 +38,8 @@ #include "slave.h" #include "curses_commands.h" -int -set_int(char *arg, int *x) +static int +set_int(const char *arg, int *x) { if (sscanf(arg, "%d", x) == 0) { report_count(1); @@ -50,8 +50,8 @@ set_int(char *arg, int *x) return 0; } -int -set_uint(char *arg, unsigned int *x) +static int +set_uint(const char *arg, unsigned int *x) { if (sscanf(arg, "%u", x) == 0) { report_count(1); @@ -62,8 +62,8 @@ set_uint(char *arg, unsigned int *x) return 0; } -int -set_short(char *arg, short *x) +static int +set_short(const char *arg, short *x) { if (sscanf(arg, "%hd", x) == 0) { report_count(1); @@ -74,8 +74,8 @@ set_short(char *arg, short *x) return 0; } -int -set_win(char *arg, WINDOW **x) +static int +set_win(const char *arg, WINDOW **x) { if (sscanf(arg, "%p", x) == 0) { report_count(1); @@ -86,8 +86,8 @@ set_win(char *arg, WINDOW **x) return 0; } -int -set_scrn(char *arg, SCREEN **x) +static int +set_scrn(const char *arg, SCREEN **x) { if (sscanf(arg, "%p", x) == 0) { report_count(1); Index: src/tests/lib/libcurses/slave/curses_commands.h diff -u src/tests/lib/libcurses/slave/curses_commands.h:1.7 src/tests/lib/libcurses/slave/curses_commands.h:1.8 --- src/tests/lib/libcurses/slave/curses_commands.h:1.7 Sat Feb 13 08:14:46 2021 +++ src/tests/lib/libcurses/slave/curses_commands.h Sun Jun 13 19:17:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: curses_commands.h,v 1.7 2021/02/13 08:14:46 rillig Exp $ */ +/* $NetBSD: curses_commands.h,v 1.8 2021/06/13 19:17:53 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -36,12 +36,6 @@ struct command_def { void (*func)(int, char **); }; -int set_int(char *, int *); -int set_uint(char *, unsigned int *); -int set_short(char *, short *); -int set_win(char *, WINDOW **); -int set_scrn(char *, SCREEN **); - /* * prototypes for test commands */
CVS commit: src/tests/lib/libcurses/slave
Module Name:src Committed By: rillig Date: Sun Jun 13 19:13:20 UTC 2021 Modified Files: src/tests/lib/libcurses/slave: curses_commands.c Log Message: tests/libcurses: KNF for while loop To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/tests/lib/libcurses/slave/curses_commands.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/slave/curses_commands.c diff -u src/tests/lib/libcurses/slave/curses_commands.c:1.26 src/tests/lib/libcurses/slave/curses_commands.c:1.27 --- src/tests/lib/libcurses/slave/curses_commands.c:1.26 Sun Jun 13 18:11:44 2021 +++ src/tests/lib/libcurses/slave/curses_commands.c Sun Jun 13 19:13:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: curses_commands.c,v 1.26 2021/06/13 18:11:44 rillig Exp $ */ +/* $NetBSD: curses_commands.c,v 1.27 2021/06/13 19:13:20 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -165,7 +165,9 @@ cmd_DRAIN(int nargs, char **args) ARGC(1); ARG_WINDOW(win); - while (wgetch(win) != ERR); + while (wgetch(win) != ERR) + continue; + report_count(1); report_return(OK); }
CVS commit: src/tests/lib/libcurses/slave
Module Name:src Committed By: rillig Date: Sun Jun 13 18:11:44 UTC 2021 Modified Files: src/tests/lib/libcurses/slave: curses_commands.c lint.lua Log Message: tests/libcurses: remove redundant argument numbers Since all arguments are processed in increasing order, there is no need to add the redundant argument numbers. Most of the curses functions have less than 5 arguments, which makes it easy enough to count the ARG macros. Changes to curses_commands.c: * replace ^(\tARG_\w+\()\d(?:, |) with $1 * replace (define ARG_\w+\()i,\s with $1 * replace args\[i\] with *args++ * replace \(i\) with () * replace \(void\)0 with args++ The wrong argument count in cmd_mvwget_wch is still detected by lint.lua, as it was before. There is no test yet that covers this function. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/tests/lib/libcurses/slave/curses_commands.c cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libcurses/slave/lint.lua Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/slave/curses_commands.c diff -u src/tests/lib/libcurses/slave/curses_commands.c:1.25 src/tests/lib/libcurses/slave/curses_commands.c:1.26 --- src/tests/lib/libcurses/slave/curses_commands.c:1.25 Sun Apr 4 09:49:13 2021 +++ src/tests/lib/libcurses/slave/curses_commands.c Sun Jun 13 18:11:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: curses_commands.c,v 1.25 2021/04/04 09:49:13 rin Exp $ */ +/* $NetBSD: curses_commands.c,v 1.26 2021/06/13 18:11:44 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -102,68 +102,68 @@ set_scrn(char *arg, SCREEN **x) if (check_arg_count(nargs, n) == 1)\ return -#define ARG_SHORT(i, arg) \ +#define ARG_SHORT(arg) \ short arg; \ - if (set_short(args[i], ) != 0)\ + if (set_short(*args++, ) != 0)\ return -#define ARG_INT(i, arg) \ +#define ARG_INT(arg) \ int arg; \ - if (set_int(args[i], ) != 0)\ + if (set_int(*args++, ) != 0)\ return -#define ARG_UINT(i, arg) \ +#define ARG_UINT(arg) \ unsigned int arg; \ - if (set_uint(args[i], ) != 0)\ + if (set_uint(*args++, ) != 0)\ return -#define ARG_CHTYPE(i, arg) \ - chtype arg = ((const chtype *)args[i])[0] +#define ARG_CHTYPE(arg) \ + chtype arg = ((const chtype *)*args++)[0] -#define ARG_WCHAR(i, arg) \ - wchar_t arg = ((const wchar_t *)args[i])[0] +#define ARG_WCHAR(arg) \ + wchar_t arg = ((const wchar_t *)*args++)[0] -#define ARG_STRING(i, arg) \ - const char *arg = args[i] +#define ARG_STRING(arg) \ + const char *arg = *args++ /* Only used for legacy interfaces that are missing the 'const'. */ -#define ARG_MODIFIABLE_STRING(i, arg) \ - char *arg = args[i] +#define ARG_MODIFIABLE_STRING(arg) \ + char *arg = *args++ -#define ARG_CHTYPE_STRING(i, arg) \ - const chtype *arg = (const chtype *)args[i] +#define ARG_CHTYPE_STRING(arg) \ + const chtype *arg = (const chtype *)*args++ -#define ARG_CCHAR_STRING(i, arg) \ - const cchar_t *arg = (const cchar_t *)args[i] +#define ARG_CCHAR_STRING(arg) \ + const cchar_t *arg = (const cchar_t *)*args++ -#define ARG_WCHAR_STRING(i, arg) \ - wchar_t *arg = (wchar_t *)args[i] +#define ARG_WCHAR_STRING(arg) \ + wchar_t *arg = (wchar_t *)*args++ -#define ARG_WINDOW(i, arg) \ +#define ARG_WINDOW(arg) \ WINDOW *arg; \ - if (set_win(args[i], ) != 0)\ + if (set_win(*args++, ) != 0)\ return -#define ARG_SCREEN(i, arg) \ +#define ARG_SCREEN(arg) \ SCREEN *arg; \ - if (set_scrn(args[i], ) != 0)\ + if (set_scrn(*args++, ) != 0)\ return /* * Required by the API, intended for future extensions, but this * implementation does not support the extension. */ -#define ARG_NULL(i) \ - (void)0 +#define ARG_NULL() \ + args++ -#define ARG_IGNORE(i) \ - (void)0 +#define ARG_IGNORE() \ + args++ void cmd_DRAIN(int nargs, char **args) { ARGC(1); - ARG_WINDOW(0, win); + ARG_WINDOW(win); while (wgetch(win) != ERR); report_count(1); @@ -174,8 +174,8 @@ void cmd_addbytes(int nargs, char **args) { ARGC(2); - ARG_STRING(0, str); - ARG_INT(1, count); + ARG_STRING(str); + ARG_INT(count); report_count(1); report_return(addbytes(str, count)); @@ -186,7 +186,7 @@ void cmd_addch(int nargs, char **args) { ARGC(1); - ARG_CHTYPE(0, ch); + ARG_CHTYPE(ch); report_count(1); report_return(addch(ch)); @@ -197,8 +197,8 @@ void cmd_addchnstr(int nargs, char **args) { ARGC(2); - ARG_CHTYPE_STRING(0, chstr); - ARG_INT(1, count); + ARG_CHTYPE_STRING(chstr); + ARG_INT(count); report_count(1); report_return(addchnstr(chstr, count)); @@ -209,7 +209,7 @@ void cmd_addchstr(int nargs, char **args) { ARGC(1); - ARG_CHTYPE_STRING(0, chstr); + ARG_CHTYPE_STRING(chstr); report_count(1); report_return(addchstr(chstr)); @@ -220,8 +220,8 @@ void cmd_addnstr(int nargs, char **args) { ARGC(2); - ARG_STRING(0, str); - ARG_INT(1, count); + ARG_STRING(str); +
CVS commit: src/sys/arch/sparc64/doc
Module Name:src Committed By: palle Date: Sun Jun 13 17:02:14 UTC 2021 Modified Files: src/sys/arch/sparc64/doc: TODO Log Message: sun4v: update TODO file with current sun4v state To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/arch/sparc64/doc/TODO Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc64/doc/TODO diff -u src/sys/arch/sparc64/doc/TODO:1.41 src/sys/arch/sparc64/doc/TODO:1.42 --- src/sys/arch/sparc64/doc/TODO:1.41 Sat Apr 3 17:02:31 2021 +++ src/sys/arch/sparc64/doc/TODO Sun Jun 13 17:02:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: TODO,v 1.41 2021/04/03 17:02:31 palle Exp $ */ +/* $NetBSD: TODO,v 1.42 2021/06/13 17:02:14 palle Exp $ */ Things to be done: @@ -17,7 +17,12 @@ sun4v: - ldom virtual network interface (vnet) is working (verified by exiting sysinst and issuing a ping command) - the sysinst tool starts, disk setup is working, - but the process crashes when selecting network installation method (trap 0x34 ALIGN is received) + but the process crashes when selecting network installation method. + The %i,%l and %o registers are corrupted, after a call to the libcurses + wrefresh() function. + If the sysinst insallation source is local directory, an error in the + ldsk device driver is triggered when a DATA/NACK/DRING_DATA event is received. + The current implementation does not hande this exception properly. T2000 ldom with 8 VCPU and 4GB: - crashes in /sbin/init doing an access() call where %o0 is corrupted (zero) S7 ldom with 8 VCPU and 16GB (primary ldom is Solaris 11.4 SRU30):
CVS commit: src/sys/sys
Module Name:src Committed By: martin Date: Sun Jun 13 15:11:20 UTC 2021 Modified Files: src/sys/sys: param.h Log Message: Fix the last bump - now for real: welcome to 9.99.85 To generate a diff of this commit: cvs rdiff -u -r1.695 -r1.696 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/param.h diff -u src/sys/sys/param.h:1.695 src/sys/sys/param.h:1.696 --- src/sys/sys/param.h:1.695 Sun Jun 13 03:07:57 2021 +++ src/sys/sys/param.h Sun Jun 13 15:11:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.695 2021/06/13 03:07:57 christos Exp $ */ +/* $NetBSD: param.h,v 1.696 2021/06/13 15:11:20 martin Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -67,7 +67,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 999008500 /* NetBSD 9.99.84 */ +#define __NetBSD_Version__ 999008500 /* NetBSD 9.99.85 */ #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \ (m) * 100) + (p) * 100) <= __NetBSD_Version__)
CVS commit: src/sys/kern
Module Name:src Committed By: simonb Date: Sun Jun 13 14:58:50 UTC 2021 Modified Files: src/sys/kern: subr_hash.c Log Message: Return ENOENT if the hashstat sysctl was called to query a specific hash name and that hash name doesn't exist. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/kern/subr_hash.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/kern/subr_hash.c diff -u src/sys/kern/subr_hash.c:1.11 src/sys/kern/subr_hash.c:1.12 --- src/sys/kern/subr_hash.c:1.11 Sun Jun 13 14:02:46 2021 +++ src/sys/kern/subr_hash.c Sun Jun 13 14:58:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_hash.c,v 1.11 2021/06/13 14:02:46 christos Exp $ */ +/* $NetBSD: subr_hash.c,v 1.12 2021/06/13 14:58:49 simonb Exp $ */ /* * Copyright (c) 1982, 1986, 1991, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.11 2021/06/13 14:02:46 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.12 2021/06/13 14:58:49 simonb Exp $"); #include #include @@ -243,6 +243,9 @@ hashstat_sysctl(SYSCTLFN_ARGS) rw_exit(_lock); sysctl_relock(); + if (query && written == 0) /* query not found? */ + error = ENOENT; + *oldlenp = written; return error; }
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sun Jun 13 14:48:10 UTC 2021 Modified Files: src/sys/dev/usb: uhub.c usb.c usb_subr.c usbdi.h Log Message: usb(4): Bus exploration is single-threaded -- assert it so. New usb_in_event_thread(dev) returns true if dev is a USB device -- that is, a device with a usbN ancestor -- and the current thread is the USB event thread. (Kinda kludgey to pass around the device_t instead of, say, struct usbd_bus, but I don't see a good way to get to the usbN device_t or struct usb_softc from there.) To generate a diff of this commit: cvs rdiff -u -r1.152 -r1.153 src/sys/dev/usb/uhub.c cvs rdiff -u -r1.195 -r1.196 src/sys/dev/usb/usb.c cvs rdiff -u -r1.264 -r1.265 src/sys/dev/usb/usb_subr.c cvs rdiff -u -r1.102 -r1.103 src/sys/dev/usb/usbdi.h 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/uhub.c diff -u src/sys/dev/usb/uhub.c:1.152 src/sys/dev/usb/uhub.c:1.153 --- src/sys/dev/usb/uhub.c:1.152 Sun Jun 13 14:46:07 2021 +++ src/sys/dev/usb/uhub.c Sun Jun 13 14:48:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: uhub.c,v 1.152 2021/06/13 14:46:07 riastradh Exp $ */ +/* $NetBSD: uhub.c,v 1.153 2021/06/13 14:48:10 riastradh 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 -__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.152 2021/06/13 14:46:07 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.153 2021/06/13 14:48:10 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -269,10 +269,12 @@ uhub_attach(device_t parent, device_t se usb_endpoint_descriptor_t *ed; struct usbd_tt *tts = NULL; - config_pending_incr(self); - UHUBHIST_FUNC(); UHUBHIST_CALLED(); + KASSERT(usb_in_event_thread(parent)); + + config_pending_incr(self); + sc->sc_dev = self; sc->sc_hub = dev; sc->sc_proto = uaa->uaa_proto; @@ -498,7 +500,7 @@ uhub_explore(struct usbd_device *dev) device_unit(sc->sc_dev), (uintptr_t)dev, dev->ud_addr, dev->ud_speed); - KASSERT(KERNEL_LOCKED_P()); + KASSERT(usb_in_event_thread(sc->sc_dev)); if (!sc->sc_running) return USBD_NOT_STARTED; Index: src/sys/dev/usb/usb.c diff -u src/sys/dev/usb/usb.c:1.195 src/sys/dev/usb/usb.c:1.196 --- src/sys/dev/usb/usb.c:1.195 Sat Jun 12 12:13:10 2021 +++ src/sys/dev/usb/usb.c Sun Jun 13 14:48:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: usb.c,v 1.195 2021/06/12 12:13:10 riastradh Exp $ */ +/* $NetBSD: usb.c,v 1.196 2021/06/13 14:48:10 riastradh Exp $ */ /* * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.195 2021/06/12 12:13:10 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.196 2021/06/13 14:48:10 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -142,6 +142,7 @@ struct usb_softc { struct usbd_port sc_port; /* dummy port for root hub */ struct lwp *sc_event_thread; + struct lwp *sc_attach_thread; char sc_dying; bool sc_pmf_registered; @@ -483,8 +484,10 @@ usb_doattach(device_t self) ue->u.ue_ctrlr.ue_bus = device_unit(self); usb_add_event(USB_EVENT_CTRLR_ATTACH, ue); + sc->sc_attach_thread = curlwp; err = usbd_new_device(self, sc->sc_bus, 0, speed, 0, >sc_port); + sc->sc_attach_thread = NULL; if (!err) { dev = sc->sc_port.up_dev; if (dev->ud_hub == NULL) { @@ -529,6 +532,25 @@ usb_create_event_thread(device_t self) } } +bool +usb_in_event_thread(device_t dev) +{ + struct usb_softc *sc; + + if (cold) + return true; + + for (; dev; dev = device_parent(dev)) { + if (device_is_a(dev, "usb")) + break; + } + if (dev == NULL) + return false; + sc = device_private(dev); + + return curlwp == sc->sc_event_thread || curlwp == sc->sc_attach_thread; +} + /* * Add a task to be performed by the task thread. This function can be * called from any context and the task will be executed in a process Index: src/sys/dev/usb/usb_subr.c diff -u src/sys/dev/usb/usb_subr.c:1.264 src/sys/dev/usb/usb_subr.c:1.265 --- src/sys/dev/usb/usb_subr.c:1.264 Sun Jun 13 09:12:24 2021 +++ src/sys/dev/usb/usb_subr.c Sun Jun 13 14:48:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.264 2021/06/13 09:12:24 mlelstv Exp $ */ +/* $NetBSD: usb_subr.c,v 1.265 2021/06/13 14:48:10 riastradh 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 -__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.264 2021/06/13 09:12:24 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.265 2021/06/13 14:48:10 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1097,6 +1097,8 @@ usbd_attachwholedevice(device_t parent, device_t dv; int dlocs[USBDEVIFCF_NLOCS]; + KASSERT(usb_in_event_thread(parent)); + uaa.uaa_device = dev;
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Sun Jun 13 14:46:07 UTC 2021 Modified Files: src/sys/dev/usb: uhub.c Log Message: uhub(4): Defer rescan to USB event thread. Keep all of the USB bus exploration in a single thread -- this appears to have been the original assumption, violated back in 2008 when uhub_rescan was added, and will make everything simpler. To generate a diff of this commit: cvs rdiff -u -r1.151 -r1.152 src/sys/dev/usb/uhub.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/uhub.c diff -u src/sys/dev/usb/uhub.c:1.151 src/sys/dev/usb/uhub.c:1.152 --- src/sys/dev/usb/uhub.c:1.151 Sun Jun 13 00:11:57 2021 +++ src/sys/dev/usb/uhub.c Sun Jun 13 14:46:07 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: uhub.c,v 1.151 2021/06/13 00:11:57 riastradh Exp $ */ +/* $NetBSD: uhub.c,v 1.152 2021/06/13 14:46:07 riastradh 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 -__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.151 2021/06/13 00:11:57 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.152 2021/06/13 14:46:07 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -119,6 +119,7 @@ struct uhub_softc { bool sc_explorepending; bool sc_first_explore; bool sc_running; + bool sc_rescan; struct lwp *sc_exploring; }; @@ -130,8 +131,6 @@ struct uhub_softc { #define PORTSTAT_ISSET(sc, port) \ ((sc)->sc_status[(port) / 8] & (1 << ((port) % 8))) -Static usbd_status uhub_explore_enter(struct uhub_softc *); -Static void uhub_explore_exit(struct uhub_softc *); Static usbd_status uhub_explore(struct usbd_device *); Static void uhub_intr(struct usbd_xfer *, void *, usbd_status); @@ -482,51 +481,17 @@ uhub_attach(device_t parent, device_t se config_pending_decr(self); } -Static usbd_status -uhub_explore_enter(struct uhub_softc *sc) -{ - usbd_status err; - - mutex_enter(>sc_lock); - for (;;) { - if (sc->sc_exploring == NULL) { - sc->sc_exploring = curlwp; - err = 0; - break; - } - KASSERT(sc->sc_exploring != curlwp); - if (cv_wait_sig(>sc_cv, >sc_lock)) { - err = USBD_INTERRUPTED; - break; - } - } - mutex_exit(>sc_lock); - - return err; -} - -Static void -uhub_explore_exit(struct uhub_softc *sc) -{ - - mutex_enter(>sc_lock); - KASSERTMSG(sc->sc_exploring == curlwp, "lwp %p exploring %s", - sc->sc_exploring, device_xname(sc->sc_dev)); - sc->sc_exploring = NULL; - cv_broadcast(>sc_cv); - mutex_exit(>sc_lock); -} - usbd_status uhub_explore(struct usbd_device *dev) { usb_hub_descriptor_t *hd = >ud_hub->uh_hubdesc; struct uhub_softc *sc = dev->ud_hub->uh_hubsoftc; struct usbd_port *up; + struct usbd_device *subdev; usbd_status err; int speed; int port; - int change, status, reconnect; + int change, status, reconnect, rescan; UHUBHIST_FUNC(); UHUBHIST_CALLARGS("uhub%jd dev=%#jx addr=%jd speed=%ju", @@ -542,10 +507,19 @@ uhub_explore(struct usbd_device *dev) if (dev->ud_depth > USB_HUB_MAX_DEPTH) return USBD_TOO_DEEP; - /* Only one explore at a time, please. */ - err = uhub_explore_enter(sc); - if (err) - return err; + /* Process rescan if requested. */ + mutex_enter(>sc_lock); + rescan = sc->sc_rescan; + sc->sc_rescan = false; + mutex_exit(>sc_lock); + if (rescan) { + for (port = 1; port <= hd->bNbrPorts; port++) { + subdev = dev->ud_hub->uh_ports[port - 1].up_dev; + if (subdev == NULL) +continue; + usbd_reattach_device(sc->sc_dev, subdev, port, NULL); + } + } if (PORTSTAT_ISSET(sc, 0)) { /* hub status change */ usb_hub_status_t hs; @@ -851,7 +825,6 @@ uhub_explore(struct usbd_device *dev) } } mutex_exit(>sc_lock); - uhub_explore_exit(sc); if (sc->sc_first_explore) { config_pending_decr(sc->sc_dev); sc->sc_first_explore = false; @@ -928,26 +901,17 @@ static int uhub_rescan(device_t self, const char *ifattr, const int *locators) { struct uhub_softc *sc = device_private(self); - struct usbd_hub *hub = sc->sc_hub->ud_hub; - struct usbd_device *dev; - int port; UHUBHIST_FUNC(); UHUBHIST_CALLARGS("uhub%jd", device_unit(sc->sc_dev), 0, 0, 0); KASSERT(KERNEL_LOCKED_P()); - if (uhub_explore_enter(sc) != 0) - return EBUSY; - for (port = 1; port <= hub->uh_hubdesc.bNbrPorts; port++) { - dev = hub->uh_ports[port - 1].up_dev; - if (dev == NULL) - continue; - usbd_reattach_device(sc->sc_dev, dev, port, locators); - } - uhub_explore_exit(sc); - - /* Arrange to recursively explore hubs we may have found. */ + /* Trigger bus exploration. */ + /* XXX locators */ + mutex_enter(>sc_lock); + sc->sc_rescan = true; + mutex_exit(>sc_lock); usb_needs_explore(sc->sc_hub); return 0;
CVS commit: src/tests/dev/sysmon
Module Name:src Committed By: riastradh Date: Sun Jun 13 14:45:36 UTC 2021 Modified Files: src/tests/dev/sysmon: t_swsensor.sh Log Message: tests/dev/sysmon: Query bits of data, not bits of entropy. Fixes PR kern/47661. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tests/dev/sysmon/t_swsensor.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/sysmon/t_swsensor.sh diff -u src/tests/dev/sysmon/t_swsensor.sh:1.11 src/tests/dev/sysmon/t_swsensor.sh:1.12 --- src/tests/dev/sysmon/t_swsensor.sh:1.11 Sat Mar 21 04:50:21 2020 +++ src/tests/dev/sysmon/t_swsensor.sh Sun Jun 13 14:45:36 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_swsensor.sh,v 1.11 2020/03/21 04:50:21 pgoyette Exp $ +# $NetBSD: t_swsensor.sh,v 1.12 2021/06/13 14:45:36 riastradh Exp $ get_sensor_info() { rump.envstat -x | \ @@ -24,7 +24,7 @@ get_rnd_bits_count() { RUMP_SERVER=unix://t_swsensor_socket \ LD_PRELOAD=/usr/lib/librumphijack.so rndctl -l | \ grep "swsensor-sensor" | \ - awk '{print $2}' + awk '{print $3}' } check_powerd_event() { @@ -296,19 +296,16 @@ common_body() { sleep 5 new_rnd_bits=$( get_rnd_bits_count ) if [ $new_rnd_bits -le $rnd_bits ] ; then - atf_expect_fail "PR kern/47661" atf_fail "14a: entropy bits did not increase after polling" fi rnd_bits=$new_rnd_bits sleep 5 new_rnd_bits=$( get_rnd_bits_count ) if [ $new_rnd_bits -gt $rnd_bits ] ; then - atf_expect_fail "PR kern/47661" atf_fail "14b: entropy bits increased after poll with no value change" fi # Step 15 - make sure entropy collected when device is interrogated - # rump.envstat -c env0.conf rump.sysctl -w hw.swsensor.cur_value=$3 get_sensor_key cur-value @@ -317,14 +314,12 @@ common_body() { get_sensor_key cur-value new_rnd_bits=$( get_rnd_bits_count ) if [ $new_rnd_bits -le $rnd_bits ] ; then - atf_expect_fail "PR kern/47661" atf_fail "15a: entropy bits did not increase after interrogation" fi rnd_bits=$new_rnd_bits get_sensor_key cur-value new_rnd_bits=$( get_rnd_bits_count ) if [ $new_rnd_bits -gt $rnd_bits ] ; then - atf_expect_fail "PR kern/47661" atf_fail "15b: entropy bits increased after interrogation with no value change" fi }
CVS commit: src/sys/kern
Module Name:src Committed By: christos Date: Sun Jun 13 14:02:46 UTC 2021 Modified Files: src/sys/kern: subr_hash.c Log Message: remove unnecessary double init (fron paulg) To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/kern/subr_hash.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/kern/subr_hash.c diff -u src/sys/kern/subr_hash.c:1.10 src/sys/kern/subr_hash.c:1.11 --- src/sys/kern/subr_hash.c:1.10 Sat Jun 12 23:09:20 2021 +++ src/sys/kern/subr_hash.c Sun Jun 13 10:02:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_hash.c,v 1.10 2021/06/13 03:09:20 christos Exp $ */ +/* $NetBSD: subr_hash.c,v 1.11 2021/06/13 14:02:46 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1991, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.10 2021/06/13 03:09:20 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.11 2021/06/13 14:02:46 christos Exp $"); #include #include @@ -214,7 +214,6 @@ hashstat_sysctl(SYSCTLFN_ARGS) return EINVAL; } query = true; - h = newp; error = sysctl_copyinstr(l, h->hash_name, queryname, sizeof(queryname), ); if (error)
CVS commit: src/tests/lib/libcurses/slave
Module Name:src Committed By: rillig Date: Sun Jun 13 12:46:02 UTC 2021 Modified Files: src/tests/lib/libcurses/slave: commands.c slave.c Log Message: tests/libcurses: add parentheses around argument to sizeof To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/tests/lib/libcurses/slave/commands.c cvs rdiff -u -r1.16 -r1.17 src/tests/lib/libcurses/slave/slave.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/slave/commands.c diff -u src/tests/lib/libcurses/slave/commands.c:1.14 src/tests/lib/libcurses/slave/commands.c:1.15 --- src/tests/lib/libcurses/slave/commands.c:1.14 Mon Feb 15 07:06:27 2021 +++ src/tests/lib/libcurses/slave/commands.c Sun Jun 13 12:46:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: commands.c,v 1.14 2021/02/15 07:06:27 rillig Exp $ */ +/* $NetBSD: commands.c,v 1.15 2021/06/13 12:46:01 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -98,7 +98,7 @@ write_to_director(const void *mem, size_ static void write_to_director_int(int i) { - write_to_director(, sizeof i); + write_to_director(, sizeof(i)); } static void @@ -218,7 +218,7 @@ report_nstr(chtype *string) for (p = string; (*p & __CHARTEXT) != 0; p++) continue; - size = (size_t)(p + 1 - string) * sizeof *p; + size = (size_t)(p + 1 - string) * sizeof(*p); write_to_director_type(data_byte); write_to_director_int(size); @@ -233,8 +233,8 @@ report_cchar(cchar_t c) { write_to_director_type(data_cchar); - write_to_director_int(sizeof c); - write_to_director(, sizeof c); + write_to_director_int(sizeof(c)); + write_to_director(, sizeof(c)); } /* @@ -262,7 +262,7 @@ report_wstr(wchar_t *wstr) for (p = wstr; *p != L'\0'; p++) continue; - size = (size_t)(p + 1 - wstr) * sizeof *p; + size = (size_t)(p + 1 - wstr) * sizeof(*p); write_to_director_type(data_wchar); Index: src/tests/lib/libcurses/slave/slave.c diff -u src/tests/lib/libcurses/slave/slave.c:1.16 src/tests/lib/libcurses/slave/slave.c:1.17 --- src/tests/lib/libcurses/slave/slave.c:1.16 Sat Feb 13 10:03:49 2021 +++ src/tests/lib/libcurses/slave/slave.c Sun Jun 13 12:46:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: slave.c,v 1.16 2021/02/13 10:03:49 rillig Exp $ */ +/* $NetBSD: slave.c,v 1.17 2021/06/13 12:46:01 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -82,12 +82,12 @@ read_command_argument(char ***pargs, int int type, len; char **args = *pargs; - read_from_director(, sizeof type); - read_from_director(, sizeof len); + read_from_director(, sizeof(type)); + read_from_director(, sizeof(len)); if (len < 0) return false; - args = realloc(args, (argslen + 1) * sizeof args[0]); + args = realloc(args, (argslen + 1) * sizeof(args[0])); if (args == NULL) err(1, "slave realloc of args array failed"); *pargs = args; @@ -134,11 +134,11 @@ process_commands(void) if ((cmdbuf = malloc(maxlen)) == NULL) err(1, "slave cmdbuf malloc failed"); - while (try_read_from_director(, sizeof type)) { + while (try_read_from_director(, sizeof(type))) { if (type != data_string) errx(1, "Unexpected type for command, got %d", type); - read_from_director(, sizeof len); + read_from_director(, sizeof(len)); if ((len + 1) > maxlen) { maxlen = len + 1;
CVS commit: src/tests/lib/libcurses/director
Module Name:src Committed By: rillig Date: Sun Jun 13 11:06:20 UTC 2021 Modified Files: src/tests/lib/libcurses/director: testlang_parse.y Log Message: tests/libcurses: sprinkle 'const', normalize sizeof No functional change. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/tests/lib/libcurses/director/testlang_parse.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/director/testlang_parse.y diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.52 src/tests/lib/libcurses/director/testlang_parse.y:1.53 --- src/tests/lib/libcurses/director/testlang_parse.y:1.52 Tue Apr 6 01:29:37 2021 +++ src/tests/lib/libcurses/director/testlang_parse.y Sun Jun 13 11:06:20 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: testlang_parse.y,v 1.52 2021/04/06 01:29:37 rillig Exp $ */ +/* $NetBSD: testlang_parse.y,v 1.53 2021/06/13 11:06:20 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -82,7 +82,7 @@ static bool no_input; /* don't need more static wchar_t *vals = NULL; /* wchars to attach to a cchar type */ static unsigned nvals; /* number of wchars */ -const char *enum_names[] = { /* for data_enum_t */ +const char *const enum_names[] = { /* for data_enum_t */ "unused", "numeric", "static", "string", "byte", "cchar", "wchar", "ERR", "OK", "NULL", "not NULL", "variable", "reference", "return count", "slave error" @@ -116,7 +116,7 @@ typedef struct { static size_t nvars; /* Number of declared variables */ static var_t *vars; /* Variables defined during the test. */ -static int check_function_table(char *, const char *[], int); +static int check_function_table(char *, const char *const[], int); static int find_var_index(const char *); static void assign_arg(data_enum_t, void *); static int assign_var(const char *); @@ -149,7 +149,7 @@ static void set_wchar(char *); static wchar_t *add_to_vals(data_enum_t, void *); #define variants(fn) "" fn, "mv" fn, "w" fn, "mvw" fn -static const char *input_functions[] = { +static const char *const input_functions[] = { variants("getch"), variants("getnstr"), variants("getstr"), @@ -161,7 +161,7 @@ static const char *input_functions[] = { #undef variants static const unsigned ninput_functions = - sizeof(input_functions) / sizeof(char *); + sizeof(input_functions) / sizeof(input_functions[0]); extern saved_data_t saved_output; @@ -875,7 +875,7 @@ find_var_index(const char *var_name) * there is a match. */ static int -check_function_table(char *function, const char *table[], int nfunctions) +check_function_table(char *function, const char *const table[], int nfunctions) { int i;
CVS commit: src/sys/nfs
Module Name:src Committed By: mlelstv Date: Sun Jun 13 10:25:11 UTC 2021 Modified Files: src/sys/nfs: nfs_vfsops.c Log Message: Don't pretend that files are limited to 1TB on NFSv3. To generate a diff of this commit: cvs rdiff -u -r1.242 -r1.243 src/sys/nfs/nfs_vfsops.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/nfs/nfs_vfsops.c diff -u src/sys/nfs/nfs_vfsops.c:1.242 src/sys/nfs/nfs_vfsops.c:1.243 --- src/sys/nfs/nfs_vfsops.c:1.242 Fri Apr 2 03:07:54 2021 +++ src/sys/nfs/nfs_vfsops.c Sun Jun 13 10:25:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_vfsops.c,v 1.242 2021/04/02 03:07:54 christos Exp $ */ +/* $NetBSD: nfs_vfsops.c,v 1.243 2021/06/13 10:25:11 mlelstv Exp $ */ /* * Copyright (c) 1989, 1993, 1995 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.242 2021/04/02 03:07:54 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.243 2021/06/13 10:25:11 mlelstv Exp $"); #if defined(_KERNEL_OPT) #include "opt_nfs.h" @@ -296,8 +296,7 @@ nfs_fsinfo(struct nfsmount *nmp, struct if (nmp->nm_readdirsize == 0) nmp->nm_readdirsize = xmax; } - /* XXX */ - nmp->nm_maxfilesize = (u_int64_t)0x8000 * DEV_BSIZE - 1; + nmp->nm_maxfilesize = 0xull; maxfsize = fxdr_hyper(>fs_maxfilesize); if (maxfsize > 0 && maxfsize < nmp->nm_maxfilesize) nmp->nm_maxfilesize = maxfsize;
CVS commit: src/etc/rc.d
Module Name:src Committed By: mlelstv Date: Sun Jun 13 10:14:40 UTC 2021 Modified Files: src/etc/rc.d: sysctl Log Message: run sysctl early enough. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/etc/rc.d/sysctl Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/etc/rc.d/sysctl diff -u src/etc/rc.d/sysctl:1.13 src/etc/rc.d/sysctl:1.14 --- src/etc/rc.d/sysctl:1.13 Fri Aug 13 18:08:03 2004 +++ src/etc/rc.d/sysctl Sun Jun 13 10:14:40 2021 @@ -1,11 +1,11 @@ #!/bin/sh # -# $NetBSD: sysctl,v 1.13 2004/08/13 18:08:03 mycroft Exp $ +# $NetBSD: sysctl,v 1.14 2021/06/13 10:14:40 mlelstv Exp $ # # PROVIDE: sysctl -# REQUIRE: root ipfilter ipsec -# BEFORE: DAEMON +# REQUIRE: root +# BEFORE: DISKS $_rc_subr_loaded . /etc/rc.subr
CVS commit: src/sys/dev/scsipi
Module Name:src Committed By: mlelstv Date: Sun Jun 13 10:07:56 UTC 2021 Modified Files: src/sys/dev/scsipi: st.c Log Message: Restore EOM handling. To generate a diff of this commit: cvs rdiff -u -r1.240 -r1.241 src/sys/dev/scsipi/st.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/scsipi/st.c diff -u src/sys/dev/scsipi/st.c:1.240 src/sys/dev/scsipi/st.c:1.241 --- src/sys/dev/scsipi/st.c:1.240 Fri Dec 27 09:41:51 2019 +++ src/sys/dev/scsipi/st.c Sun Jun 13 10:07:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: st.c,v 1.240 2019/12/27 09:41:51 msaitoh Exp $ */ +/* $NetBSD: st.c,v 1.241 2021/06/13 10:07:56 mlelstv Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.240 2019/12/27 09:41:51 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.241 2021/06/13 10:07:56 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_scsi.h" @@ -343,7 +343,7 @@ static int st_mount_tape(dev_t, int); static void st_unmount(struct st_softc *, boolean); static int st_decide_mode(struct st_softc *, boolean); static void ststart(struct scsipi_periph *); -static int ststart1(struct scsipi_periph *, struct buf *); +static int ststart1(struct scsipi_periph *, struct buf *, int *); static void strestart(void *); static void stdone(struct scsipi_xfer *, int); static int st_read(struct st_softc *, char *, int, int); @@ -1183,13 +1183,13 @@ abort: * ststart() is called with channel lock held */ static int -ststart1(struct scsipi_periph *periph, struct buf *bp) +ststart1(struct scsipi_periph *periph, struct buf *bp, int *errnop) { struct st_softc *st = device_private(periph->periph_dev); struct scsipi_channel *chan = periph->periph_channel; struct scsi_rw_tape cmd; struct scsipi_xfer *xs; - int flags, error; + int flags, error, complete = 1; SC_DEBUG(periph, SCSIPI_DB2, ("ststart1 ")); @@ -1239,7 +1239,6 @@ ststart1(struct scsipi_periph *periph, s goto out; } } else { -bp->b_resid = bp->b_bcount; error = 0; st->flags &= ~ST_AT_FILEMARK; goto out; @@ -1251,7 +1250,10 @@ ststart1(struct scsipi_periph *periph, s * yet then we should report it now. */ if (st->flags & (ST_EOM_PENDING|ST_EIO_PENDING)) { - error = EIO; + error = 0; + if (st->flags & ST_EIO_PENDING) + error = EIO; + st->flags &= ~(ST_EOM_PENDING|ST_EIO_PENDING); goto out; } @@ -1299,11 +1301,14 @@ ststart1(struct scsipi_periph *periph, s error = scsipi_execute_xs(xs); /* with a scsipi_xfer preallocated, scsipi_command can't fail */ KASSERT(error == 0); + if (error == 0) + complete = 0; out: mutex_exit(chan_mtx(chan)); - return error; + *errnop = error; + return complete; } static void @@ -1312,7 +1317,7 @@ ststart(struct scsipi_periph *periph) struct st_softc *st = device_private(periph->periph_dev); struct scsipi_channel *chan = periph->periph_channel; struct buf *bp; - int error; + int error, complete; SC_DEBUG(periph, SCSIPI_DB2, ("ststart ")); @@ -1325,19 +1330,20 @@ ststart(struct scsipi_periph *periph) iostat_busy(st->stats); mutex_exit(>sc_iolock); - error = ststart1(periph, bp); + complete = ststart1(periph, bp, ); mutex_enter(>sc_iolock); - if (error != 0) + if (complete) { iostat_unbusy(st->stats, 0, ((bp->b_flags & B_READ) == B_READ)); - if (error == EAGAIN) { - bufq_put(st->buf_defer, bp); - break; + if (error == EAGAIN) { +bufq_put(st->buf_defer, bp); +break; + } } mutex_exit(>sc_iolock); - if (error != 0) { + if (complete) { bp->b_error = error; bp->b_resid = bp->b_bcount; biodone(bp);
CVS commit: src/sys/dev/pci
Module Name:src Committed By: mlelstv Date: Sun Jun 13 10:05:39 UTC 2021 Modified Files: src/sys/dev/pci: if_aq.c Log Message: Don't ignore errors of sysmon_envsys_register(). To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/dev/pci/if_aq.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/pci/if_aq.c diff -u src/sys/dev/pci/if_aq.c:1.25 src/sys/dev/pci/if_aq.c:1.26 --- src/sys/dev/pci/if_aq.c:1.25 Fri Apr 16 08:09:40 2021 +++ src/sys/dev/pci/if_aq.c Sun Jun 13 10:05:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_aq.c,v 1.25 2021/04/16 08:09:40 ryo Exp $ */ +/* $NetBSD: if_aq.c,v 1.26 2021/06/13 10:05:39 mlelstv Exp $ */ /** * aQuantia Corporation Network Driver @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.25 2021/04/16 08:09:40 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.26 2021/06/13 10:05:39 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_if_aq.h" @@ -1491,7 +1491,11 @@ aq_attach(device_t parent, device_t self snprintf(sc->sc_sensor_temp.desc, ENVSYS_DESCLEN, "PHY"); sysmon_envsys_sensor_attach(sc->sc_sme, >sc_sensor_temp); - sysmon_envsys_register(sc->sc_sme); + if (sysmon_envsys_register(sc->sc_sme)) { + sysmon_envsys_destroy(sc->sc_sme); + sc->sc_sme = NULL; + goto attach_failure; + } /* * for unknown reasons, the first call of fw2x_get_temperature() @@ -1579,7 +1583,6 @@ aq_detach(device_t self, int flags __unu if (sc->sc_sme != NULL) { /* all sensors associated with this will also be detached */ sysmon_envsys_unregister(sc->sc_sme); - sc->sc_sme = NULL; } #endif
CVS commit: src/sys/dev/pci
Module Name:src Committed By: mlelstv Date: Sun Jun 13 10:04:10 UTC 2021 Modified Files: src/sys/dev/pci: arcmsr.c Log Message: Fix race when freeing sensors. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/arcmsr.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/pci/arcmsr.c diff -u src/sys/dev/pci/arcmsr.c:1.41 src/sys/dev/pci/arcmsr.c:1.42 --- src/sys/dev/pci/arcmsr.c:1.41 Sat Apr 24 23:36:57 2021 +++ src/sys/dev/pci/arcmsr.c Sun Jun 13 10:04:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: arcmsr.c,v 1.41 2021/04/24 23:36:57 thorpej Exp $ */ +/* $NetBSD: arcmsr.c,v 1.42 2021/06/13 10:04:10 mlelstv Exp $ */ /* $OpenBSD: arc.c,v 1.68 2007/10/27 03:28:27 dlg Exp $ */ /* @@ -21,7 +21,7 @@ #include "bio.h" #include -__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.41 2021/04/24 23:36:57 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.42 2021/06/13 10:04:10 mlelstv Exp $"); #include #include @@ -1884,9 +1884,9 @@ arc_create_sensors(void *arg) bad: sysmon_envsys_destroy(sc->sc_sme); - kmem_free(sc->sc_arc_sensors, slen); - sc->sc_sme = NULL; + + kmem_free(sc->sc_arc_sensors, slen); sc->sc_arc_sensors = NULL; kthread_exit(0);
CVS commit: src/sys/dev
Module Name:src Committed By: mlelstv Date: Sun Jun 13 10:01:43 UTC 2021 Modified Files: src/sys/dev: vnd.c Log Message: Fail to open read-write when created read-only. To generate a diff of this commit: cvs rdiff -u -r1.280 -r1.281 src/sys/dev/vnd.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/vnd.c diff -u src/sys/dev/vnd.c:1.280 src/sys/dev/vnd.c:1.281 --- src/sys/dev/vnd.c:1.280 Sun Apr 11 18:18:39 2021 +++ src/sys/dev/vnd.c Sun Jun 13 10:01:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vnd.c,v 1.280 2021/04/11 18:18:39 mlelstv Exp $ */ +/* $NetBSD: vnd.c,v 1.281 2021/06/13 10:01:43 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008, 2020 The NetBSD Foundation, Inc. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.280 2021/04/11 18:18:39 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.281 2021/06/13 10:01:43 mlelstv Exp $"); #if defined(_KERNEL_OPT) #include "opt_vnd.h" @@ -364,6 +364,11 @@ vndopen(dev_t dev, int flags, int mode, goto done; } + if ((flags & FWRITE) && (sc->sc_flags & VNF_READONLY)) { + error = EROFS; + goto done; + } + if (sc->sc_flags & VNF_INITED) { if ((sc->sc_dkdev.dk_openmask & ~(1<
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: mlelstv Date: Sun Jun 13 09:58:28 UTC 2021 Modified Files: src/sys/dev/sdmmc: sdmmc.c Log Message: Don't crash on detach where interlock == NULL. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/sdmmc/sdmmc.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/sdmmc/sdmmc.c diff -u src/sys/dev/sdmmc/sdmmc.c:1.41 src/sys/dev/sdmmc/sdmmc.c:1.42 --- src/sys/dev/sdmmc/sdmmc.c:1.41 Sat Apr 24 23:36:59 2021 +++ src/sys/dev/sdmmc/sdmmc.c Sun Jun 13 09:58:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sdmmc.c,v 1.41 2021/04/24 23:36:59 thorpej Exp $ */ +/* $NetBSD: sdmmc.c,v 1.42 2021/06/13 09:58:28 mlelstv Exp $ */ /* $OpenBSD: sdmmc.c,v 1.18 2009/01/09 10:58:38 jsg Exp $ */ /* @@ -49,7 +49,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.41 2021/04/24 23:36:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdmmc.c,v 1.42 2021/06/13 09:58:28 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -300,14 +300,16 @@ sdmmc_del_task(struct sdmmc_softc *sc, s } else { KASSERT(task->sc == NULL); KASSERT(!task->onqueue); - mutex_exit(interlock); + if (interlock != NULL) + mutex_exit(interlock); while (sc->sc_curtask == task) { KASSERT(curlwp != sc->sc_tskq_lwp); cv_wait(>sc_tskq_cv, >sc_tskq_mtx); } - if (!mutex_tryenter(interlock)) { + if (interlock == NULL || !mutex_tryenter(interlock)) { mutex_exit(>sc_tskq_mtx); - mutex_enter(interlock); + if (interlock != NULL) +mutex_enter(interlock); mutex_enter(>sc_tskq_mtx); } cancelled = false;
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: mlelstv Date: Sun Jun 13 09:50:02 UTC 2021 Modified Files: src/sys/dev/sdmmc: sdmmc_mem.c Log Message: Be less verbose normally and more when debugging. To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/dev/sdmmc/sdmmc_mem.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/sdmmc/sdmmc_mem.c diff -u src/sys/dev/sdmmc/sdmmc_mem.c:1.72 src/sys/dev/sdmmc/sdmmc_mem.c:1.73 --- src/sys/dev/sdmmc/sdmmc_mem.c:1.72 Mon May 11 09:51:47 2020 +++ src/sys/dev/sdmmc/sdmmc_mem.c Sun Jun 13 09:50:02 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sdmmc_mem.c,v 1.72 2020/05/11 09:51:47 jdc Exp $ */ +/* $NetBSD: sdmmc_mem.c,v 1.73 2021/06/13 09:50:02 mlelstv Exp $ */ /* $OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $ */ /* @@ -45,7 +45,7 @@ /* Routines for SD/MMC memory cards. */ #include -__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.72 2020/05/11 09:51:47 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.73 2021/06/13 09:50:02 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -255,8 +255,11 @@ mmc_mode: } error = sdmmc_mem_signal_voltage(sc, SDMMC_SIGNAL_VOLTAGE_180); - if (error) + if (error) { + DPRINTF(("%s: voltage change on host failed\n", + SDMMCDEVNAME(sc))); goto out; + } SET(sc->sc_flags, SMF_UHS_MODE); } @@ -264,10 +267,6 @@ mmc_mode: out: SDMMC_UNLOCK(sc); - if (error) - printf("%s: %s failed with error %d\n", SDMMCDEVNAME(sc), - __func__, error); - return error; }
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: mlelstv Date: Sun Jun 13 09:48:45 UTC 2021 Modified Files: src/sys/dev/i2c: lm_i2c.c Log Message: iic_acquire_bus can fail To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/i2c/lm_i2c.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/i2c/lm_i2c.c diff -u src/sys/dev/i2c/lm_i2c.c:1.6 src/sys/dev/i2c/lm_i2c.c:1.7 --- src/sys/dev/i2c/lm_i2c.c:1.6 Wed Jun 24 19:11:49 2020 +++ src/sys/dev/i2c/lm_i2c.c Sun Jun 13 09:48:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lm_i2c.c,v 1.6 2020/06/24 19:11:49 jdolecek Exp $ */ +/* $NetBSD: lm_i2c.c,v 1.7 2021/06/13 09:48:44 mlelstv Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lm_i2c.c,v 1.6 2020/06/24 19:11:49 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lm_i2c.c,v 1.7 2021/06/13 09:48:44 mlelstv Exp $"); #include #include @@ -119,7 +119,8 @@ lm_i2c_readreg(struct lm_softc *lmsc, in struct lm_i2c_softc *sc = (struct lm_i2c_softc *)lmsc; uint8_t cmd, data; - iic_acquire_bus(sc->sc_tag, 0); + if (iic_acquire_bus(sc->sc_tag, 0)) + return 0; cmd = reg; iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, @@ -137,7 +138,8 @@ lm_i2c_writereg(struct lm_softc *lmsc, i struct lm_i2c_softc *sc = (struct lm_i2c_softc *)lmsc; uint8_t cmd, data; - iic_acquire_bus(sc->sc_tag, 0); + if (iic_acquire_bus(sc->sc_tag, 0)) + return; cmd = reg; data = val;
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: mlelstv Date: Sun Jun 13 09:48:04 UTC 2021 Modified Files: src/sys/dev/i2c: spdmem_i2c.c Log Message: iic_acquire_bus can fail To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/i2c/spdmem_i2c.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/i2c/spdmem_i2c.c diff -u src/sys/dev/i2c/spdmem_i2c.c:1.21 src/sys/dev/i2c/spdmem_i2c.c:1.22 --- src/sys/dev/i2c/spdmem_i2c.c:1.21 Wed Jan 27 02:29:48 2021 +++ src/sys/dev/i2c/spdmem_i2c.c Sun Jun 13 09:48:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: spdmem_i2c.c,v 1.21 2021/01/27 02:29:48 thorpej Exp $ */ +/* $NetBSD: spdmem_i2c.c,v 1.22 2021/06/13 09:48:04 mlelstv Exp $ */ /* * Copyright (c) 2007 Nicolas Joly @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.21 2021/01/27 02:29:48 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.22 2021/06/13 09:48:04 mlelstv Exp $"); #include #include @@ -107,7 +107,9 @@ spdmem_reset_page(struct spdmem_i2c_soft reg = 0; - iic_acquire_bus(sc->sc_tag, 0); + rv = iic_acquire_bus(sc->sc_tag, 0); + if (rv) + return rv; /* * Try to read byte 0 and 2. If it failed, it's not spdmem or a device @@ -265,7 +267,9 @@ spdmem_i2c_read(struct spdmem_softc *sof reg = addr & 0xff; - iic_acquire_bus(sc->sc_tag, 0); + rv = iic_acquire_bus(sc->sc_tag, 0); + if (rv) + return rv; if (addr & 0x100) { rv = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_page1,
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: mlelstv Date: Sun Jun 13 09:47:36 UTC 2021 Modified Files: src/sys/dev/i2c: sdtemp.c Log Message: Clear sc_sme pointer to avoid double free. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/dev/i2c/sdtemp.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/i2c/sdtemp.c diff -u src/sys/dev/i2c/sdtemp.c:1.39 src/sys/dev/i2c/sdtemp.c:1.40 --- src/sys/dev/i2c/sdtemp.c:1.39 Tue Jun 30 19:02:42 2020 +++ src/sys/dev/i2c/sdtemp.c Sun Jun 13 09:47:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sdtemp.c,v 1.39 2020/06/30 19:02:42 msaitoh Exp $*/ +/* $NetBSD: sdtemp.c,v 1.40 2021/06/13 09:47:36 mlelstv Exp $*/ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.39 2020/06/30 19:02:42 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.40 2021/06/13 09:47:36 mlelstv Exp $"); #include #include @@ -405,6 +405,7 @@ sdtemp_attach(device_t parent, device_t bad: kmem_free(sc->sc_sensor, sizeof(envsys_data_t)); sysmon_envsys_destroy(sc->sc_sme); + sc->sc_sme = NULL; } static int
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: mlelstv Date: Sun Jun 13 09:46:04 UTC 2021 Modified Files: src/sys/dev/i2c: lm75.c lm87.c Log Message: iic_acquire_bus can fail. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/i2c/lm75.c cvs rdiff -u -r1.14 -r1.15 src/sys/dev/i2c/lm87.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/i2c/lm75.c diff -u src/sys/dev/i2c/lm75.c:1.43 src/sys/dev/i2c/lm75.c:1.44 --- src/sys/dev/i2c/lm75.c:1.43 Fri May 21 20:42:05 2021 +++ src/sys/dev/i2c/lm75.c Sun Jun 13 09:46:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lm75.c,v 1.43 2021/05/21 20:42:05 macallan Exp $ */ +/* $NetBSD: lm75.c,v 1.44 2021/06/13 09:46:04 mlelstv Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.43 2021/05/21 20:42:05 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.44 2021/06/13 09:46:04 mlelstv Exp $"); #include #include @@ -230,7 +230,11 @@ lmtemp_attach(device_t parent, device_t sc->sc_lmtemp_decode = lmtemptbl[i].lmtemp_decode; sc->sc_lmtemp_encode = lmtemptbl[i].lmtemp_encode; - iic_acquire_bus(sc->sc_tag, 0); + if (iic_acquire_bus(sc->sc_tag, 0)) { + aprint_error_dev(self, + "unable to acquire I2C bus\n"); + return; + } /* Read temperature limit(s) and remember initial value(s). */ if (i == lmtemp_lm77) { @@ -378,7 +382,8 @@ lmtemp_refresh(struct sysmon_envsys *sme { struct lmtemp_softc *sc = sme->sme_cookie; - iic_acquire_bus(sc->sc_tag, 0); /* also locks our instance */ + if (iic_acquire_bus(sc->sc_tag, 0)) /* also locks our instance */ + return; lmtemp_refresh_sensor_data(sc); iic_release_bus(sc->sc_tag, 0); /* also unlocks our instance */ } @@ -392,7 +397,8 @@ lmtemp_getlim_lm75(struct sysmon_envsys *props &= ~(PROP_CRITMAX); - iic_acquire_bus(sc->sc_tag, 0); + if (iic_acquire_bus(sc->sc_tag, 0)) + return; if (lmtemp_temp_read(sc, LM75_REG_TOS_SET_POINT, , 0) == 0) { limits->sel_critmax = val; *props |= PROP_CRITMAX; @@ -409,7 +415,8 @@ lmtemp_getlim_lm77(struct sysmon_envsys *props &= ~(PROP_CRITMAX | PROP_WARNMAX | PROP_WARNMIN); - iic_acquire_bus(sc->sc_tag, 0); + if (iic_acquire_bus(sc->sc_tag, 0)) + return; if (lmtemp_temp_read(sc, LM77_REG_TCRIT_SET_POINT, , 0) == 0) { limits->sel_critmax = val; *props |= PROP_CRITMAX; @@ -437,7 +444,8 @@ lmtemp_setlim_lm75(struct sysmon_envsys limit = sc->sc_smax; else limit = limits->sel_critmax; - iic_acquire_bus(sc->sc_tag, 0); + if (iic_acquire_bus(sc->sc_tag, 0)) + return; lmtemp_temp_write(sc, LM75_REG_THYST_SET_POINT, limit - 500, 0); lmtemp_temp_write(sc, LM75_REG_TOS_SET_POINT, limit, 0); @@ -608,7 +616,7 @@ sysctl_lm75_temp(SYSCTLFN_ARGS) { struct sysctlnode node = *rnode; struct lmtemp_softc *sc = node.sysctl_data; - int temp; + int temp, error; if (newp) { @@ -618,7 +626,9 @@ sysctl_lm75_temp(SYSCTLFN_ARGS) temp = *(int *)node.sysctl_data; sc->sc_tmax = temp; - iic_acquire_bus(sc->sc_tag, 0); + error = iic_acquire_bus(sc->sc_tag, 0); + if (error) +return error; lmtemp_temp_write(sc, LM75_REG_THYST_SET_POINT, sc->sc_tmax - 5, 1); lmtemp_temp_write(sc, LM75_REG_TOS_SET_POINT, Index: src/sys/dev/i2c/lm87.c diff -u src/sys/dev/i2c/lm87.c:1.14 src/sys/dev/i2c/lm87.c:1.15 --- src/sys/dev/i2c/lm87.c:1.14 Wed Jan 27 02:29:48 2021 +++ src/sys/dev/i2c/lm87.c Sun Jun 13 09:46:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lm87.c,v 1.14 2021/01/27 02:29:48 thorpej Exp $ */ +/* $NetBSD: lm87.c,v 1.15 2021/06/13 09:46:04 mlelstv Exp $ */ /* $OpenBSD: lm87.c,v 1.20 2008/11/10 05:19:48 cnst Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lm87.c,v 1.14 2021/01/27 02:29:48 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lm87.c,v 1.15 2021/06/13 09:46:04 mlelstv Exp $"); #include #include @@ -162,7 +162,8 @@ lmenv_match(device_t parent, cfdata_t ma return 0; cmd = LM87_COMPANY_ID; - iic_acquire_bus(ia->ia_tag, 0); + if (iic_acquire_bus(ia->ia_tag, 0)) + return 0; error = iic_exec(ia->ia_tag, I2C_OP_READ_WITH_STOP, ia->ia_addr, , 1, , 1, 0); iic_release_bus(ia->ia_tag, 0);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 09:32:01 UTC 2021 Modified Files: src/sys/dev/usb: ubsa.c Log Message: Refactor handling of "quad utms" devices and more. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/usb/ubsa.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/ubsa.c diff -u src/sys/dev/usb/ubsa.c:1.41 src/sys/dev/usb/ubsa.c:1.42 --- src/sys/dev/usb/ubsa.c:1.41 Sat Apr 24 23:36:59 2021 +++ src/sys/dev/usb/ubsa.c Sun Jun 13 09:32:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ubsa.c,v 1.41 2021/04/24 23:36:59 thorpej Exp $ */ +/* $NetBSD: ubsa.c,v 1.42 2021/06/13 09:32:01 mlelstv Exp $ */ /*- * Copyright (c) 2002, Alexander Kabaev . @@ -55,7 +55,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.41 2021/04/24 23:36:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.42 2021/06/13 09:32:01 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -107,25 +107,28 @@ static const struct ucom_methods ubsa_me .ucom_close = ubsa_close, }; -Static const struct usb_devno ubsa_devs[] = { +Static const struct ubsa_type { + struct usb_devno ubsa_dev; + int ubsa_quadumts; +} ubsa_devs[] = { /* BELKIN F5U103 */ - { USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U103 }, + { { USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U103 }, 0 }, /* BELKIN F5U120 */ - { USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U120 }, + { { USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U120 }, 0 }, /* GoHubs GO-COM232 */ - { USB_VENDOR_ETEK, USB_PRODUCT_ETEK_1COM }, + { { USB_VENDOR_ETEK, USB_PRODUCT_ETEK_1COM }, 0 }, /* GoHubs GO-COM232 */ - { USB_VENDOR_GOHUBS, USB_PRODUCT_GOHUBS_GOCOM232 }, + { { USB_VENDOR_GOHUBS, USB_PRODUCT_GOHUBS_GOCOM232 }, 0 }, /* Peracom */ - { USB_VENDOR_PERACOM, USB_PRODUCT_PERACOM_SERIAL1 }, + { { USB_VENDOR_PERACOM, USB_PRODUCT_PERACOM_SERIAL1 }, 0 }, /* Option N.V. */ - { USB_VENDOR_OPTIONNV, USB_PRODUCT_OPTIONNV_MC3G }, - { USB_VENDOR_OPTIONNV, USB_PRODUCT_OPTIONNV_QUADUMTS2 }, - { USB_VENDOR_OPTIONNV, USB_PRODUCT_OPTIONNV_QUADUMTS }, - /* AnyDATA ADU-E100H */ - { USB_VENDOR_ANYDATA, USB_PRODUCT_ANYDATA_ADU_E100H }, + { { USB_VENDOR_OPTIONNV, USB_PRODUCT_OPTIONNV_MC3G }, 0 }, + { { USB_VENDOR_OPTIONNV, USB_PRODUCT_OPTIONNV_QUADUMTS2 }, 1 }, + { { USB_VENDOR_OPTIONNV, USB_PRODUCT_OPTIONNV_QUADUMTS }, 1 }, + { { USB_VENDOR_OPTIONNV, USB_PRODUCT_OPTIONNV_QUADPLUSUMTS }, 1 }, + { { USB_VENDOR_OPTIONNV, USB_PRODUCT_OPTIONNV_HSDPA }, 1 }, }; -#define ubsa_lookup(v, p) usb_lookup(ubsa_devs, v, p) +#define ubsa_lookup(v, p) ((const struct ubsa_type *)usb_lookup(ubsa_devs, v, p)) int ubsa_match(device_t, cfdata_t, void *); void ubsa_attach(device_t, device_t, void *); @@ -183,15 +186,7 @@ ubsa_attach(device_t parent, device_t se * Quad UMTS cards use different requests to * control com settings and only some. */ - sc->sc_quadumts = 0; - if (uaa->uaa_vendor == USB_VENDOR_OPTIONNV) { - switch (uaa->uaa_product) { - case USB_PRODUCT_OPTIONNV_QUADUMTS: - case USB_PRODUCT_OPTIONNV_QUADUMTS2: - sc->sc_quadumts = 1; - break; - } - } + sc->sc_quadumts = ubsa_lookup(uaa->uaa_vendor, uaa->uaa_product)->ubsa_quadumts; DPRINTF(("ubsa attach: sc = %p\n", sc));
CVS commit: src/sys/kern
Module Name:src Committed By: riastradh Date: Sun Jun 13 09:30:48 UTC 2021 Modified Files: src/sys/kern: subr_autoconf.c Log Message: autoconf(9): Take kernel lock in config_detach. config_detach is used in too many places to audit for now -- so although I'm quite sure it is racy (e.g., with cloning devices and drvctl: drvctl -d a newly opened fss0 before sc_state has transitioned from FSS_IDLE), this will mitigate the immediate fallout until we can properly fix autoconf's notions of device pointers. To generate a diff of this commit: cvs rdiff -u -r1.286 -r1.287 src/sys/kern/subr_autoconf.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/kern/subr_autoconf.c diff -u src/sys/kern/subr_autoconf.c:1.286 src/sys/kern/subr_autoconf.c:1.287 --- src/sys/kern/subr_autoconf.c:1.286 Sun Jun 13 00:11:46 2021 +++ src/sys/kern/subr_autoconf.c Sun Jun 13 09:30:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_autoconf.c,v 1.286 2021/06/13 00:11:46 riastradh Exp $ */ +/* $NetBSD: subr_autoconf.c,v 1.287 2021/06/13 09:30:48 riastradh Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -79,7 +79,7 @@ #define __SUBR_AUTOCONF_PRIVATE /* see */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.286 2021/06/13 00:11:46 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.287 2021/06/13 09:30:48 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1969,7 +1969,7 @@ config_detach(device_t dev, int flags) device_t d __diagused; int rv = 0; - KASSERT(KERNEL_LOCKED_P()); + KERNEL_LOCK(1, NULL); cf = dev->dv_cfdata; KASSERTMSG((cf == NULL || cf->cf_fstate == FSTATE_FOUND || @@ -1988,8 +1988,10 @@ config_detach(device_t dev, int flags) * attached. */ rv = config_detach_enter(dev); - if (rv) + if (rv) { + KERNEL_UNLOCK_ONE(NULL); return rv; + } mutex_enter(_lock); if (dev->dv_del_gen != 0) { @@ -1999,6 +2001,7 @@ config_detach(device_t dev, int flags) device_xname(dev)); #endif /* DIAGNOSTIC */ config_detach_exit(dev); + KERNEL_UNLOCK_ONE(NULL); return ENOENT; } alldevs_nwrite++; @@ -2095,6 +2098,8 @@ out: } config_alldevs_exit(); + KERNEL_UNLOCK_ONE(NULL); + return rv; }
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 09:29:38 UTC 2021 Modified Files: src/sys/dev/usb: ubsa_common.c Log Message: Handle IXON,IXOFF individually. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/usb/ubsa_common.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/ubsa_common.c diff -u src/sys/dev/usb/ubsa_common.c:1.14 src/sys/dev/usb/ubsa_common.c:1.15 --- src/sys/dev/usb/ubsa_common.c:1.14 Sat Mar 14 02:35:33 2020 +++ src/sys/dev/usb/ubsa_common.c Sun Jun 13 09:29:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ubsa_common.c,v 1.14 2020/03/14 02:35:33 christos Exp $ */ +/* $NetBSD: ubsa_common.c,v 1.15 2021/06/13 09:29:38 mlelstv Exp $ */ /*- * Copyright (c) 2002, Alexander Kabaev . * All rights reserved. @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ubsa_common.c,v 1.14 2020/03/14 02:35:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ubsa_common.c,v 1.15 2021/06/13 09:29:38 mlelstv Exp $"); #include #include @@ -316,8 +316,10 @@ ubsa_flow(struct ubsa_softc *sc, int por value = 0; if (cflag & CRTSCTS) value |= UBSA_FLOW_OCTS | UBSA_FLOW_IRTS; - if (iflag & (IXON|IXOFF)) - value |= UBSA_FLOW_OXON | UBSA_FLOW_IXON; + if (iflag & IXOFF) + value |= UBSA_FLOW_OXON; + if (iflag & IXON) + value |= UBSA_FLOW_IXON; ubsa_request(sc, portno, UBSA_SET_FLOW_CTRL, value); }
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 09:28:23 UTC 2021 Modified Files: src/sys/dev/usb: uthum.c Log Message: Fix envsys detach paths. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/usb/uthum.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/uthum.c diff -u src/sys/dev/usb/uthum.c:1.20 src/sys/dev/usb/uthum.c:1.21 --- src/sys/dev/usb/uthum.c:1.20 Sat Mar 14 02:35:33 2020 +++ src/sys/dev/usb/uthum.c Sun Jun 13 09:28:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: uthum.c,v 1.20 2020/03/14 02:35:33 christos Exp $ */ +/* $NetBSD: uthum.c,v 1.21 2021/06/13 09:28:23 mlelstv Exp $ */ /* $OpenBSD: uthum.c,v 1.6 2010/01/03 18:43:02 deraadt Exp $ */ /* @@ -22,7 +22,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uthum.c,v 1.20 2020/03/14 02:35:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uthum.c,v 1.21 2021/06/13 09:28:23 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -206,12 +206,14 @@ uthum_attach(device_t parent, device_t s sc->sc_sme->sme_refresh = uthum_refresh; if (sysmon_envsys_register(sc->sc_sme)) { + sysmon_envsys_destroy(sc->sc_sme); + sc->sc_sme = NULL; aprint_error_dev(self, "unable to register with sysmon\n"); - sysmon_envsys_destroy(sc->sc_sme); } } else { sysmon_envsys_destroy(sc->sc_sme); + sc->sc_sme = NULL; } DPRINTF(("uthum_attach: complete\n")); @@ -225,9 +227,8 @@ uthum_detach(device_t self, int flags) sc->sc_dying = 1; - if (sc->sc_num_sensors > 0) { + if (sc->sc_sme != NULL) sysmon_envsys_unregister(sc->sc_sme); - } usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_hdev.sc_dev);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 09:27:20 UTC 2021 Modified Files: src/sys/dev/usb: uhso.c Log Message: Remove duplicate. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/usb/uhso.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/uhso.c diff -u src/sys/dev/usb/uhso.c:1.34 src/sys/dev/usb/uhso.c:1.35 --- src/sys/dev/usb/uhso.c:1.34 Sat Mar 14 02:35:33 2020 +++ src/sys/dev/usb/uhso.c Sun Jun 13 09:27:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: uhso.c,v 1.34 2020/03/14 02:35:33 christos Exp $ */ +/* $NetBSD: uhso.c,v 1.35 2021/06/13 09:27:20 mlelstv Exp $ */ /*- * Copyright (c) 2009 Iain Hibbert @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uhso.c,v 1.34 2020/03/14 02:35:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhso.c,v 1.35 2021/06/13 09:27:20 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -233,7 +233,6 @@ struct uhso_dev { #define UHSOTYPE_CONFIG 3 Static const struct uhso_dev uhso_devs[] = { -{ USB_VENDOR_OPTIONNV, USB_PRODUCT_OPTIONNV_MAXHSDPA,UHSOTYPE_DEFAULT }, { USB_VENDOR_OPTIONNV, USB_PRODUCT_OPTIONNV_GSICON72,UHSOTYPE_DEFAULT }, { USB_VENDOR_OPTIONNV, USB_PRODUCT_OPTIONNV_ICON225, UHSOTYPE_DEFAULT }, { USB_VENDOR_OPTIONNV, USB_PRODUCT_OPTIONNV_GEHSUPA, UHSOTYPE_DEFAULT },
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 09:26:24 UTC 2021 Modified Files: src/sys/dev/usb: if_kue.c Log Message: Align product name. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/dev/usb/if_kue.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_kue.c diff -u src/sys/dev/usb/if_kue.c:1.104 src/sys/dev/usb/if_kue.c:1.105 --- src/sys/dev/usb/if_kue.c:1.104 Sat Mar 21 06:55:22 2020 +++ src/sys/dev/usb/if_kue.c Sun Jun 13 09:26:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_kue.c,v 1.104 2020/03/21 06:55:22 skrll Exp $ */ +/* $NetBSD: if_kue.c,v 1.105 2021/06/13 09:26:24 mlelstv Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -71,7 +71,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.104 2020/03/21 06:55:22 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.105 2021/06/13 09:26:24 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -131,7 +131,7 @@ static const struct usb_devno kue_devs[] { USB_VENDOR_ABOCOM, USB_PRODUCT_ABOCOM_URE450 }, { USB_VENDOR_ADS, USB_PRODUCT_ADS_UBS10BT }, { USB_VENDOR_ADS, USB_PRODUCT_ADS_UBS10BTX }, - { USB_VENDOR_ACTIONTEC, USB_PRODUCT_ACTIONTEC_KL5KUSB101 }, + { USB_VENDOR_ACTIONTEC, USB_PRODUCT_ACTIONTEC_AR9287 }, { USB_VENDOR_ALLIEDTELESYN, USB_PRODUCT_ALLIEDTELESYN_AT_USB10 }, { USB_VENDOR_AOX, USB_PRODUCT_AOX_USB101 }, { USB_VENDOR_ASANTE, USB_PRODUCT_ASANTE_EA },
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 09:24:33 UTC 2021 Modified Files: src/sys/dev/usb: if_zyd.c Log Message: Remove duplicate To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/dev/usb/if_zyd.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_zyd.c diff -u src/sys/dev/usb/if_zyd.c:1.59 src/sys/dev/usb/if_zyd.c:1.60 --- src/sys/dev/usb/if_zyd.c:1.59 Sun Mar 15 23:04:51 2020 +++ src/sys/dev/usb/if_zyd.c Sun Jun 13 09:24:33 2021 @@ -1,5 +1,5 @@ /* $OpenBSD: if_zyd.c,v 1.52 2007/02/11 00:08:04 jsg Exp $ */ -/* $NetBSD: if_zyd.c,v 1.59 2020/03/15 23:04:51 thorpej Exp $ */ +/* $NetBSD: if_zyd.c,v 1.60 2021/06/13 09:24:33 mlelstv Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.59 2020/03/15 23:04:51 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.60 2021/06/13 09:24:33 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -141,8 +141,7 @@ static const struct zyd_type { ZYD_ZD1211B_DEV(SITECOMEU, ZD1211B), ZYD_ZD1211B_DEV(SONY, IFU_WLM2), ZYD_ZD1211B_DEV(UMEDIA, TEW429UBC1), - ZYD_ZD1211B_DEV(UNKNOWN1, ZD1211B_1), - ZYD_ZD1211B_DEV(UNKNOWN1, ZD1211B_2), + ZYD_ZD1211B_DEV(UNKNOWN1, ZD1211B), ZYD_ZD1211B_DEV(UNKNOWN2, ZD1211B), ZYD_ZD1211B_DEV(UNKNOWN3, ZD1211B), ZYD_ZD1211B_DEV(USR, USR5423),
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 09:23:42 UTC 2021 Modified Files: src/sys/dev/usb: usbdevs Log Message: Correct some vendor names, remove duplicates. To generate a diff of this commit: cvs rdiff -u -r1.793 -r1.794 src/sys/dev/usb/usbdevs 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/usbdevs diff -u src/sys/dev/usb/usbdevs:1.793 src/sys/dev/usb/usbdevs:1.794 --- src/sys/dev/usb/usbdevs:1.793 Mon Mar 15 07:29:26 2021 +++ src/sys/dev/usb/usbdevs Sun Jun 13 09:23:42 2021 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.793 2021/03/15 07:29:26 nia Exp $ +$NetBSD: usbdevs,v 1.794 2021/06/13 09:23:42 mlelstv Exp $ /*- * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -430,7 +430,6 @@ vendor ADDONICS2 0x0bf6 Addonics Technol vendor FSC 0x0bf8 Fujitsu Siemens Computers vendor AGATE 0x0c08 Agate Technologies vendor DMI 0x0c0b DMI -vendor CHICONY2 0x0c45 Chicony Electronics vendor MICRODIA 0x0c45 Microdia / Sonix Technology Co., Ltd. vendor SEALEVEL 0x0c52 Sealevel System vendor LUWEN 0x0c76 EasyDisk @@ -445,7 +444,7 @@ vendor CMEDIA 0x0d8c C-Media Electronic vendor CONCEPTRONIC2 0x0d8e Conceptronic vendor MSI 0x0db0 Micro Star vendor ELCON 0x0db7 ELCON Systemtechnik -vendor UNKNOWN5 0x0dcd Unknown Vendor +vendor NETWORKFAB 0x0dcd NetworkFab Corporation vendor SITECOMEU 0x0df6 Sitecom Europe vendor AMIGO 0x0e0b Amigo Technology vendor HAWKING 0x0e66 Hawking @@ -571,7 +570,6 @@ vendor PARA 0x20b8 PARA Industrial vendor TRENDNET 0x20f4 TRENDnet vendor RTSYS 0x2100 RT Systems vendor DLINK3 0x2101 D-Link -vendor INTENSO 0x2109 INTENSO vendor VIALABS 0x2109 VIA Labs vendor ERICSSON 0x2282 Ericsson vendor MOTOROLA2 0x22b8 Motorola @@ -729,7 +727,6 @@ product ACERW WARPLINK 0x0204 Warplink product ACTIONTEC PRISM_25 0x0408 Prism2.5 WLAN product ACTIONTEC PRISM_25A 0x0421 Prism2.5 WLAN A product ACTIONTEC AR9287 0x1200 AR9287+AR7010 -product ACTIONTEC KL5KUSB101 0x1200 KL5KUSB101 USB Ethernet adapter product ACTIONTEC FREELAN 0x6106 ROPEX FreeLan 802.11b product ACTIONTEC UAT1 0x7605 UAT1 Wireless Ethernet adapter @@ -1182,8 +1179,10 @@ product CHICONY RTL8188CUS_3 0xaff9 RTL8 product CHICONY RTL8188CUS_4 0xaffa RTL8188CUS product CHICONY RTL8188CUS_5 0xaffb RTL8188CUS product CHICONY RTL8188CUS_6 0xaffc RTL8188CUS -product CHICONY2 TWINKLECAM 0x600d TwinkleCam USB camera -product CHICONY2 BWC35HL01 0x602c Buffalo WBC-35H/L01 + +/* Microdia / Sonix products */ +product MICRODIA TWINKLECAM 0x600d TwinkleCam USB camera +product MICRODIA BWC35HL01 0x602c Buffalo WBC-35H/L01 /* CH Products */ product CHPRODUCTS PROTHROTTLE 0x00f1 Pro Throttle @@ -2592,7 +2591,6 @@ product OPTIONNV QUADUMTS2 0x6000 GlobeT product OPTIONNV QUADUMTS 0x6300 GlobeTrotter Fusion Quad Lite 3D product OPTIONNV QUADPLUSUMTS 0x6600 GlobeTrotter 3G Quad Plus product OPTIONNV HSDPA 0x6701 GlobeTrotter HSDPA Modem -product OPTIONNV MAXHSDPA 0x6701 GlobeTrotter Max HSDPA Modem product OPTIONNV GSICON72 0x6911 GlobeSurfer iCON 7.2 product OPTIONNV ICON225 0x6971 iCON 225 product OPTIONNV GTMAXHSUPA 0x7001 GlobeTrotter HSUPA @@ -3463,8 +3461,7 @@ product UMEDIA ALL0298V2 0x3204 ALL0298 product UNIACCESS PANACHE 0x0101 Panache Surf USB ISDN Adapter /* Unknown vendor 1 */ -product UNKNOWN1 ZD1211B_1 0x5301 ZD1211B -product UNKNOWN1 ZD1211B_2 0x5301 ZD1211B +product UNKNOWN1 ZD1211B 0x5301 ZD1211B /* Unknown vendor 2 */ product UNKNOWN2 ZD1211B 0x0105 ZD1211B @@ -3473,8 +3470,8 @@ product UNKNOWN2 NW3100 0x145f NW-3100 /* Unknown vendor 3 */ product UNKNOWN3 ZD1211B 0x1233 ZD1211B -/* Unknown vendor 5 */ -product UNKNOWN5 NF_RIC 0x0001 NF RIC +/* NetworkFab Corporation products */ +product NETWORKFAB NF_RIC 0x0001 NF RIC /* U.S. Robotics products */ product USR USR1120 0x00eb USR1120 WLAN
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 09:12:24 UTC 2021 Modified Files: src/sys/dev/usb: usb_subr.c Log Message: Fix last patch. To generate a diff of this commit: cvs rdiff -u -r1.263 -r1.264 src/sys/dev/usb/usb_subr.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/usb_subr.c diff -u src/sys/dev/usb/usb_subr.c:1.263 src/sys/dev/usb/usb_subr.c:1.264 --- src/sys/dev/usb/usb_subr.c:1.263 Sun Jun 13 08:50:33 2021 +++ src/sys/dev/usb/usb_subr.c Sun Jun 13 09:12:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.263 2021/06/13 08:50:33 mlelstv Exp $ */ +/* $NetBSD: usb_subr.c,v 1.264 2021/06/13 09:12:24 mlelstv 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 -__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.263 2021/06/13 08:50:33 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.264 2021/06/13 09:12:24 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -421,7 +421,7 @@ usbd_iface_init(struct usbd_device *dev, static void usbd_iface_fini(struct usbd_device *dev, int ifaceidx) { - struct usbd_interface *ifc = >ud_ifaces[ifaceidx] __diagused; + struct usbd_interface *ifc __diagused = >ud_ifaces[ifaceidx]; KASSERT(ifc->ui_dev == dev); KASSERT(ifc->ui_idesc == NULL);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 08:50:33 UTC 2021 Modified Files: src/sys/dev/usb: usb_subr.c Log Message: Use correct integer lengths for properties. Change property names vendor -> vendor-id, product -> product-id to match other users. To generate a diff of this commit: cvs rdiff -u -r1.262 -r1.263 src/sys/dev/usb/usb_subr.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/usb_subr.c diff -u src/sys/dev/usb/usb_subr.c:1.262 src/sys/dev/usb/usb_subr.c:1.263 --- src/sys/dev/usb/usb_subr.c:1.262 Sun Jun 13 08:48:29 2021 +++ src/sys/dev/usb/usb_subr.c Sun Jun 13 08:50:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.262 2021/06/13 08:48:29 mlelstv Exp $ */ +/* $NetBSD: usb_subr.c,v 1.263 2021/06/13 08:50:33 mlelstv 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 -__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.262 2021/06/13 08:48:29 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.263 2021/06/13 08:50:33 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -421,7 +421,7 @@ usbd_iface_init(struct usbd_device *dev, static void usbd_iface_fini(struct usbd_device *dev, int ifaceidx) { - struct usbd_interface *ifc __diagused = >ud_ifaces[ifaceidx]; + struct usbd_interface *ifc = >ud_ifaces[ifaceidx] __diagused; KASSERT(ifc->ui_dev == dev); KASSERT(ifc->ui_idesc == NULL); @@ -1067,12 +1067,12 @@ usbd_properties(device_t dv, struct usbd vendor = UGETW(dd->idVendor); product = UGETW(dd->idProduct); - prop_dictionary_set_uint16(dict, "class", class); - prop_dictionary_set_uint16(dict, "subclass", subclass); + prop_dictionary_set_uint8(dict, "class", class); + prop_dictionary_set_uint8(dict, "subclass", subclass); prop_dictionary_set_uint16(dict, "release", release); - prop_dictionary_set_uint16(dict, "proto", proto); - prop_dictionary_set_uint16(dict, "vendor", vendor); - prop_dictionary_set_uint16(dict, "product", product); + prop_dictionary_set_uint8(dict, "proto", proto); + prop_dictionary_set_uint16(dict, "vendor-id", vendor); + prop_dictionary_set_uint16(dict, "product-id", product); if (dev->ud_vendor) { prop_dictionary_set_string(dict,
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 08:48:29 UTC 2021 Modified Files: src/sys/dev/usb: usb_subr.c Log Message: Fix non-DIAGNOSTIC build. To generate a diff of this commit: cvs rdiff -u -r1.261 -r1.262 src/sys/dev/usb/usb_subr.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/usb_subr.c diff -u src/sys/dev/usb/usb_subr.c:1.261 src/sys/dev/usb/usb_subr.c:1.262 --- src/sys/dev/usb/usb_subr.c:1.261 Sun Jun 13 00:13:24 2021 +++ src/sys/dev/usb/usb_subr.c Sun Jun 13 08:48:29 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.261 2021/06/13 00:13:24 riastradh Exp $ */ +/* $NetBSD: usb_subr.c,v 1.262 2021/06/13 08:48:29 mlelstv 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 -__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.261 2021/06/13 00:13:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.262 2021/06/13 08:48:29 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -421,7 +421,7 @@ usbd_iface_init(struct usbd_device *dev, static void usbd_iface_fini(struct usbd_device *dev, int ifaceidx) { - struct usbd_interface *ifc = >ud_ifaces[ifaceidx]; + struct usbd_interface *ifc __diagused = >ud_ifaces[ifaceidx]; KASSERT(ifc->ui_dev == dev); KASSERT(ifc->ui_idesc == NULL);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 07:51:09 UTC 2021 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Don't use aprint* for non-autoconf errors. Also print status value. To generate a diff of this commit: cvs rdiff -u -r1.170 -r1.171 src/sys/dev/usb/uaudio.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/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.170 src/sys/dev/usb/uaudio.c:1.171 --- src/sys/dev/usb/uaudio.c:1.170 Sun Jun 13 07:49:43 2021 +++ src/sys/dev/usb/uaudio.c Sun Jun 13 07:51:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.170 2021/06/13 07:49:43 mlelstv Exp $ */ +/* $NetBSD: uaudio.c,v 1.171 2021/06/13 07:51:09 mlelstv Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.170 2021/06/13 07:49:43 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.171 2021/06/13 07:51:09 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -2835,8 +2835,9 @@ uaudio_chan_pintr(struct usbd_xfer *xfer count, ch->transferred); #ifdef DIAGNOSTIC if (count != cb->size) { - aprint_error("uaudio_chan_pintr: count(%d) != size(%d)\n", - count, cb->size); + device_printf(ch->sc->sc_dev, + "uaudio_chan_pintr: count(%d) != size(%d), status(%d)\n", + count, cb->size, status); } #endif @@ -2918,8 +2919,9 @@ uaudio_chan_rintr(struct usbd_xfer *xfer /* count < cb->size is normal for asynchronous source */ #ifdef DIAGNOSTIC if (count > cb->size) { - aprint_error("uaudio_chan_rintr: count(%d) > size(%d)\n", - count, cb->size); + device_printf(ch->sc->sc_dev, + "uaudio_chan_rintr: count(%d) > size(%d) status(%d)\n", + count, cb->size, status); } #endif
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 07:49:43 UTC 2021 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Don't ignore detach errors from children. To generate a diff of this commit: cvs rdiff -u -r1.169 -r1.170 src/sys/dev/usb/uaudio.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/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.169 src/sys/dev/usb/uaudio.c:1.170 --- src/sys/dev/usb/uaudio.c:1.169 Mon Feb 15 13:39:18 2021 +++ src/sys/dev/usb/uaudio.c Sun Jun 13 07:49:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.169 2021/02/15 13:39:18 isaki Exp $ */ +/* $NetBSD: uaudio.c,v 1.170 2021/06/13 07:49:43 mlelstv Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.169 2021/02/15 13:39:18 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.170 2021/06/13 07:49:43 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -519,7 +519,7 @@ static int uaudio_detach(device_t self, int flags) { struct uaudio_softc *sc = device_private(self); - int rv = 0; + int rv; sc->sc_dying = 1; @@ -529,8 +529,11 @@ uaudio_detach(device_t self, int flags) uaudio_halt_out_dma_unlocked(sc); uaudio_halt_in_dma_unlocked(sc); - if (sc->sc_audiodev != NULL) + if (sc->sc_audiodev != NULL) { rv = config_detach(sc->sc_audiodev, flags); + if (rv) + return rv; + } usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev); @@ -541,7 +544,7 @@ uaudio_detach(device_t self, int flags) mutex_destroy(>sc_lock); mutex_destroy(>sc_intr_lock); - return rv; + return 0; } Static int