Module Name:    src
Committed By:   mrg
Date:           Fri Feb 24 06:48:29 UTC 2012

Modified Files:
        src/sys/dev/usb: hid.c if_axe.c if_cdce.c if_cue.c uaudio.c ubsa.c
            ubsa_common.c ucom.c ugen.c uhcivar.h uhid.c ukbd.c ukyopon.c
            ulpt.c umass.c umodem.c urio.c usb_mem.c usb_mem.h usbdi.h
            uscanner.c uvscom.c

Log Message:
remove any remnants of freebsd/openbsd code.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/usb/hid.c
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/usb/if_axe.c src/sys/dev/usb/usb_mem.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/usb/if_cdce.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/usb/if_cue.c
cvs rdiff -u -r1.128 -r1.129 src/sys/dev/usb/uaudio.c
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/usb/ubsa.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/ubsa_common.c
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/usb/ucom.c
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/usb/ugen.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/usb/uhcivar.h
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/usb/uhid.c
cvs rdiff -u -r1.115 -r1.116 src/sys/dev/usb/ukbd.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/usb/ukyopon.c
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/usb/ulpt.c
cvs rdiff -u -r1.141 -r1.142 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/usb/umodem.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/usb/urio.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/usb/usb_mem.h src/sys/dev/usb/uvscom.c
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/usb/usbdi.h
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/usb/uscanner.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/hid.c
diff -u src/sys/dev/usb/hid.c:1.34 src/sys/dev/usb/hid.c:1.35
--- src/sys/dev/usb/hid.c:1.34	Fri Dec 23 00:51:43 2011
+++ src/sys/dev/usb/hid.c	Fri Feb 24 06:48:23 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: hid.c,v 1.34 2011/12/23 00:51:43 jakllsch Exp $	*/
+/*	$NetBSD: hid.c,v 1.35 2012/02/24 06:48:23 mrg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/hid.c,v 1.11 1999/11/17 22:33:39 n_hibma Exp $ */
 
 /*
@@ -32,13 +32,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.34 2011/12/23 00:51:43 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.35 2012/02/24 06:48:23 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#if defined(__NetBSD__)
 #include <sys/kernel.h>
-#endif
 #include <sys/malloc.h>
 
 #include <dev/usb/usb.h>

Index: src/sys/dev/usb/if_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.51 src/sys/dev/usb/if_axe.c:1.52
--- src/sys/dev/usb/if_axe.c:1.51	Thu Feb  2 19:43:07 2012
+++ src/sys/dev/usb/if_axe.c	Fri Feb 24 06:48:23 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axe.c,v 1.51 2012/02/02 19:43:07 tls Exp $	*/
+/*	$NetBSD: if_axe.c,v 1.52 2012/02/24 06:48:23 mrg Exp $	*/
 /*	$OpenBSD: if_axe.c,v 1.96 2010/01/09 05:33:08 jsg Exp $ */
 
 /*
@@ -89,14 +89,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.51 2012/02/02 19:43:07 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.52 2012/02/24 06:48:23 mrg Exp $");
 
-#if defined(__NetBSD__)
-#ifndef _MODULE
+#if defined(_KERNEL_OPT)
 #include "opt_inet.h"
 #endif
-#endif
-
 
 #include <sys/param.h>
 #include <sys/bus.h>
Index: src/sys/dev/usb/usb_mem.c
diff -u src/sys/dev/usb/usb_mem.c:1.51 src/sys/dev/usb/usb_mem.c:1.52
--- src/sys/dev/usb/usb_mem.c:1.51	Fri Jan 27 18:53:09 2012
+++ src/sys/dev/usb/usb_mem.c	Fri Feb 24 06:48:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_mem.c,v 1.51 2012/01/27 18:53:09 para Exp $	*/
+/*	$NetBSD: usb_mem.c,v 1.52 2012/02/24 06:48:27 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.51 2012/01/27 18:53:09 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.52 2012/02/24 06:48:27 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -52,10 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 
 #include <sys/device.h>		/* for usbdivar.h */
 #include <sys/bus.h>
 #include <sys/cpu.h>
-
-#ifdef __NetBSD__
 #include <sys/extent.h>
-#endif
 
 #ifdef DIAGNOSTIC
 #include <sys/proc.h>
@@ -349,7 +346,6 @@ usb_syncmem(usb_dma_t *p, bus_addr_t off
 }
 
 
