Module Name: src
Committed By: mrg
Date: Mon Aug 19 07:20:07 UTC 2019
Modified Files:
src/sys/dev/usb: if_urtwn.c
Log Message:
move the call to rnd_attach_source() earlier and add a matching
call to rnd_detach_source() into detach.
fixes an attach-detach-reattach issue where the rnd source was
already known.
To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/usb/if_urtwn.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_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.71 src/sys/dev/usb/if_urtwn.c:1.72
--- src/sys/dev/usb/if_urtwn.c:1.71 Thu Jul 25 14:31:35 2019
+++ src/sys/dev/usb/if_urtwn.c Mon Aug 19 07:20:07 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_urtwn.c,v 1.71 2019/07/25 14:31:35 msaitoh Exp $ */
+/* $NetBSD: if_urtwn.c,v 1.72 2019/08/19 07:20:07 mrg Exp $ */
/* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */
/*-
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.71 2019/07/25 14:31:35 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.72 2019/08/19 07:20:07 mrg Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -390,6 +390,9 @@ urtwn_attach(device_t parent, device_t s
callout_init(&sc->sc_calib_to, 0);
callout_setfunc(&sc->sc_calib_to, urtwn_calib_to, sc);
+ rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
+ RND_TYPE_NET, RND_FLAG_DEFAULT);
+
error = usbd_set_config_no(sc->sc_udev, 1, 0);
if (error != 0) {
aprint_error_dev(self, "failed to set configuration"
@@ -513,8 +516,6 @@ urtwn_attach(device_t parent, device_t s
ifp->if_percpuq = if_percpuq_create(ifp);
if_register(ifp);
- rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
- RND_TYPE_NET, RND_FLAG_DEFAULT);
ieee80211_announce(ic);
@@ -569,6 +570,8 @@ urtwn_detach(device_t self, int flags)
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev);
+ rnd_detach_source(&sc->rnd_source);
+
callout_destroy(&sc->sc_scan_to);
callout_destroy(&sc->sc_calib_to);