summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authortls <tls@NetBSD.org>2012-02-02 19:42:57 +0000
committertls <tls@NetBSD.org>2012-02-02 19:42:57 +0000
commitcc9ee3de3e25ef31d3a97dc35bedc36945e35d2a (patch)
tree06a2889eb6b4b02bc8b8bba6b5cc3f9b1938d18b /sys/dev/usb
parentf622122a62827e27b444c2f95632d61f73357ced (diff)
Entropy-pool implementation move and cleanup.
1) Move core entropy-pool code and source/sink/sample management code to sys/kern from sys/dev. 2) Remove use of NRND as test for presence of entropy-pool code throughout source tree. 3) Remove use of RND_ENABLED in device drivers as microoptimization to avoid expensive operations on disabled entropy sources; make the rnd_add calls do this directly so all callers benefit. 4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might have lead to slight entropy overestimation for some sources. 5) Add new source types for environmental sensors, power sensors, VM system events, and skew between clocks, with a sample implementation for each. ok releng to go in before the branch due to the difficulty of later pullup (widespread #ifdef removal and moved files). Tested with release builds on amd64 and evbarm and live testing on amd64.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/if_aue.c11
-rw-r--r--sys/dev/usb/if_auereg.h4
-rw-r--r--sys/dev/usb/if_axe.c11
-rw-r--r--sys/dev/usb/if_axereg.h4
-rw-r--r--sys/dev/usb/if_cdce.c6
-rw-r--r--sys/dev/usb/if_cdcereg.h4
-rw-r--r--sys/dev/usb/if_cue.c11
-rw-r--r--sys/dev/usb/if_cuereg.h4
-rw-r--r--sys/dev/usb/if_kue.c11
-rw-r--r--sys/dev/usb/if_kuereg.h4
-rw-r--r--sys/dev/usb/if_udav.c11
-rw-r--r--sys/dev/usb/if_udavreg.h4
-rw-r--r--sys/dev/usb/if_upl.c13
-rw-r--r--sys/dev/usb/if_url.c11
-rw-r--r--sys/dev/usb/if_urlreg.h4
-rw-r--r--sys/dev/usb/ucom.c17
-rw-r--r--sys/dev/usb/uhidev.c12
-rw-r--r--sys/dev/usb/uhidev.h8
18 files changed, 33 insertions, 117 deletions
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index 77e6eec31ce..7142b9bba15 100644
--- a/sys/dev/usb/if_aue.c
+++ b/sys/dev/usb/if_aue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_aue.c,v 1.123 2011/12/23 00:51:43 jakllsch Exp $ */
+/* $NetBSD: if_aue.c,v 1.124 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
@@ -77,10 +77,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.123 2011/12/23 00:51:43 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.124 2012/02/02 19:43:07 tls Exp $");
#include "opt_inet.h"
-#include "rnd.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -91,9 +90,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.123 2011/12/23 00:51:43 jakllsch Exp $"
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/device.h>
-#if NRND > 0
#include <sys/rnd.h>
-#endif
#include <net/if.h>
#include <net/if_arp.h>
@@ -857,10 +854,8 @@ aue_attach(device_t parent, device_t self, void *aux)
/* Attach the interface. */
if_attach(ifp);
ether_ifattach(ifp, eaddr);
-#if NRND > 0
rnd_attach_source(&sc->rnd_source, device_xname(sc->aue_dev),
RND_TYPE_NET, 0);
-#endif
callout_init(&(sc->aue_stat_ch), 0);
@@ -910,9 +905,7 @@ aue_detach(device_t self, int flags)
if (ifp->if_flags & IFF_RUNNING)
aue_stop(sc);
-#if NRND > 0
rnd_detach_source(&sc->rnd_source);
-#endif
mii_detach(&sc->aue_mii, MII_PHY_ANY, MII_OFFSET_ANY);
ifmedia_delete_instance(&sc->aue_mii.mii_media, IFM_INST_ANY);
ether_ifdetach(ifp);
diff --git a/sys/dev/usb/if_auereg.h b/sys/dev/usb/if_auereg.h
index 56f9839f8df..283f6730a21 100644
--- a/sys/dev/usb/if_auereg.h
+++ b/sys/dev/usb/if_auereg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: if_auereg.h,v 1.24 2011/11/19 22:51:24 tls Exp $ */
+/* $NetBSD: if_auereg.h,v 1.25 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
@@ -228,9 +228,7 @@ struct aue_softc {
struct ethercom aue_ec;
struct mii_data aue_mii;
-#if NRND > 0
krndsource_t rnd_source;
-#endif
struct lwp *aue_thread;
int aue_closing;
kcondvar_t aue_domc;
diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c
index 61b02e9a4ec..6e707c7e70f 100644
--- a/sys/dev/usb/if_axe.c
+++ b/sys/dev/usb/if_axe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_axe.c,v 1.50 2011/08/25 02:29:08 pgoyette Exp $ */
+/* $NetBSD: if_axe.c,v 1.51 2012/02/02 19:43:07 tls Exp $ */
/* $OpenBSD: if_axe.c,v 1.96 2010/01/09 05:33:08 jsg Exp $ */
/*
@@ -89,12 +89,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.50 2011/08/25 02:29:08 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.51 2012/02/02 19:43:07 tls Exp $");
#if defined(__NetBSD__)
#ifndef _MODULE
#include "opt_inet.h"
-#include "rnd.h"
#endif
#endif
@@ -110,9 +109,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.50 2011/08/25 02:29:08 pgoyette Exp $")
#include <sys/sockio.h>
#include <sys/systm.h>
-#if NRND > 0
#include <sys/rnd.h>
-#endif
#include <net/if.h>
#include <net/if_dl.h>
@@ -727,10 +724,8 @@ axe_attach(device_t parent, device_t self, void *aux)
/* Attach the interface. */
if_attach(ifp);
ether_ifattach(ifp, eaddr);
-#if NRND > 0
rnd_attach_source(&sc->rnd_source, device_xname(sc->axe_dev),
RND_TYPE_NET, 0);
-#endif
callout_init(&sc->axe_stat_ch, 0);
callout_setfunc(&sc->axe_stat_ch, axe_tick, sc);
@@ -769,9 +764,7 @@ axe_detach(device_t self, int flags)
callout_destroy(&sc->axe_stat_ch);
mutex_destroy(&sc->axe_mii_lock);
-#if NRND > 0
rnd_detach_source(&sc->rnd_source);
-#endif
mii_detach(&sc->axe_mii, MII_PHY_ANY, MII_OFFSET_ANY);
ifmedia_delete_instance(&sc->axe_mii.mii_media, IFM_INST_ANY);
ether_ifdetach(ifp);
diff --git a/sys/dev/usb/if_axereg.h b/sys/dev/usb/if_axereg.h
index cb3d55fd0d4..65741a87474 100644
--- a/sys/dev/usb/if_axereg.h
+++ b/sys/dev/usb/if_axereg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: if_axereg.h,v 1.13 2011/11/19 22:51:24 tls Exp $ */
+/* $NetBSD: if_axereg.h,v 1.14 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003
@@ -199,9 +199,7 @@ struct axe_softc {
device_t axe_dev;
struct ethercom axe_ec;
struct mii_data axe_mii;
-#if NRND > 0
krndsource_t rnd_source;
-#endif
usbd_device_handle axe_udev;
usbd_interface_handle axe_iface;
diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c
index fadd67ecaf7..450aee6a8aa 100644
--- a/sys/dev/usb/if_cdce.c
+++ b/sys/dev/usb/if_cdce.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cdce.c,v 1.34 2012/01/10 11:32:25 ws Exp $ */
+/* $NetBSD: if_cdce.c,v 1.35 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com>
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.34 2012/01/10 11:32:25 ws Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.35 2012/02/02 19:43:07 tls Exp $");
#ifdef __NetBSD__
#include "opt_inet.h"
#endif
@@ -54,9 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.34 2012/01/10 11:32:25 ws Exp $");
#include <sys/socket.h>
#include <sys/device.h>
-#if NRND > 0
#include <sys/rnd.h>
-#endif
#include <net/if.h>
#include <net/if_arp.h>
diff --git a/sys/dev/usb/if_cdcereg.h b/sys/dev/usb/if_cdcereg.h
index 90f2da7be4e..0ee49902302 100644
--- a/sys/dev/usb/if_cdcereg.h
+++ b/sys/dev/usb/if_cdcereg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cdcereg.h,v 1.6 2011/11/19 22:51:24 tls Exp $ */
+/* $NetBSD: if_cdcereg.h,v 1.7 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com>
@@ -68,9 +68,7 @@ struct cdce_cdata {
struct cdce_softc {
device_t cdce_dev;
struct ethercom cdce_ec;
-#if NRND > 0
krndsource_t rnd_source;
-#endif
#define GET_IFP(sc) (&(sc)->cdce_ec.ec_if)
usbd_device_handle cdce_udev;
usbd_interface_handle cdce_ctl_iface;
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index b889e28c21c..f5c32815a5d 100644
--- a/sys/dev/usb/if_cue.c
+++ b/sys/dev/usb/if_cue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cue.c,v 1.60 2010/11/03 22:28:31 dyoung Exp $ */
+/* $NetBSD: if_cue.c,v 1.61 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
@@ -56,11 +56,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.60 2010/11/03 22:28:31 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.61 2012/02/02 19:43:07 tls Exp $");
#if defined(__NetBSD__)
#include "opt_inet.h"
-#include "rnd.h"
#elif defined(__OpenBSD__)
#include "bpfilter.h"
#endif /* defined(__OpenBSD__) */
@@ -77,9 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.60 2010/11/03 22:28:31 dyoung Exp $");
#include <sys/socket.h>
#include <sys/device.h>
-#if NRND > 0
#include <sys/rnd.h>
-#endif
#include <net/if.h>
#if defined(__NetBSD__)
@@ -578,10 +575,8 @@ cue_attach(device_t parent, device_t self, void *aux)
/* Attach the interface. */
if_attach(ifp);
ether_ifattach(ifp, eaddr);
-#if NRND > 0
rnd_attach_source(&sc->rnd_source, device_xname(sc->cue_dev),
RND_TYPE_NET, 0);
-#endif
callout_init(&(sc->cue_stat_ch), 0);
@@ -621,9 +616,7 @@ cue_detach(device_t self, int flags)
cue_stop(sc);
#if defined(__NetBSD__)
-#if NRND > 0
rnd_detach_source(&sc->rnd_source);
-#endif
ether_ifdetach(ifp);
#endif /* __NetBSD__ */
diff --git a/sys/dev/usb/if_cuereg.h b/sys/dev/usb/if_cuereg.h
index f5d53b894d4..12cff48710e 100644
--- a/sys/dev/usb/if_cuereg.h
+++ b/sys/dev/usb/if_cuereg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cuereg.h,v 1.17 2011/11/19 22:51:24 tls Exp $ */
+/* $NetBSD: if_cuereg.h,v 1.18 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
@@ -168,9 +168,7 @@ struct cue_softc {
device_t cue_dev;
struct ethercom cue_ec;
-#if NRND > 0
krndsource_t rnd_source;
-#endif
#define GET_IFP(sc) (&(sc)->cue_ec.ec_if)
struct callout cue_stat_ch;
diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c
index 0e1d76ceee8..cae16cfdfa9 100644
--- a/sys/dev/usb/if_kue.c
+++ b/sys/dev/usb/if_kue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_kue.c,v 1.74 2010/11/03 22:28:31 dyoung Exp $ */
+/* $NetBSD: if_kue.c,v 1.75 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
@@ -70,10 +70,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.74 2010/11/03 22:28:31 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.75 2012/02/02 19:43:07 tls Exp $");
#include "opt_inet.h"
-#include "rnd.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -85,9 +84,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.74 2010/11/03 22:28:31 dyoung Exp $");
#include <sys/device.h>
#include <sys/proc.h>
-#if NRND > 0
#include <sys/rnd.h>
-#endif
#include <net/if.h>
#include <net/if_arp.h>
@@ -507,10 +504,8 @@ kue_attach(device_t parent, device_t self, void *aux)
/* Attach the interface. */
if_attach(ifp);
ether_ifattach(ifp, sc->kue_desc.kue_macaddr);
-#if NRND > 0
rnd_attach_source(&sc->rnd_source, device_xname(sc->kue_dev),
RND_TYPE_NET, 0);
-#endif
sc->kue_attached = true;
splx(s);
@@ -544,9 +539,7 @@ kue_detach(device_t self, int flags)
if (ifp->if_flags & IFF_RUNNING)
kue_stop(sc);
-#if NRND > 0
rnd_detach_source(&sc->rnd_source);
-#endif
ether_ifdetach(ifp);
if_detach(ifp);
diff --git a/sys/dev/usb/if_kuereg.h b/sys/dev/usb/if_kuereg.h
index 5920c98e4b1..4f6385bdd37 100644
--- a/sys/dev/usb/if_kuereg.h
+++ b/sys/dev/usb/if_kuereg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: if_kuereg.h,v 1.17 2011/11/19 22:51:24 tls Exp $ */
+/* $NetBSD: if_kuereg.h,v 1.18 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
@@ -162,9 +162,7 @@ struct kue_softc {
device_t kue_dev;
struct ethercom kue_ec;
-#if NRND > 0
krndsource_t rnd_source;
-#endif
#define GET_IFP(sc) (&(sc)->kue_ec.ec_if)
usbd_device_handle kue_udev;
diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c
index 85e645a8a19..3df65c323b7 100644
--- a/sys/dev/usb/if_udav.c
+++ b/sys/dev/usb/if_udav.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_udav.c,v 1.33 2011/12/23 00:51:43 jakllsch Exp $ */
+/* $NetBSD: if_udav.c,v 1.34 2012/02/02 19:43:07 tls Exp $ */
/* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */
/*
* Copyright (c) 2003
@@ -44,10 +44,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.33 2011/12/23 00:51:43 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.34 2012/02/02 19:43:07 tls Exp $");
#include "opt_inet.h"
-#include "rnd.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -56,9 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.33 2011/12/23 00:51:43 jakllsch Exp $"
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/device.h>
-#if NRND > 0
#include <sys/rnd.h>
-#endif
#include <net/if.h>
#include <net/if_arp.h>
@@ -306,10 +303,8 @@ udav_attach(device_t parent, device_t self, void *aux)
if_attach(ifp);
ether_ifattach(ifp, eaddr);
-#if NRND > 0
rnd_attach_source(&sc->rnd_source, device_xname(self),
RND_TYPE_NET, 0);
-#endif
callout_init(&sc->sc_stat_ch, 0);
sc->sc_attached = 1;
@@ -353,9 +348,7 @@ udav_detach(device_t self, int flags)
if (ifp->if_flags & IFF_RUNNING)
udav_stop(GET_IFP(sc), 1);
-#if NRND > 0
rnd_detach_source(&sc->rnd_source);
-#endif
mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY);
ether_ifdetach(ifp);
diff --git a/sys/dev/usb/if_udavreg.h b/sys/dev/usb/if_udavreg.h
index 9aa6f1b2513..c9a58c88be6 100644
--- a/sys/dev/usb/if_udavreg.h
+++ b/sys/dev/usb/if_udavreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: if_udavreg.h,v 1.7 2011/11/19 22:51:24 tls Exp $ */
+/* $NetBSD: if_udavreg.h,v 1.8 2012/02/02 19:43:07 tls Exp $ */
/* $nabe: if_udavreg.h,v 1.2 2003/08/21 16:26:40 nabe Exp $ */
/*
* Copyright (c) 2003
@@ -189,9 +189,7 @@ struct udav_softc {
kmutex_t sc_mii_lock;
int sc_link;
#define sc_media udav_mii.mii_media
-#if NRND > 0
krndsource_t rnd_source;
-#endif
struct udav_cdata sc_cdata;
int sc_attached;
diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c
index 67b0b056621..72d1a3da527 100644
--- a/sys/dev/usb/if_upl.c
+++ b/sys/dev/usb/if_upl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_upl.c,v 1.41 2011/12/23 00:51:44 jakllsch Exp $ */
+/* $NetBSD: if_upl.c,v 1.42 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -34,10 +34,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.41 2011/12/23 00:51:44 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.42 2012/02/02 19:43:07 tls Exp $");
#include "opt_inet.h"
-#include "rnd.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -49,9 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.41 2011/12/23 00:51:44 jakllsch Exp $")
#include <sys/socket.h>
#include <sys/device.h>
-#if NRND > 0
#include <sys/rnd.h>
-#endif
#include <net/if.h>
#include <net/if_types.h>
@@ -134,9 +131,7 @@ struct upl_softc {
device_t sc_dev;
struct ifnet sc_if;
-#if NRND > 0
krndsource_t sc_rnd_source;
-#endif
struct callout sc_stat_ch;
@@ -312,10 +307,8 @@ upl_attach(device_t parent, device_t self, void *aux)
if_alloc_sadl(ifp);
bpf_attach(ifp, DLT_RAW, 0);
-#if NRND > 0
rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev),
RND_TYPE_NET, 0);
-#endif
sc->sc_attached = 1;
splx(s);
@@ -346,9 +339,7 @@ upl_detach(device_t self, int flags)
if (ifp->if_flags & IFF_RUNNING)
upl_stop(sc);
-#if NRND > 0
rnd_detach_source(&sc->sc_rnd_source);
-#endif
bpf_detach(ifp);
if_detach(ifp);
diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c
index 39adf451506..15981001652 100644
--- a/sys/dev/usb/if_url.c
+++ b/sys/dev/usb/if_url.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_url.c,v 1.40 2011/12/23 00:51:44 jakllsch Exp $ */
+/* $NetBSD: if_url.c,v 1.41 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 2001, 2002
* Shingo WATANABE <nabe@nabechan.org>. All rights reserved.
@@ -43,10 +43,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.40 2011/12/23 00:51:44 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.41 2012/02/02 19:43:07 tls Exp $");
#include "opt_inet.h"
-#include "rnd.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -56,9 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.40 2011/12/23 00:51:44 jakllsch Exp $")
#include <sys/socket.h>
#include <sys/device.h>
-#if NRND > 0
#include <sys/rnd.h>
-#endif
#include <net/if.h>
#include <net/if_arp.h>
@@ -313,10 +310,8 @@ url_attach(device_t parent, device_t self, void *aux)
if_attach(ifp);
ether_ifattach(ifp, eaddr);
-#if NRND > 0
rnd_attach_source(&sc->rnd_source, device_xname(self),
RND_TYPE_NET, 0);
-#endif
callout_init(&sc->sc_stat_ch, 0);
sc->sc_attached = 1;
@@ -361,9 +356,7 @@ url_detach(device_t self, int flags)
if (ifp->if_flags & IFF_RUNNING)
url_stop(GET_IFP(sc), 1);
-#if NRND > 0
rnd_detach_source(&sc->rnd_source);
-#endif
mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY);
ether_ifdetach(ifp);
diff --git a/sys/dev/usb/if_urlreg.h b/sys/dev/usb/if_urlreg.h
index 8a0ed59fb0d..80dd5139fde 100644
--- a/sys/dev/usb/if_urlreg.h
+++ b/sys/dev/usb/if_urlreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: if_urlreg.h,v 1.7 2011/11/19 22:51:24 tls Exp $ */
+/* $NetBSD: if_urlreg.h,v 1.8 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 2001, 2002
* Shingo WATANABE <nabe@nabechan.org>. All rights reserved.
@@ -175,9 +175,7 @@ struct url_softc {
krwlock_t sc_mii_rwlock;
int sc_link;
#define sc_media url_mii.mii_media
-#if NRND > 0
krndsource_t rnd_source;
-#endif
struct url_cdata sc_cdata;
int sc_attached;
diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c
index 8b67c31b34d..3021dd58b4d 100644
--- a/sys/dev/usb/ucom.c
+++ b/sys/dev/usb/ucom.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ucom.c,v 1.96 2012/01/14 20:51:00 jakllsch Exp $ */
+/* $NetBSD: ucom.c,v 1.97 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.96 2012/01/14 20:51:00 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.97 2012/02/02 19:43:07 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -51,11 +51,8 @@ __KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.96 2012/01/14 20:51:00 jakllsch Exp $");
#include <sys/queue.h>
#include <sys/kauth.h>
#if defined(__NetBSD__)
-#include "rnd.h"
-#if NRND > 0
#include <sys/rnd.h>
#endif
-#endif
#include <dev/usb/usb.h>
@@ -146,9 +143,7 @@ struct ucom_softc {
int sc_refcnt;
u_char sc_dying; /* disconnecting */
-#if defined(__NetBSD__) && NRND > 0
krndsource_t sc_rndsource; /* random source */
-#endif
};
dev_type_open(ucomopen);
@@ -246,7 +241,7 @@ ucom_attach(device_t parent, device_t self, void *aux)
DPRINTF(("ucom_attach: tty_attach %p\n", tp));
tty_attach(tp);
-#if defined(__NetBSD__) && NRND > 0
+#if defined(__NetBSD__)
rnd_attach_source(&sc->sc_rndsource, device_xname(sc->sc_dev),
RND_TYPE_TTY, 0);
#endif
@@ -320,7 +315,7 @@ ucom_detach(device_t self, int flags)
}
/* Detach the random source */
-#if defined(__NetBSD__) && NRND > 0
+#if defined(__NetBSD__)
rnd_detach_source(&sc->sc_rndsource);
#endif
@@ -1074,7 +1069,7 @@ ucom_write_status(struct ucom_softc *sc, struct ucom_buffer *ub,
break;
case USBD_NORMAL_COMPLETION:
usbd_get_xfer_status(ub->ub_xfer, NULL, NULL, &cc, NULL);
-#if defined(__NetBSD__) && NRND > 0
+#if defined(__NetBSD__)
rnd_add_uint32(&sc->sc_rndsource, cc);
#endif
/*FALLTHROUGH*/
@@ -1259,7 +1254,7 @@ ucomreadcb(usbd_xfer_handle xfer, usbd_private_handle p, usbd_status status)
KDASSERT(cp == ub->ub_data);
-#if defined(__NetBSD__) && NRND > 0
+#if defined(__NetBSD__)
rnd_add_uint32(&sc->sc_rndsource, cc);
#endif
diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c
index 7cad557360b..623d479923a 100644
--- a/sys/dev/usb/uhidev.c
+++ b/sys/dev/usb/uhidev.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uhidev.c,v 1.54 2011/12/23 00:51:46 jakllsch Exp $ */
+/* $NetBSD: uhidev.c,v 1.55 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.54 2011/12/23 00:51:46 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.55 2012/02/02 19:43:07 tls Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -354,11 +354,9 @@ nomem:
return;
}
#endif
-#if NRND > 0
rnd_attach_source(&csc->rnd_source,
device_xname(dev),
RND_TYPE_TTY, 0);
-#endif
}
}
}
@@ -428,9 +426,7 @@ uhidev_detach(device_t self, int flags)
{
struct uhidev_softc *sc = device_private(self);
int i, rv;
-#if NRND > 0
struct uhidev *csc;
-#endif
DPRINTF(("uhidev_detach: sc=%p flags=%d\n", sc, flags));
@@ -444,10 +440,8 @@ uhidev_detach(device_t self, int flags)
rv = 0;
for (i = 0; i < sc->sc_nrepid; i++) {
if (sc->sc_subdevs[i] != NULL) {
-#if NRND > 0
csc = device_private(sc->sc_subdevs[i]);
rnd_detach_source(&csc->rnd_source);
-#endif
rv |= config_detach(sc->sc_subdevs[i], flags);
}
}
@@ -522,9 +516,7 @@ uhidev_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status)
device_xname(sc->sc_dev)));
return;
}
-#if NRND > 0
rnd_add_uint32(&scd->rnd_source, (uintptr_t)(sc->sc_ibuf));
-#endif
scd->sc_intr(scd, p, cc);
}
diff --git a/sys/dev/usb/uhidev.h b/sys/dev/usb/uhidev.h
index 425189f0eec..678296bc4ba 100644
--- a/sys/dev/usb/uhidev.h
+++ b/sys/dev/usb/uhidev.h
@@ -1,4 +1,4 @@
-/* $NetBSD: uhidev.h,v 1.11 2011/11/19 22:51:24 tls Exp $ */
+/* $NetBSD: uhidev.h,v 1.12 2012/02/02 19:43:07 tls Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,10 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "rnd.h"
-#if NRND > 0
+
#include <sys/rnd.h>
-#endif
struct uhidev_softc {
device_t sc_dev; /* base device */
@@ -67,9 +65,7 @@ struct uhidev {
int sc_in_rep_size;
#define UHIDEV_OPEN 0x01 /* device is open */
void (*sc_intr)(struct uhidev *, void *, u_int);
-#if NRND > 0
krndsource_t rnd_source;
-#endif
};
struct uhidev_attach_arg {