-#ifdef __NetBSD__
 usbd_status
 usb_reserve_allocm(struct usb_dma_reserve *rs, usb_dma_t *dma, u_int32_t size)
 {
@@ -451,4 +447,3 @@ usb_setup_reserve(device_t dv, struct us
 
 	return error;
 }
-#endif

Index: src/sys/dev/usb/if_cdce.c
diff -u src/sys/dev/usb/if_cdce.c:1.35 src/sys/dev/usb/if_cdce.c:1.36
--- src/sys/dev/usb/if_cdce.c:1.35	Thu Feb  2 19:43:07 2012
+++ src/sys/dev/usb/if_cdce.c	Fri Feb 24 06:48:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cdce.c,v 1.35 2012/02/02 19:43:07 tls Exp $ */
+/*	$NetBSD: if_cdce.c,v 1.36 2012/02/24 06:48:24 mrg Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <[email protected]>
@@ -41,8 +41,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.35 2012/02/02 19:43:07 tls Exp $");
-#ifdef	__NetBSD__
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.36 2012/02/24 06:48:24 mrg Exp $");
+
+#if defined(_KERNEL_OPT)
 #include "opt_inet.h"
 #endif
 

Index: src/sys/dev/usb/if_cue.c
diff -u src/sys/dev/usb/if_cue.c:1.61 src/sys/dev/usb/if_cue.c:1.62
--- src/sys/dev/usb/if_cue.c:1.61	Thu Feb  2 19:43:07 2012
+++ src/sys/dev/usb/if_cue.c	Fri Feb 24 06:48:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cue.c,v 1.61 2012/02/02 19:43:07 tls Exp $	*/
+/*	$NetBSD: if_cue.c,v 1.62 2012/02/24 06:48:24 mrg Exp $	*/
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
  *	Bill Paul <[email protected]>.  All rights reserved.
@@ -56,19 +56,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.61 2012/02/02 19:43:07 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.62 2012/02/24 06:48:24 mrg Exp $");
 
-#if defined(__NetBSD__)
 #include "opt_inet.h"
-#elif defined(__OpenBSD__)
-#include "bpfilter.h"
-#endif /* defined(__OpenBSD__) */
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#if !defined(__OpenBSD__)
 #include <sys/callout.h>
-#endif
 #include <sys/sockio.h>
 #include <sys/mbuf.h>
 #include <sys/malloc.h>
@@ -79,31 +73,15 @@ __KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1
 #include <sys/rnd.h>
 
 #include <net/if.h>
-#if defined(__NetBSD__)
 #include <net/if_arp.h>
-#endif
 #include <net/if_dl.h>
-
 #include <net/bpf.h>
-
-#if defined(__NetBSD__)
 #include <net/if_ether.h>
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/if_inarp.h>
-#endif
-#endif /* defined(__NetBSD__) */
 
-#if defined(__OpenBSD__)
 #ifdef INET
 #include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/in_var.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
+#include <netinet/if_inarp.h>
 #endif
-#endif /* defined(__OpenBSD__) */
-
 
 #include <dev/usb/usb.h>
 #include <dev/usb/usbdi.h>
@@ -401,11 +379,7 @@ allmulti:
 		sc->cue_mctab[i] = 0;
 
 	/* now program new ones */
-#if defined(__NetBSD__)
 	ETHER_FIRST_MULTI(step, &sc->cue_ec, enm);
-#else
-	ETHER_FIRST_MULTI(step, &sc->arpcom, enm);
-#endif
 	while (enm != NULL) {
 		if (memcmp(enm->enm_addrlo,
 		    enm->enm_addrhi, ETHER_ADDR_LEN) != 0)
@@ -565,9 +539,6 @@ cue_attach(device_t parent, device_t sel
 	ifp->if_ioctl = cue_ioctl;
 	ifp->if_start = cue_start;
 	ifp->if_watchdog = cue_watchdog;
-#if defined(__OpenBSD__)
-	ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
-#endif
 	strncpy(ifp->if_xname, device_xname(sc->cue_dev), IFNAMSIZ);
 
 	IFQ_SET_READY(&ifp->if_snd);
@@ -615,10 +586,8 @@ cue_detach(device_t self, int flags)
 	if (ifp->if_flags & IFF_RUNNING)
 		cue_stop(sc);
 
-#if defined(__NetBSD__)
 	rnd_detach_source(&sc->rnd_source);
 	ether_ifdetach(ifp);
-#endif /* __NetBSD__ */
 
 	if_detach(ifp);
 
@@ -1041,11 +1010,7 @@ cue_init(void *xsc)
 	cue_csr_write_1(sc, CUE_ADVANCED_OPMODES,
 	    CUE_AOP_EMBED_RXLEN | 0x03); /* 1 wait state */
 
-#if defined(__OpenBSD__)
-	eaddr = sc->arpcom.ac_enaddr;
-#elif defined(__NetBSD__)
 	eaddr = CLLADDR(ifp->if_sadl);
-#endif
 	/* Set MAC address */
 	for (i = 0; i < ETHER_ADDR_LEN; i++)
 		cue_csr_write_1(sc, CUE_PAR0 - i, eaddr[i]);
@@ -1159,11 +1124,7 @@ cue_ioctl(struct ifnet *ifp, u_long comm
 		switch (ifa->ifa_addr->sa_family) {
 #ifdef INET
 		case AF_INET:
-#if defined(__NetBSD__)
 			arp_ifinit(ifp, ifa);
-#else
-			arp_ifinit(&sc->arpcom, ifa);
-#endif
 			break;
 #endif /* INET */
 		}

Index: src/sys/dev/usb/uaudio.c
diff -u src/sys/dev/usb/uaudio.c:1.128 src/sys/dev/usb/uaudio.c:1.129
--- src/sys/dev/usb/uaudio.c:1.128	Fri Dec 23 00:51:44 2011
+++ src/sys/dev/usb/uaudio.c	Fri Feb 24 06:48:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uaudio.c,v 1.128 2011/12/23 00:51:44 jakllsch Exp $	*/
+/*	$NetBSD: uaudio.c,v 1.129 2012/02/24 06:48:24 mrg Exp $	*/
 
 /*
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.128 2011/12/23 00:51:44 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.129 2012/02/24 06:48:24 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -497,11 +497,7 @@ uaudio_attach(device_t parent, device_t 
 			   sc->sc_dev);
 
 	DPRINTF("%s", "doing audio_attach_mi\n");
-#if defined(__OpenBSD__)
-	audio_attach_mi(&uaudio_hw_if, sc, &sc->sc_dev);
-#else
 	sc->sc_audiodev = audio_attach_mi(&uaudio_hw_if, sc, sc->sc_dev);
-#endif
 
 	return;
 }

Index: src/sys/dev/usb/ubsa.c
diff -u src/sys/dev/usb/ubsa.c:1.29 src/sys/dev/usb/ubsa.c:1.30
--- src/sys/dev/usb/ubsa.c:1.29	Fri Dec 23 00:51:45 2011
+++ src/sys/dev/usb/ubsa.c	Fri Feb 24 06:48:24 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsa.c,v 1.29 2011/12/23 00:51:45 jakllsch Exp $	*/
+/*	$NetBSD: ubsa.c,v 1.30 2012/02/24 06:48:24 mrg Exp $	*/
 /*-
  * Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>.
  * All rights reserved.
@@ -54,25 +54,18 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.29 2011/12/23 00:51:45 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.30 2012/02/24 06:48:24 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
-#ifdef __FreeBSD__
-#include <sys/bus.h>
-#endif
 #include <sys/ioccom.h>
 #include <sys/fcntl.h>
 #include <sys/conf.h>
 #include <sys/tty.h>
 #include <sys/file.h>
-#if __FreeBSD_version >= 500014
-#include <sys/selinfo.h>
-#else
 #include <sys/select.h>
-#endif
 #include <sys/proc.h>
 #include <sys/device.h>
 #include <sys/poll.h>
@@ -91,11 +84,6 @@ __KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.2
 
 #ifdef UBSA_DEBUG
 int		ubsadebug = 0;
-#ifdef __FreeBSD__
-SYSCTL_NODE(_hw_usb, OID_AUTO, ubsa, CTLFLAG_RW, 0, "USB ubsa");
-SYSCTL_INT(_hw_usb_ubsa, OID_AUTO, debug, CTLFLAG_RW,
-	   &ubsadebug, 0, "ubsa debug level");
-#endif
 
 #define	DPRINTFN(n, x)	do { \
 				if (ubsadebug > (n)) \

Index: src/sys/dev/usb/ubsa_common.c
diff -u src/sys/dev/usb/ubsa_common.c:1.7 src/sys/dev/usb/ubsa_common.c:1.8
--- src/sys/dev/usb/ubsa_common.c:1.7	Fri Dec 23 00:51:45 2011
+++ src/sys/dev/usb/ubsa_common.c	Fri Feb 24 06:48:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsa_common.c,v 1.7 2011/12/23 00:51:45 jakllsch Exp $	*/
+/*	$NetBSD: ubsa_common.c,v 1.8 2012/02/24 06:48:25 mrg Exp $	*/
 /*-
  * Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>.
  * All rights reserved.
@@ -54,25 +54,18 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ubsa_common.c,v 1.7 2011/12/23 00:51:45 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsa_common.c,v 1.8 2012/02/24 06:48:25 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
-#ifdef __FreeBSD__
-#include <sys/bus.h>
-#endif
 #include <sys/ioccom.h>
 #include <sys/fcntl.h>
 #include <sys/conf.h>
 #include <sys/tty.h>
 #include <sys/file.h>
-#if __FreeBSD_version >= 500014
-#include <sys/selinfo.h>
-#else
 #include <sys/select.h>
-#endif
 #include <sys/proc.h>
 #include <sys/device.h>
 #include <sys/poll.h>

Index: src/sys/dev/usb/ucom.c
diff -u src/sys/dev/usb/ucom.c:1.97 src/sys/dev/usb/ucom.c:1.98
--- src/sys/dev/usb/ucom.c:1.97	Thu Feb  2 19:43:07 2012
+++ src/sys/dev/usb/ucom.c	Fri Feb 24 06:48:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucom.c,v 1.97 2012/02/02 19:43:07 tls Exp $	*/
+/*	$NetBSD: ucom.c,v 1.98 2012/02/24 06:48:25 mrg 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.97 2012/02/02 19:43:07 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.98 2012/02/24 06:48:25 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -50,9 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.9
 #include <sys/poll.h>
 #include <sys/queue.h>
 #include <sys/kauth.h>
-#if defined(__NetBSD__)
 #include <sys/rnd.h>
-#endif
 
 #include <dev/usb/usb.h>
 
@@ -241,10 +239,8 @@ ucom_attach(device_t parent, device_t se
 	DPRINTF(("ucom_attach: tty_attach %p\n", tp));
 	tty_attach(tp);
 
-#if defined(__NetBSD__)
 	rnd_attach_source(&sc->sc_rndsource, device_xname(sc->sc_dev),
 			  RND_TYPE_TTY, 0);
-#endif
 
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");
@@ -315,9 +311,7 @@ ucom_detach(device_t self, int flags)
 	}
 
 	/* Detach the random source */
-#if defined(__NetBSD__)
 	rnd_detach_source(&sc->sc_rndsource);
-#endif
 
 	return (0);
 }
@@ -1069,9 +1063,7 @@ ucom_write_status(struct ucom_softc *sc,
 		break;
 	case USBD_NORMAL_COMPLETION:
 		usbd_get_xfer_status(ub->ub_xfer, NULL, NULL, &cc, NULL);
-#if defined(__NetBSD__)
 		rnd_add_uint32(&sc->sc_rndsource, cc);
-#endif
 		/*FALLTHROUGH*/
 	default:
 		SIMPLEQ_REMOVE_HEAD(&sc->sc_obuff_full, ub_link);
@@ -1254,9 +1246,7 @@ ucomreadcb(usbd_xfer_handle xfer, usbd_p
 
 	KDASSERT(cp == ub->ub_data);
 
-#if defined(__NetBSD__)
 	rnd_add_uint32(&sc->sc_rndsource, cc);
-#endif
 
 	if (sc->sc_opening) {
 		ucomsubmitread(sc, ub);

Index: src/sys/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.116 src/sys/dev/usb/ugen.c:1.117
--- src/sys/dev/usb/ugen.c:1.116	Fri Dec 23 00:51:46 2011
+++ src/sys/dev/usb/ugen.c	Fri Feb 24 06:48:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.116 2011/12/23 00:51:46 jakllsch Exp $	*/
+/*	$NetBSD: ugen.c,v 1.117 2012/02/24 06:48:25 mrg 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.116 2011/12/23 00:51:46 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.117 2012/02/24 06:48:25 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 
@@ -45,17 +45,8 @@ __KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.1
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 #include <sys/device.h>
 #include <sys/ioctl.h>
-#elif defined(__FreeBSD__)
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/ioccom.h>
-#include <sys/conf.h>
-#include <sys/fcntl.h>
-#include <sys/filio.h>
-#endif
 #include <sys/conf.h>
 #include <sys/tty.h>
 #include <sys/file.h>
@@ -133,7 +124,6 @@ struct ugen_softc {
 	u_char sc_dying;
 };
 
-#if defined(__NetBSD__)
 dev_type_open(ugenopen);
 dev_type_close(ugenclose);
 dev_type_read(ugenread);
@@ -146,35 +136,6 @@ const struct cdevsw ugen_cdevsw = {
 	ugenopen, ugenclose, ugenread, ugenwrite, ugenioctl,
 	nostop, notty, ugenpoll, nommap, ugenkqfilter, D_OTHER,
 };
-#elif defined(__OpenBSD__)
-cdev_decl(ugen);
-#elif defined(__FreeBSD__)
-d_open_t  ugenopen;
-d_close_t ugenclose;
-d_read_t  ugenread;
-d_write_t ugenwrite;
-d_ioctl_t ugenioctl;
-d_poll_t  ugenpoll;
-
-#define UGEN_CDEV_MAJOR	114
-
-Static struct cdevsw ugen_cdevsw = {
-	/* open */	ugenopen,
-	/* close */	ugenclose,
-	/* read */	ugenread,
-	/* write */	ugenwrite,
-	/* ioctl */	ugenioctl,
-	/* poll */	ugenpoll,
-	/* mmap */	nommap,
-	/* strategy */	nostrategy,
-	/* name */	"ugen",
-	/* maj */	UGEN_CDEV_MAJOR,
-	/* dump */	nodump,
-	/* psize */	nopsize,
-	/* flags */	0,
-	/* bmaj */	-1
-};
-#endif
 
 Static void ugenintr(usbd_xfer_handle xfer, usbd_private_handle addr,
 		     usbd_status status);
@@ -266,15 +227,6 @@ ugen_attach(device_t parent, device_t se
 		return;
 	}
 
-#ifdef __FreeBSD__
-	{
-		static int global_init_done = 0;
-		if (!global_init_done) {
-			cdevsw_add(&ugen_cdevsw);
-			global_init_done = 1;
-		}
-	}
-#endif
 	for (i = 0; i < USB_MAX_ENDPOINTS; i++) {
 		for (dir = OUT; dir <= IN; dir++) {
 			struct ugen_endpoint *sce;
@@ -993,7 +945,6 @@ ugenwrite(dev_t dev, struct uio *uio, in
 	return (error);
 }
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 int
 ugen_activate(device_t self, enum devact act)
 {
@@ -1007,7 +958,6 @@ ugen_activate(device_t self, enum devact
 		return EOPNOTSUPP;
 	}
 }
-#endif
 
 int 
 ugen_detach(device_t self, int flags)
@@ -1016,13 +966,9 @@ ugen_detach(device_t self, int flags)
 	struct ugen_endpoint *sce;
 	int i, dir;
 	int s;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 	int maj, mn;
 
 	DPRINTF(("ugen_detach: sc=%p flags=%d\n", sc, flags));
-#elif defined(__FreeBSD__)
-	DPRINTF(("ugen_detach: sc=%p\n", sc));
-#endif
 
 	sc->sc_dying = 1;
 	pmf_device_deregister(self);
@@ -1045,22 +991,12 @@ ugen_detach(device_t self, int flags)
 	}
 	splx(s);
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 	/* locate the major number */
-#if defined(__NetBSD__)
 	maj = cdevsw_lookup_major(&ugen_cdevsw);
-#elif defined(__OpenBSD__)
-	for (maj = 0; maj < nchrdev; maj++)
-		if (cdevsw[maj].d_open == ugenopen)
-			break;
-#endif
 
 	/* Nuke the vnodes for any open instances (calls close). */
 	mn = device_unit(self) * USB_MAX_ENDPOINTS;
 	vdevgone(maj, mn, mn + USB_MAX_ENDPOINTS - 1, VCHR);
-#elif defined(__FreeBSD__)
-	/* XXX not implemented yet */
-#endif
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
 			   sc->sc_dev);
@@ -2113,7 +2049,3 @@ ugenkqfilter(dev_t dev, struct knote *kn
 
 	return (0);
 }
-
-#if defined(__FreeBSD__)
-DRIVER_MODULE(ugen, uhub, ugen_driver, ugen_devclass, usbd_driver_load, 0);
-#endif

Index: src/sys/dev/usb/uhcivar.h
diff -u src/sys/dev/usb/uhcivar.h:1.48 src/sys/dev/usb/uhcivar.h:1.49
--- src/sys/dev/usb/uhcivar.h:1.48	Wed Nov  3 22:34:23 2010
+++ src/sys/dev/usb/uhcivar.h	Fri Feb 24 06:48:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhcivar.h,v 1.48 2010/11/03 22:34:23 dyoung Exp $	*/
+/*	$NetBSD: uhcivar.h,v 1.49 2012/02/24 06:48:25 mrg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhcivar.h,v 1.14 1999/11/17 22:33:42 n_hibma Exp $	*/
 
 /*
@@ -175,21 +175,14 @@ typedef struct uhci_softc {
 	char sc_vendor[32];		/* vendor string for root hub */
 	int sc_id_vendor;		/* vendor ID for root hub */
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 	device_t sc_child;		/* /dev/usb# device */
-#endif
-#ifdef __NetBSD__
 	struct usb_dma_reserve sc_dma_reserve;
-#endif
 } uhci_softc_t;
 
 usbd_status	uhci_init(uhci_softc_t *);
 int		uhci_intr(void *);
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 int		uhci_detach(uhci_softc_t *, int);
 void		uhci_childdet(device_t, device_t);
 int		uhci_activate(device_t, enum devact);
 bool		uhci_resume(device_t, const pmf_qual_t *);
 bool		uhci_suspend(device_t, const pmf_qual_t *);
-#endif
-

Index: src/sys/dev/usb/uhid.c
diff -u src/sys/dev/usb/uhid.c:1.84 src/sys/dev/usb/uhid.c:1.85
--- src/sys/dev/usb/uhid.c:1.84	Wed Nov  3 22:34:24 2010
+++ src/sys/dev/usb/uhid.c	Fri Feb 24 06:48:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhid.c,v 1.84 2010/11/03 22:34:24 dyoung Exp $	*/
+/*	$NetBSD: uhid.c,v 1.85 2012/02/24 06:48:25 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.84 2010/11/03 22:34:24 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.85 2012/02/24 06:48:25 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 
@@ -211,13 +211,7 @@ uhid_detach(device_t self, int flags)
 	}
 
 	/* locate the major number */
-#if defined(__NetBSD__)
 	maj = cdevsw_lookup_major(&uhid_cdevsw);
-#elif defined(__OpenBSD__)
-	for (maj = 0; maj < nchrdev; maj++)
-		if (cdevsw[maj].d_open == uhidopen)
-			break;
-#endif
 
 	/* Nuke the vnodes for any open instances (calls close). */
 	mn = device_unit(self);

Index: src/sys/dev/usb/ukbd.c
diff -u src/sys/dev/usb/ukbd.c:1.115 src/sys/dev/usb/ukbd.c:1.116
--- src/sys/dev/usb/ukbd.c:1.115	Fri Dec 23 00:51:47 2011
+++ src/sys/dev/usb/ukbd.c	Fri Feb 24 06:48:26 2012
@@ -1,4 +1,4 @@
-/*      $NetBSD: ukbd.c,v 1.115 2011/12/23 00:51:47 jakllsch Exp $        */
+/*      $NetBSD: ukbd.c,v 1.116 2012/02/24 06:48:26 mrg Exp $        */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.115 2011/12/23 00:51:47 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.116 2012/02/24 06:48:26 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -173,7 +173,7 @@ Static const struct ukbd_keycodetrans tr
 };
 #endif
 
-#if defined(__NetBSD__) && defined(WSDISPLAY_COMPAT_RAWKBD)
+#if defined(WSDISPLAY_COMPAT_RAWKBD)
 #define NN 0			/* no translation */
 /*
  * Translate USB keycodes to US keyboard XT scancodes.
@@ -220,7 +220,7 @@ Static const u_int8_t ukbd_trtab[256] = 
       NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* f0 - f7 */
       NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* f8 - ff */
 };
-#endif /* defined(__NetBSD__) && defined(WSDISPLAY_COMPAT_RAWKBD) */
+#endif /* defined(WSDISPLAY_COMPAT_RAWKBD) */
 
 #define KEY_ERROR 0x01
 
@@ -261,7 +261,6 @@ struct ukbd_softc {
 	struct hid_location sc_capsloc;
 	struct hid_location sc_scroloc;
 	int sc_leds;
-#if defined(__NetBSD__)
 	device_t sc_wskbddev;
 
 #if defined(WSDISPLAY_COMPAT_RAWKBD)
@@ -278,7 +277,6 @@ struct ukbd_softc {
 	int sc_spl;
 	int sc_npollchar;
 	u_int16_t sc_pollchars[MAXKEYS];
-#endif /* defined(__NetBSD__) */
 
 	u_char sc_dying;
 };
@@ -319,13 +317,11 @@ Static int	ukbd_is_console;
 Static void	ukbd_cngetc(void *, u_int *, int *);
 Static void	ukbd_cnpollc(void *, int);
 
-#if defined(__NetBSD__)
 const struct wskbd_consops ukbd_consops = {
 	ukbd_cngetc,
 	ukbd_cnpollc,
 	NULL,	/* bell */
 };
-#endif
 
 Static const char *ukbd_parse_desc(struct ukbd_softc *sc);
 
@@ -336,7 +332,6 @@ Static void	ukbd_delayed_decode(void *ad
 Static int	ukbd_enable(void *, int);
 Static void	ukbd_set_leds(void *, int);
 
-#if defined(__NetBSD__)
 Static int	ukbd_ioctl(void *, u_long, void *, int, struct lwp *);
 #if  defined(WSDISPLAY_COMPAT_RAWKBD) && defined(UKBD_REPEAT)
 Static void	ukbd_rawrepeat(void *v);
@@ -360,7 +355,6 @@ const struct wskbd_mapdata ukbd_keymapda
 	KB_US,
 #endif
 };
-#endif
 
 static int ukbd_match(device_t, cfdata_t, void *);
 static void ukbd_attach(device_t, device_t, void *);
@@ -395,11 +389,7 @@ ukbd_attach(device_t parent, device_t se
 	struct uhidev_attach_arg *uha = aux;
 	u_int32_t qflags;
 	const char *parseerr;
-#if defined(__NetBSD__)
 	struct wskbddev_attach_args a;
-#else
-	int i;
-#endif
 
 	sc->sc_hdev.sc_dev = self;
 	sc->sc_hdev.sc_intr = ukbd_intr;

Index: src/sys/dev/usb/ukyopon.c
diff -u src/sys/dev/usb/ukyopon.c:1.15 src/sys/dev/usb/ukyopon.c:1.16
--- src/sys/dev/usb/ukyopon.c:1.15	Fri Dec 23 00:51:47 2011
+++ src/sys/dev/usb/ukyopon.c	Fri Feb 24 06:48:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ukyopon.c,v 1.15 2011/12/23 00:51:47 jakllsch Exp $	*/
+/*	$NetBSD: ukyopon.c,v 1.16 2012/02/24 06:48:26 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998, 2005 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukyopon.c,v 1.15 2011/12/23 00:51:47 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukyopon.c,v 1.16 2012/02/24 06:48:26 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -188,9 +188,6 @@ int 
 ukyopon_detach(device_t self, int flags)
 {
 	struct ukyopon_softc *sc = device_private(self);
-#ifdef __FreeBSD__
-	int flags = 0;
-#endif
 
 	return umodem_common_detach(&sc->sc_umodem, flags);
 }

Index: src/sys/dev/usb/ulpt.c
diff -u src/sys/dev/usb/ulpt.c:1.88 src/sys/dev/usb/ulpt.c:1.89
--- src/sys/dev/usb/ulpt.c:1.88	Fri Dec 23 00:51:47 2011
+++ src/sys/dev/usb/ulpt.c	Fri Feb 24 06:48:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulpt.c,v 1.88 2011/12/23 00:51:47 jakllsch Exp $	*/
+/*	$NetBSD: ulpt.c,v 1.89 2012/02/24 06:48:26 mrg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/ulpt.c,v 1.24 1999/11/17 22:33:44 n_hibma Exp $	*/
 
 /*
@@ -36,21 +36,15 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ulpt.c,v 1.88 2011/12/23 00:51:47 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulpt.c,v 1.89 2012/02/24 06:48:26 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
 #include <sys/kernel.h>
 #include <sys/fcntl.h>
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 #include <sys/device.h>
 #include <sys/ioctl.h>
-#elif defined(__FreeBSD__)
-#include <sys/ioccom.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#endif
 #include <sys/uio.h>
 #include <sys/conf.h>
 #include <sys/vnode.h>
@@ -128,14 +122,8 @@ struct ulpt_softc {
 
 	int sc_refcnt;
 	u_char sc_dying;
-
-#if defined(__FreeBSD__)
-	dev_t dev;
-	dev_t dev_noprime;
-#endif
 };
 
-#if defined(__NetBSD__)
 dev_type_open(ulptopen);
 dev_type_close(ulptclose);
 dev_type_write(ulptwrite);
@@ -146,35 +134,6 @@ const struct cdevsw ulpt_cdevsw = {
 	ulptopen, ulptclose, ulptread, ulptwrite, ulptioctl,
 	nostop, notty, nopoll, nommap, nokqfilter, D_OTHER,
 };
-#elif defined(__OpenBSD__)
-cdev_decl(ulpt);
-#elif defined(__FreeBSD__)
-Static d_open_t ulptopen;
-Static d_close_t ulptclose;
-Static d_write_t ulptwrite;
-Static d_ioctl_t ulptioctl;
-
-#define ULPT_CDEV_MAJOR 113
-
-Static struct cdevsw ulpt_cdevsw = {
-	/* open */	ulptopen,
-	/* close */	ulptclose,
-	/* read */	noread,
-	/* write */	ulptwrite,
-	/* ioctl */	ulptioctl,
-	/* poll */	nopoll,
-	/* mmap */	nommap,
-	/* strategy */	nostrategy,
-	/* name */	"ulpt",
-	/* maj */	ULPT_CDEV_MAJOR,
-	/* dump */	nodump,
-	/* psize */	nopsize,
-	/* flags */	0,
-#if !defined(__FreeBSD__) || (__FreeBSD__ < 5)
-	/* bmaj */	-1
-#endif
-};
-#endif
 
 void ulpt_disco(void *);
 
@@ -350,14 +309,6 @@ ulpt_attach(device_t parent, device_t se
 	}
 #endif
 
-#if defined(__FreeBSD__)
-	sc->dev = make_dev(&ulpt_cdevsw, device_get_unit(self),
-		UID_ROOT, GID_OPERATOR, 0644, "ulpt%d", device_get_unit(self));
-	sc->dev_noprime = make_dev(&ulpt_cdevsw,
-		device_get_unit(self)|ULPT_NOPRIME,
-		UID_ROOT, GID_OPERATOR, 0644, "unlpt%d", device_get_unit(self));
-#endif
-
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
 			   sc->sc_dev);
 
@@ -367,7 +318,6 @@ ulpt_attach(device_t parent, device_t se
 	return;
 }
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 int
 ulpt_activate(device_t self, enum devact act)
 {
@@ -381,18 +331,13 @@ ulpt_activate(device_t self, enum devact
 		return EOPNOTSUPP;
 	}
 }
-#endif
 
 int 
 ulpt_detach(device_t self, int flags)
 {
 	struct ulpt_softc *sc = device_private(self);
 	int s;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 	int maj, mn;
-#elif defined(__FreeBSD__)
-	struct vnode *vp;
-#endif
 
 	DPRINTFN(1, ("ulpt_detach: sc=%p\n", sc));
 
@@ -410,31 +355,13 @@ ulpt_detach(device_t self, int flags)
 	}
 	splx(s);
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 	/* locate the major number */
-#if defined(__NetBSD__)
 	maj = cdevsw_lookup_major(&ulpt_cdevsw);
-#elif defined(__OpenBSD__)
-	for (maj = 0; maj < nchrdev; maj++)
-		if (cdevsw[maj].d_open == ulptopen)
-			break;
-#endif
 
 	/* Nuke the vnodes for any open instances (calls close). */
 	mn = device_unit(self);
 	vdevgone(maj, mn, mn, VCHR);
 	vdevgone(maj, mn | ULPT_NOPRIME , mn | ULPT_NOPRIME, VCHR);
-#elif defined(__FreeBSD__)
-	vp = SLIST_FIRST(&sc->dev->si_hlist);
-	if (vp)
-		VOP_REVOKE(vp, REVOKEALL);
-	vp = SLIST_FIRST(&sc->dev_noprime->si_hlist);
-	if (vp)
-		VOP_REVOKE(vp, REVOKEALL);
-
-	destroy_dev(sc->dev);
-	destroy_dev(sc->dev_noprime);
-#endif
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
 			   sc->sc_dev);
@@ -513,14 +440,6 @@ ulptopen(dev_t dev, int flag, int mode, 
 	sc->sc_flags = flags;
 	DPRINTFN(2, ("ulptopen: flags=0x%x\n", (unsigned)flags));
 
-#if defined(ULPT_DEBUG) && defined(__FreeBSD__)
-	/* Ignoring these flags might not be a good idea */
-	if ((flags & ~ULPT_NOPRIME) != 0)
-		printf("ulptopen: flags ignored: %b\n", flags,
-			"\20\3POS_INIT\4POS_ACK\6PRIME_OPEN\7AUTOLF\10BYPASS");
-#endif
-
-
 	error = 0;
 	sc->sc_refcnt++;
 
@@ -1001,7 +920,3 @@ ieee1284_print_id(char *str)
 	}
 }
 #endif
