Module Name: src Committed By: martin Date: Tue Apr 16 18:59:49 UTC 2024
Modified Files: src/sys/dev/usb [netbsd-10]: ugen.c Log Message: Pull up following revision(s) (requested by thorpej in ticket #651): sys/dev/usb/ugen.c: revision 1.177 ugen and ugenif share the same /dev/ugenN.xx namespace in such a way that the device unit number does not necessarily match the /dev/ugenN.xx unit number (N). If you ONLY have ugen devices, it happens to work out and devpubd scripts can be extremely naive. If you ONLY have ugenif devices, it also happens to work out, but your devpubd scripts have to slightly more informed. If you have a mix of ugen AND ugenif devices, though, you're pretty much out of luck. So, this change adds a "ugen-unit" device property which devpubd scripts can query to determine which /dev/ugenN.xx nodes a given ugen or ugenif device is using. To generate a diff of this commit: cvs rdiff -u -r1.171.2.1 -r1.171.2.2 src/sys/dev/usb/ugen.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/ugen.c diff -u src/sys/dev/usb/ugen.c:1.171.2.1 src/sys/dev/usb/ugen.c:1.171.2.2 --- src/sys/dev/usb/ugen.c:1.171.2.1 Tue Apr 16 18:45:39 2024 +++ src/sys/dev/usb/ugen.c Tue Apr 16 18:59:49 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ugen.c,v 1.171.2.1 2024/04/16 18:45:39 martin Exp $ */ +/* $NetBSD: ugen.c,v 1.171.2.2 2024/04/16 18:59:49 martin Exp $ */ /* * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.171.2.1 2024/04/16 18:45:39 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.171.2.2 2024/04/16 18:59:49 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -229,12 +229,18 @@ ugenif_get_unit(struct ugen_softc *sc) KASSERT(sc0 == sc); KASSERT(rb_tree_find_node(&ugenif.tree, &i) == sc); mutex_exit(&ugenif.lock); + + prop_dictionary_set_uint(device_properties(sc->sc_dev), + "ugen-unit", sc->sc_unit); } static void ugenif_put_unit(struct ugen_softc *sc) { + prop_dictionary_remove(device_properties(sc->sc_dev), + "ugen-unit"); + mutex_enter(&ugenif.lock); KASSERT(rb_tree_find_node(&ugenif.tree, &sc->sc_unit) == sc); rb_tree_remove_node(&ugenif.tree, sc);