-
-#if defined(__FreeBSD__)
-DRIVER_MODULE(ulpt, uhub, ulpt_driver, ulpt_devclass, usbd_driver_load, 0);
-#endif

Index: src/sys/dev/usb/umass.c
diff -u src/sys/dev/usb/umass.c:1.141 src/sys/dev/usb/umass.c:1.142
--- src/sys/dev/usb/umass.c:1.141	Wed Aug 24 11:28:50 2011
+++ src/sys/dev/usb/umass.c	Fri Feb 24 06:48:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.141 2011/08/24 11:28:50 mbalmer Exp $	*/
+/*	$NetBSD: umass.c,v 1.142 2012/02/24 06:48:26 mrg Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.141 2011/08/24 11:28:50 mbalmer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.142 2012/02/24 06:48:26 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_umass.h"
@@ -138,17 +138,9 @@ __KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/conf.h>
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 #include <sys/buf.h>
 #include <sys/device.h>
 #include <sys/malloc.h>
-#undef KASSERT
-#define KASSERT(cond, msg)
-#elif defined(__FreeBSD__)
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <machine/clock.h>
-#endif
 
 #include <dev/usb/usb.h>
 #include <dev/usb/usbdi.h>
@@ -656,7 +648,8 @@ umass_childdet(device_t self, device_t c
 {
 	struct umass_softc *sc = device_private(self);
 
-	KASSERT(child == sc->bus->sc_child, ("assertion child == sc->bus->sc_child failed\n"));
+	KASSERTMSG(child == sc->bus->sc_child,
+		   "assertion child == sc->bus->sc_child failed\n");
 	sc->bus->sc_child = NULL;
 }
 
@@ -849,9 +842,9 @@ umass_reset(struct umass_softc *sc, tran
 Static void
 umass_bbb_reset(struct umass_softc *sc, int status)
 {
-	KASSERT(sc->sc_wire & UMASS_WPROTO_BBB,
-		("sc->sc_wire == 0x%02x wrong for umass_bbb_reset\n",
-		sc->sc_wire));
+	KASSERTMSG(sc->sc_wire & UMASS_WPROTO_BBB,
+		   "sc->sc_wire == 0x%02x wrong for umass_bbb_reset\n",
+		   sc->sc_wire);
 
 	if (sc->sc_dying)
 		return;
@@ -898,9 +891,9 @@ umass_bbb_transfer(struct umass_softc *s
 	DPRINTF(UDMASS_BBB,("%s: umass_bbb_transfer cmd=0x%02x\n",
 		device_xname(sc->sc_dev), *(u_char *)cmd));
 
-	KASSERT(sc->sc_wire & UMASS_WPROTO_BBB,
-		("sc->sc_wire == 0x%02x wrong for umass_bbb_transfer\n",
-		sc->sc_wire));
+	KASSERTMSG(sc->sc_wire & UMASS_WPROTO_BBB,
+		   "sc->sc_wire == 0x%02x wrong for umass_bbb_transfer\n",
+		   sc->sc_wire);
 
 	if (sc->sc_dying)
 		return;
@@ -929,25 +922,27 @@ umass_bbb_transfer(struct umass_softc *s
 	 */
 
 	/* check the given arguments */
-	KASSERT(datalen == 0 || data != NULL,
-		("%s: datalen > 0, but no buffer",device_xname(sc->sc_dev)));
-	KASSERT(cmdlen <= CBWCDBLENGTH,
-		("%s: cmdlen exceeds CDB length in CBW (%d > %d)",
-			device_xname(sc->sc_dev), cmdlen, CBWCDBLENGTH));
-	KASSERT(dir == DIR_NONE || datalen > 0,
-		("%s: datalen == 0 while direction is not NONE\n",
-			device_xname(sc->sc_dev)));
-	KASSERT(datalen == 0 || dir != DIR_NONE,
-		("%s: direction is NONE while datalen is not zero\n",
-			device_xname(sc->sc_dev)));
-	KASSERT(sizeof(umass_bbb_cbw_t) == UMASS_BBB_CBW_SIZE,
-		("%s: CBW struct does not have the right size (%d vs. %d)\n",
+	KASSERTMSG(datalen == 0 || data != NULL,
+		   "%s: datalen > 0, but no buffer",device_xname(sc->sc_dev));
+	KASSERTMSG(cmdlen <= CBWCDBLENGTH,
+		   "%s: cmdlen exceeds CDB length in CBW (%d > %d)",
+			device_xname(sc->sc_dev), cmdlen, CBWCDBLENGTH);
+	KASSERTMSG(dir == DIR_NONE || datalen > 0,
+		   "%s: datalen == 0 while direction is not NONE\n",
+			device_xname(sc->sc_dev));
+	KASSERTMSG(datalen == 0 || dir != DIR_NONE,
+		   "%s: direction is NONE while datalen is not zero\n",
+			device_xname(sc->sc_dev));
+	/* CTASSERT */
+	KASSERTMSG(sizeof(umass_bbb_cbw_t) == UMASS_BBB_CBW_SIZE,
+		   "%s: CBW struct does not have the right size (%zu vs. %u)\n",
 			device_xname(sc->sc_dev),
-			sizeof(umass_bbb_cbw_t), UMASS_BBB_CBW_SIZE));
-	KASSERT(sizeof(umass_bbb_csw_t) == UMASS_BBB_CSW_SIZE,
-		("%s: CSW struct does not have the right size (%d vs. %d)\n",
+			sizeof(umass_bbb_cbw_t), UMASS_BBB_CBW_SIZE);
+	/* CTASSERT */
+	KASSERTMSG(sizeof(umass_bbb_csw_t) == UMASS_BBB_CSW_SIZE,
+		   "%s: CSW struct does not have the right size (%zu vs. %u)\n",
 			device_xname(sc->sc_dev),
-			sizeof(umass_bbb_csw_t), UMASS_BBB_CSW_SIZE));
+			sizeof(umass_bbb_csw_t), UMASS_BBB_CSW_SIZE);
 
 	/*
 	 * Determine the direction of the data transfer and the length.
@@ -1011,9 +1006,9 @@ umass_bbb_state(usbd_xfer_handle xfer, u
 	usbd_xfer_handle next_xfer;
 	int residue;
 
-	KASSERT(sc->sc_wire & UMASS_WPROTO_BBB,
-		("sc->sc_wire == 0x%02x wrong for umass_bbb_state\n",
-		sc->sc_wire));
+	KASSERTMSG(sc->sc_wire & UMASS_WPROTO_BBB,
+		   "sc->sc_wire == 0x%02x wrong for umass_bbb_state\n",
+		   sc->sc_wire);
 
 	if (sc->sc_dying)
 		return;
@@ -1322,9 +1317,9 @@ Static int
 umass_cbi_adsc(struct umass_softc *sc, char *buffer, int buflen,
 	       usbd_xfer_handle xfer)
 {
-	KASSERT(sc->sc_wire & (UMASS_WPROTO_CBI|UMASS_WPROTO_CBI_I),
-		("sc->sc_wire == 0x%02x wrong for umass_cbi_adsc\n",
-		sc->sc_wire));
+	KASSERTMSG(sc->sc_wire & (UMASS_WPROTO_CBI|UMASS_WPROTO_CBI_I),
+		   "sc->sc_wire == 0x%02x wrong for umass_cbi_adsc\n",
+		   sc->sc_wire);
 
 	if ((sc->sc_cmd == UMASS_CPROTO_RBC) &&
 	    (sc->sc_quirks & UMASS_QUIRK_RBC_PAD_TO_12) != 0 && buflen < 12) {
@@ -1348,9 +1343,9 @@ umass_cbi_reset(struct umass_softc *sc, 
 	int i;
 #	define SEND_DIAGNOSTIC_CMDLEN	12
 
-	KASSERT(sc->sc_wire & (UMASS_WPROTO_CBI|UMASS_WPROTO_CBI_I),
-		("sc->sc_wire == 0x%02x wrong for umass_cbi_reset\n",
-		sc->sc_wire));
+	KASSERTMSG(sc->sc_wire & (UMASS_WPROTO_CBI|UMASS_WPROTO_CBI_I),
+		   "sc->sc_wire == 0x%02x wrong for umass_cbi_reset\n",
+		   sc->sc_wire);
 
 	if (sc->sc_dying)
 		return;
@@ -1372,10 +1367,11 @@ umass_cbi_reset(struct umass_softc *sc, 
 	DPRINTF(UDMASS_CBI, ("%s: CBI Reset\n",
 		device_xname(sc->sc_dev)));
 
-	KASSERT(sizeof(sc->cbl) >= SEND_DIAGNOSTIC_CMDLEN,
-		("%s: CBL struct is too small (%d < %d)\n",
+	/* CTASSERT */
+	KASSERTMSG(sizeof(sc->cbl) >= SEND_DIAGNOSTIC_CMDLEN,
+		   "%s: CBL struct is too small (%zu < %u)\n",
 			device_xname(sc->sc_dev),
-			sizeof(sc->cbl), SEND_DIAGNOSTIC_CMDLEN));
+			sizeof(sc->cbl), SEND_DIAGNOSTIC_CMDLEN);
 
 	sc->transfer_state = TSTATE_CBI_RESET1;
 	sc->transfer_status = status;
@@ -1402,9 +1398,9 @@ umass_cbi_transfer(struct umass_softc *s
 	DPRINTF(UDMASS_CBI,("%s: umass_cbi_transfer cmd=0x%02x, len=%d\n",
 		device_xname(sc->sc_dev), *(u_char *)cmd, datalen));
 
-	KASSERT(sc->sc_wire & (UMASS_WPROTO_CBI|UMASS_WPROTO_CBI_I),
-		("sc->sc_wire == 0x%02x wrong for umass_cbi_transfer\n",
-		sc->sc_wire));
+	KASSERTMSG(sc->sc_wire & (UMASS_WPROTO_CBI|UMASS_WPROTO_CBI_I),
+		   "sc->sc_wire == 0x%02x wrong for umass_cbi_transfer\n",
+		   sc->sc_wire);
 
 	if (sc->sc_dying)
 		return;
@@ -1430,11 +1426,11 @@ umass_cbi_transfer(struct umass_softc *s
 	 */
 
 	/* check the given arguments */
-	KASSERT(datalen == 0 || data != NULL,
-		("%s: datalen > 0, but no buffer",device_xname(sc->sc_dev)));
-	KASSERT(datalen == 0 || dir != DIR_NONE,
-		("%s: direction is NONE while datalen is not zero\n",
-			device_xname(sc->sc_dev)));
+	KASSERTMSG(datalen == 0 || data != NULL,
+		   "%s: datalen > 0, but no buffer",device_xname(sc->sc_dev));
+	KASSERTMSG(datalen == 0 || dir != DIR_NONE,
+		   "%s: direction is NONE while datalen is not zero\n",
+			device_xname(sc->sc_dev));
 
 	/* store the details for the data transfer phase */
 	sc->transfer_dir = dir;
@@ -1459,9 +1455,9 @@ umass_cbi_state(usbd_xfer_handle xfer, u
 {
 	struct umass_softc *sc = (struct umass_softc *) priv;
 
-	KASSERT(sc->sc_wire & (UMASS_WPROTO_CBI|UMASS_WPROTO_CBI_I),
-		("sc->sc_wire == 0x%02x wrong for umass_cbi_state\n",
-		sc->sc_wire));
+	KASSERTMSG(sc->sc_wire & (UMASS_WPROTO_CBI|UMASS_WPROTO_CBI_I),
+		   "sc->sc_wire == 0x%02x wrong for umass_cbi_state\n",
+		   sc->sc_wire);
 
 	if (sc->sc_dying)
 		return;

Index: src/sys/dev/usb/umodem.c
diff -u src/sys/dev/usb/umodem.c:1.62 src/sys/dev/usb/umodem.c:1.63
--- src/sys/dev/usb/umodem.c:1.62	Fri Dec 23 00:51:47 2011
+++ src/sys/dev/usb/umodem.c	Fri Feb 24 06:48:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: umodem.c,v 1.62 2011/12/23 00:51:47 jakllsch Exp $	*/
+/*	$NetBSD: umodem.c,v 1.63 2012/02/24 06:48:27 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umodem.c,v 1.62 2011/12/23 00:51:47 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umodem.c,v 1.63 2012/02/24 06:48:27 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -138,9 +138,6 @@ int 
 umodem_detach(device_t self, int flags)
 {
 	struct umodem_softc *sc = device_private(self);
-#ifdef __FreeBSD__
-	int flags = 0;
-#endif
 
 	return umodem_common_detach(sc, flags);
 }

Index: src/sys/dev/usb/urio.c
diff -u src/sys/dev/usb/urio.c:1.37 src/sys/dev/usb/urio.c:1.38
--- src/sys/dev/usb/urio.c:1.37	Fri Dec 23 00:51:48 2011
+++ src/sys/dev/usb/urio.c	Fri Feb 24 06:48:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: urio.c,v 1.37 2011/12/23 00:51:48 jakllsch Exp $	*/
+/*	$NetBSD: urio.c,v 1.38 2012/02/24 06:48:27 mrg Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -36,23 +36,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: urio.c,v 1.37 2011/12/23 00:51:48 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: urio.c,v 1.38 2012/02/24 06:48:27 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 #include <sys/device.h>
 #include <sys/ioctl.h>
-#elif defined(__FreeBSD__)
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/ioccom.h>
-#include <sys/conf.h>
-#include <sys/fcntl.h>
-#include <sys/filio.h>
-#endif
 #include <sys/conf.h>
 #include <sys/file.h>
 #include <sys/select.h>
@@ -77,7 +68,6 @@ int	uriodebug = 0;
 #endif
 
 
-#if defined(__NetBSD__)
 dev_type_open(urioopen);
 dev_type_close(urioclose);
 dev_type_read(urioread);
@@ -88,24 +78,6 @@ const struct cdevsw urio_cdevsw = {
 	urioopen, urioclose, urioread, uriowrite, urioioctl,
 	nostop, notty, nopoll, nommap, nokqfilter, D_OTHER,
 };
-#elif defined(__OpenBSD__)
-cdev_decl(urio);
-#elif defined(__FreeBSD__)
-d_open_t  urioopen;
-d_close_t urioclose;
-d_read_t  urioread;
-d_write_t uriowrite;
-d_ioctl_t urioioctl;
-
-#define URIO_CDEV_MAJOR	143
-
-static struct cdevsw urio_cdevsw = {
-	urioopen,	urioclose,	urioread,	uriowrite,
- 	urioioctl,	nopoll,		nommap,		nostrategy,
- 	"urio",		URIO_CDEV_MAJOR,nodump,		nopsize,
- 	0,		-1
-};
-#endif  /* defined(__FreeBSD__) */
 
 #define URIO_CONFIG_NO		1
 #define URIO_IFACE_IDX		0
@@ -221,13 +193,6 @@ urio_attach(device_t parent, device_t se
 		return;
 	}
 
-#if defined(__FreeBSD__)
-	/* XXX no error trapping, no storing of dev_t */
-	(void)make_dev(&urio_cdevsw, device_get_unit(self),
-		       UID_ROOT, GID_OPERATOR,
-		       0644, "urio%d", device_get_unit(self));
-#endif /* defined(__FreeBSD__) */
-
 	DPRINTFN(10, ("urio_attach: %p\n", sc->sc_udev));
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
@@ -241,13 +206,9 @@ urio_detach(device_t self, int flags)
 {
 	struct urio_softc *sc = device_private(self);
 	int s;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 	int maj, mn;
 
 	DPRINTF(("urio_detach: sc=%p flags=%d\n", sc, flags));
-#elif defined(__FreeBSD__)
-	DPRINTF(("urio_detach: sc=%p\n", sc));
-#endif
 
 	sc->sc_dying = 1;
 	/* Abort all pipes.  Causes processes waiting for transfer to wake. */
@@ -269,22 +230,12 @@ urio_detach(device_t self, int flags)
 	}
 	splx(s);
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 	/* locate the major number */
-#if defined(__NetBSD__)
 	maj = cdevsw_lookup_major(&urio_cdevsw);
-#elif defined(__OpenBSD__)
-	for (maj = 0; maj < nchrdev; maj++)
-		if (cdevsw[maj].d_open == urioopen)
-			break;
-#endif
 
 	/* Nuke the vnodes for any open instances (calls close). */
 	mn = device_unit(self);
 	vdevgone(maj, mn, mn, VCHR);
-#elif defined(__FreeBSD__)
-	/* XXX not implemented yet */
-#endif
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
 			   sc->sc_dev);
@@ -292,7 +243,6 @@ urio_detach(device_t self, int flags)
 	return (0);
 }
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 int
 urio_activate(device_t self, enum devact act)
 {
@@ -306,7 +256,6 @@ urio_activate(device_t self, enum devact
 		return EOPNOTSUPP;
 	}
 }
-#endif
 
 int
 urioopen(dev_t dev, int flag, int mode, struct lwp *l)
@@ -579,15 +528,3 @@ ret:
 		free(ptr, M_TEMP);
 	return (error);
 }
-
-#if defined(__OpenBSD__)
-int
-urioselect(dev_t dev, int events, struct lwp *l)
-{
-	return (0);
-}
-#endif
-
-#if defined(__FreeBSD__)
-DRIVER_MODULE(urio, uhub, urio_driver, urio_devclass, usbd_driver_load, 0);
-#endif /* defined(__FreeBSD__) */

Index: src/sys/dev/usb/usb_mem.h
diff -u src/sys/dev/usb/usb_mem.h:1.27 src/sys/dev/usb/usb_mem.h:1.28
--- src/sys/dev/usb/usb_mem.h:1.27	Sat Jun 28 17:42:53 2008
+++ src/sys/dev/usb/usb_mem.h	Fri Feb 24 06:48:28 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_mem.h,v 1.27 2008/06/28 17:42:53 bouyer Exp $	*/
+/*	$NetBSD: usb_mem.h,v 1.28 2012/02/24 06:48:28 mrg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_mem.h,v 1.9 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -31,7 +31,6 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 typedef struct usb_dma_block {
 	bus_dma_tag_t tag;
 	bus_dmamap_t map;
@@ -54,7 +53,6 @@ usbd_status	usb_allocmem(usbd_bus_handle
 void		usb_freemem(usbd_bus_handle, usb_dma_t *);
 void		usb_syncmem(usb_dma_t *, bus_addr_t, bus_size_t, int ops);
 
-#ifdef __NetBSD__
 struct extent;
 
 struct usb_dma_reserve {
@@ -79,37 +77,3 @@ usbd_status usb_reserve_allocm(struct us
 				u_int32_t);
 int usb_setup_reserve(device_t, struct usb_dma_reserve *, bus_dma_tag_t, size_t);
 void usb_reserve_freem(struct usb_dma_reserve *, usb_dma_t *);
-
-#endif
-
-#elif defined(__FreeBSD__)
-
-/*
- * FreeBSD does not have special functions for DMA memory, so let's keep it
- * simple for now.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/queue.h>
-#include <sys/proc.h>
-#include <sys/bio.h>
-#include <sys/buf.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <vm/vm.h>
-#include <vm/pmap.h>
-
-#include <machine/pmap.h>       /* for vtophys */
-
-#define		usb_allocmem(t,s,a,p)	(*(p) = malloc(s, M_USB, M_NOWAIT), (*(p) == NULL? USBD_NOMEM: USBD_NORMAL_COMPLETION))
-#define		usb_freemem(t,p)	(free(*(p), M_USB))
-
-#ifdef __alpha__
-#define DMAADDR(dma, o)	(alpha_XXX_dmamap((vm_offset_t) *(dma) + (o)))
-#else
-#define DMAADDR(dma, o)	(vtophys(*(dma) + (o)))
-#endif
-#define KERNADDR(dma, o)	((void *) ((char *)*(dma) + (o)))
-#endif /* __FreeBSD__ */
-
Index: src/sys/dev/usb/uvscom.c
diff -u src/sys/dev/usb/uvscom.c:1.27 src/sys/dev/usb/uvscom.c:1.28
--- src/sys/dev/usb/uvscom.c:1.27	Fri Dec 23 00:51:50 2011
+++ src/sys/dev/usb/uvscom.c	Fri Feb 24 06:48:28 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvscom.c,v 1.27 2011/12/23 00:51:50 jakllsch Exp $	*/
+/*	$NetBSD: uvscom.c,v 1.28 2012/02/24 06:48:28 mrg Exp $	*/
 /*-
  * Copyright (c) 2001-2002, Shunsuke Akiyama <[email protected]>.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvscom.c,v 1.27 2011/12/23 00:51:50 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvscom.c,v 1.28 2012/02/24 06:48:28 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -45,18 +45,8 @@ __KERNEL_RCSID(0, "$NetBSD: uvscom.c,v 1
 #include <sys/conf.h>
 #include <sys/tty.h>
 #include <sys/file.h>
-#if defined(__FreeBSD__)
-#include <sys/bus.h>
-#include <sys/ioccom.h>
-#if __FreeBSD_version >= 500014
-#include <sys/selinfo.h>
-#else
-#include <sys/select.h>
-#endif
-#else
 #include <sys/ioctl.h>
 #include <sys/device.h>
-#endif
 #include <sys/proc.h>
 #include <sys/poll.h>
 
@@ -73,15 +63,6 @@ __KERNEL_RCSID(0, "$NetBSD: uvscom.c,v 1
 #ifdef UVSCOM_DEBUG
 static int	uvscomdebug = 1;
 
-#if defined(__FreeBSD__)
-#include <sys/sysctl.h>
-
-SYSCTL_DECL(_debug_usb);
-SYSCTL_INT(_debug_usb, OID_AUTO, uvscom, CTLFLAG_RW,
-	   &uvscomdebug, 0, "uvscom debug level");
-
-#endif
-
 #define DPRINTFN(n, x)  do { \
 				if (uvscomdebug > (n)) \
 					printf x; \
@@ -91,10 +72,6 @@ SYSCTL_INT(_debug_usb, OID_AUTO, uvscom,
 #endif
 #define DPRINTF(x) DPRINTFN(0, x)
 
-#if defined(__FreeBSD__)
-#define UVSCOM_MODVER		1	/* module version */
-#endif
-
 #define	UVSCOM_CONFIG_INDEX	0
 #define	UVSCOM_IFACE_INDEX	0
 

Index: src/sys/dev/usb/usbdi.h
diff -u src/sys/dev/usb/usbdi.h:1.80 src/sys/dev/usb/usbdi.h:1.81
--- src/sys/dev/usb/usbdi.h:1.80	Sun Nov 27 14:36:21 2011
+++ src/sys/dev/usb/usbdi.h	Fri Feb 24 06:48:28 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.h,v 1.80 2011/11/27 14:36:21 rmind Exp $	*/
+/*	$NetBSD: usbdi.h,v 1.81 2012/02/24 06:48:28 mrg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $	*/
 
 /*
@@ -85,10 +85,6 @@ typedef void (*usbd_callback)(usbd_xfer_
 #define USBD_DEFAULT_TIMEOUT 5000 /* ms = 5 s */
 #define	USBD_CONFIG_TIMEOUT  (3*USBD_DEFAULT_TIMEOUT)
 
-#if defined(__FreeBSD__)
-#define USB_CDEV_MAJOR 108
-#endif
-
 #define DEVINFOSIZE 1024
 
 usbd_status usbd_open_pipe(usbd_interface_handle, u_int8_t,

Index: src/sys/dev/usb/uscanner.c
diff -u src/sys/dev/usb/uscanner.c:1.70 src/sys/dev/usb/uscanner.c:1.71
--- src/sys/dev/usb/uscanner.c:1.70	Fri Dec 23 00:51:48 2011
+++ src/sys/dev/usb/uscanner.c	Fri Feb 24 06:48:28 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uscanner.c,v 1.70 2011/12/23 00:51:48 jakllsch Exp $	*/
+/*	$NetBSD: uscanner.c,v 1.71 2012/02/24 06:48:28 mrg Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -32,27 +32,15 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uscanner.c,v 1.70 2011/12/23 00:51:48 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uscanner.c,v 1.71 2012/02/24 06:48:28 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 #include <sys/device.h>
-#elif defined(__FreeBSD__)
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/conf.h>
-#include <sys/fcntl.h>
-#include <sys/filio.h>
-#endif
 #include <sys/file.h>
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500014
-#include <sys/selinfo.h>
-#else
 #include <sys/select.h>
-#endif
 #include <sys/proc.h>
 #include <sys/vnode.h>
 #include <sys/poll.h>
@@ -244,7 +232,6 @@ struct uscanner_softc {
 	u_char			sc_dying;
 };
 
-#if defined(__NetBSD__)
 dev_type_open(uscanneropen);
 dev_type_close(uscannerclose);
 dev_type_read(uscannerread);
@@ -258,36 +245,6 @@ const struct cdevsw uscanner_cdevsw = {
 	uscannerioctl, nostop, notty, uscannerpoll, nommap, uscannerkqfilter,
 	D_OTHER,
 };
-#elif defined(__OpenBSD__)
-cdev_decl(uscanner);
-#elif defined(__FreeBSD__)
-d_open_t  uscanneropen;
-d_close_t uscannerclose;
-d_read_t  uscannerread;
-d_write_t uscannerwrite;
-d_poll_t  uscannerpoll;
-
-#define USCANNER_CDEV_MAJOR	156
-
-Static struct cdevsw uscanner_cdevsw = {
-	/* open */	uscanneropen,
-	/* close */	uscannerclose,
-	/* read */	uscannerread,
-	/* write */	uscannerwrite,
-	/* ioctl */	noioctl,
-	/* poll */	uscannerpoll,
-	/* mmap */	nommap,
-	/* strategy */	nostrategy,
-	/* name */	"uscanner",
-	/* maj */	USCANNER_CDEV_MAJOR,
-	/* dump */	nodump,
-	/* psize */	nopsize,
-	/* flags */	0,
-#if !defined(__FreeBSD__) || (__FreeBSD__ < 5)
-	/* bmaj */	-1
-#endif
-};
-#endif
 
 Static int uscanner_do_read(struct uscanner_softc *, struct uio *, int);
 Static int uscanner_do_write(struct uscanner_softc *, struct uio *, int);
@@ -387,11 +344,6 @@ uscanner_attach(device_t parent, device_
 	sc->sc_bulkin = ed_bulkin->bEndpointAddress;
 	sc->sc_bulkout = ed_bulkout->bEndpointAddress;
 
-#ifdef __FreeBSD__
-	/* the main device, ctrl endpoint */
-	make_dev(&uscanner_cdevsw, device_unit(sc->sc_dev),
-		UID_ROOT, GID_OPERATOR, 0644, "%s", device_xname(sc->sc_dev));
-#endif
 	selinit(&sc->sc_selq);
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
 			   sc->sc_dev);
@@ -629,7 +581,6 @@ uscannerwrite(dev_t dev, struct uio *uio
 	return (error);
 }
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 int
 uscanner_activate(device_t self, enum devact act)
 {
@@ -643,25 +594,15 @@ uscanner_activate(device_t self, enum de
 		return EOPNOTSUPP;
 	}
 }
-#endif
 
 int 
 uscanner_detach(device_t self, int flags)
 {
 	struct uscanner_softc *sc = device_private(self);
 	int             s;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 	int maj, mn;
-#elif defined(__FreeBSD__)
-	dev_t dev;
-	struct vnode *vp;
-#endif
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 	DPRINTF(("uscanner_detach: sc=%p flags=%d\n", sc, flags));
-#elif defined(__FreeBSD__)
-	DPRINTF(("uscanner_detach: sc=%p\n", sc));
-#endif
 
 	sc->sc_dying = 1;
 	sc->sc_dev_flags = 0;	/* make close really close device */
@@ -679,27 +620,12 @@ uscanner_detach(device_t self, int flags
 	}
 	splx(s);
 
-#if defined(__NetBSD__) || defined(__OpenBSD__)
 	/* locate the major number */
-#if defined(__NetBSD__)
 	maj = cdevsw_lookup_major(&uscanner_cdevsw);
-#elif defined(__OpenBSD__)
-	for (maj = 0; maj < nchrdev; maj++)
-		if (cdevsw[maj].d_open == uscanneropen)
-			break;
-#endif
 
 	/* Nuke the vnodes for any open instances (calls close). */
 	mn = device_unit(self) * USB_MAX_ENDPOINTS;
 	vdevgone(maj, mn, mn + USB_MAX_ENDPOINTS - 1, VCHR);
-#elif defined(__FreeBSD__)
-	/* destroy the device for the control endpoint */
-	dev = makedev(USCANNER_CDEV_MAJOR, device_unit(sc->sc_dev));
-	vp = SLIST_FIRST(&dev->si_hlist);
-	if (vp)
-		VOP_REVOKE(vp, REVOKEALL);
-	destroy_dev(dev);
-#endif
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
 			   sc->sc_dev);
@@ -781,7 +707,3 @@ uscannerioctl(dev_t dev, u_long cmd, voi
 {
 	return (EINVAL);
 }
-
-#if defined(__FreeBSD__)
-DRIVER_MODULE(uscanner, uhub, uscanner_driver, uscanner_devclass, usbd_driver_load, 0);
-#endif

Reply via email to