Module Name:    src
Committed By:   rmind
Date:           Tue May 20 18:25:54 UTC 2014

Modified Files:
        src/sys/dev/bluetooth: bcsp.c bthidev.c btmagic.c btsco.c btuart.c
        src/sys/dev/pcmcia: bt3c.c btbc.c
        src/sys/dev/sdmmc: sbt.c
        src/sys/dev/usb: ubt.c
        src/sys/netbt: hci.h hci_link.c hci_socket.c hci_unit.c l2cap.h
            l2cap_socket.c l2cap_upper.c rfcomm.h rfcomm_session.c
            rfcomm_socket.c rfcomm_upper.c sco.h sco_socket.c sco_upper.c

Log Message:
netbt: rename some attach/detach functions to have _pcb suffix, so
we could use standard attach/detach naming for pr_usrreq functions.
No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/bluetooth/bcsp.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/bluetooth/bthidev.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/bluetooth/btmagic.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/bluetooth/btsco.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/bluetooth/btuart.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pcmcia/bt3c.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pcmcia/btbc.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/sdmmc/sbt.c
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/usb/ubt.c
cvs rdiff -u -r1.36 -r1.37 src/sys/netbt/hci.h
cvs rdiff -u -r1.23 -r1.24 src/sys/netbt/hci_link.c
cvs rdiff -u -r1.22 -r1.23 src/sys/netbt/hci_socket.c
cvs rdiff -u -r1.13 -r1.14 src/sys/netbt/hci_unit.c \
    src/sys/netbt/l2cap_socket.c
cvs rdiff -u -r1.12 -r1.13 src/sys/netbt/l2cap.h src/sys/netbt/l2cap_upper.c
cvs rdiff -u -r1.11 -r1.12 src/sys/netbt/rfcomm.h
cvs rdiff -u -r1.18 -r1.19 src/sys/netbt/rfcomm_session.c
cvs rdiff -u -r1.14 -r1.15 src/sys/netbt/rfcomm_socket.c \
    src/sys/netbt/rfcomm_upper.c
cvs rdiff -u -r1.5 -r1.6 src/sys/netbt/sco.h
cvs rdiff -u -r1.15 -r1.16 src/sys/netbt/sco_socket.c
cvs rdiff -u -r1.10 -r1.11 src/sys/netbt/sco_upper.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/bluetooth/bcsp.c
diff -u src/sys/dev/bluetooth/bcsp.c:1.23 src/sys/dev/bluetooth/bcsp.c:1.24
--- src/sys/dev/bluetooth/bcsp.c:1.23	Tue Feb 25 18:30:09 2014
+++ src/sys/dev/bluetooth/bcsp.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcsp.c,v 1.23 2014/02/25 18:30:09 pooka Exp $	*/
+/*	$NetBSD: bcsp.c,v 1.24 2014/05/20 18:25:54 rmind Exp $	*/
 /*
  * Copyright (c) 2007 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcsp.c,v 1.23 2014/02/25 18:30:09 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcsp.c,v 1.24 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -285,7 +285,7 @@ bcsp_attach(device_t parent __unused, de
 	MBUFQ_INIT(&sc->sc_scoq);
 
 	/* Attach Bluetooth unit */
-	sc->sc_unit = hci_attach(&bcsp_hci, self, 0);
+	sc->sc_unit = hci_attach_pcb(&bcsp_hci, self, 0);
 
 	if ((rc = sysctl_createv(&sc->sc_log, 0, NULL, &node,
 	    0, CTLTYPE_NODE, device_xname(self),
@@ -345,7 +345,7 @@ bcsp_detach(device_t self, int flags __u
 	struct bcsp_softc *sc = device_private(self);
 
 	if (sc->sc_unit != NULL) {
-		hci_detach(sc->sc_unit);
+		hci_detach_pcb(sc->sc_unit);
 		sc->sc_unit = NULL;
 	}
 

Index: src/sys/dev/bluetooth/bthidev.c
diff -u src/sys/dev/bluetooth/bthidev.c:1.24 src/sys/dev/bluetooth/bthidev.c:1.25
--- src/sys/dev/bluetooth/bthidev.c:1.24	Thu Dec 20 11:17:47 2012
+++ src/sys/dev/bluetooth/bthidev.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bthidev.c,v 1.24 2012/12/20 11:17:47 plunky Exp $	*/
+/*	$NetBSD: bthidev.c,v 1.25 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.24 2012/12/20 11:17:47 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.25 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/condvar.h>
@@ -358,27 +358,27 @@ bthidev_detach(device_t self, int flags)
 
 	/* release interrupt listen */
 	if (sc->sc_int_l != NULL) {
-		l2cap_detach(&sc->sc_int_l);
+		l2cap_detach_pcb(&sc->sc_int_l);
 		sc->sc_int_l = NULL;
 	}
 
 	/* release control listen */
 	if (sc->sc_ctl_l != NULL) {
-		l2cap_detach(&sc->sc_ctl_l);
+		l2cap_detach_pcb(&sc->sc_ctl_l);
 		sc->sc_ctl_l = NULL;
 	}
 
 	/* close interrupt channel */
 	if (sc->sc_int != NULL) {
 		l2cap_disconnect(sc->sc_int, 0);
-		l2cap_detach(&sc->sc_int);
+		l2cap_detach_pcb(&sc->sc_int);
 		sc->sc_int = NULL;
 	}
 
 	/* close control channel */
 	if (sc->sc_ctl != NULL) {
 		l2cap_disconnect(sc->sc_ctl, 0);
-		l2cap_detach(&sc->sc_ctl);
+		l2cap_detach_pcb(&sc->sc_ctl);
 		sc->sc_ctl = NULL;
 	}
 
@@ -499,7 +499,7 @@ bthidev_listen(struct bthidev_softc *sc)
 	/*
 	 * Listen on control PSM
 	 */
-	err = l2cap_attach(&sc->sc_ctl_l, &bthidev_ctl_proto, sc);
+	err = l2cap_attach_pcb(&sc->sc_ctl_l, &bthidev_ctl_proto, sc);
 	if (err)
 		return err;
 
@@ -519,7 +519,7 @@ bthidev_listen(struct bthidev_softc *sc)
 	/*
 	 * Listen on interrupt PSM
 	 */
-	err = l2cap_attach(&sc->sc_int_l, &bthidev_int_proto, sc);
+	err = l2cap_attach_pcb(&sc->sc_int_l, &bthidev_int_proto, sc);
 	if (err)
 		return err;
 
@@ -556,7 +556,7 @@ bthidev_connect(struct bthidev_softc *sc
 	sa.bt_len = sizeof(sa);
 	sa.bt_family = AF_BLUETOOTH;
 
-	err = l2cap_attach(&sc->sc_ctl, &bthidev_ctl_proto, sc);
+	err = l2cap_attach_pcb(&sc->sc_ctl, &bthidev_ctl_proto, sc);
 	if (err) {
 		aprint_error_dev(sc->sc_dev, "l2cap_attach failed (%d)\n", err);
 		return err;
@@ -679,14 +679,14 @@ bthidev_process_one(struct bthidev_softc
 			/* close interrupt channel */
 			if (sc->sc_int != NULL) {
 				l2cap_disconnect(sc->sc_int, 0);
-				l2cap_detach(&sc->sc_int);
+				l2cap_detach_pcb(&sc->sc_int);
 				sc->sc_int = NULL;
 			}
 
 			/* close control channel */
 			if (sc->sc_ctl != NULL) {
 				l2cap_disconnect(sc->sc_ctl, 0);
-				l2cap_detach(&sc->sc_ctl);
+				l2cap_detach_pcb(&sc->sc_ctl);
 				sc->sc_ctl = NULL;
 			}
 			mutex_exit(bt_lock);
@@ -734,7 +734,7 @@ bthidev_ctl_connected(void *arg)
 
 	if (sc->sc_flags & BTHID_CONNECTING) {
 		/* initiate connect on interrupt PSM */
-		err = l2cap_attach(&sc->sc_int, &bthidev_int_proto, sc);
+		err = l2cap_attach_pcb(&sc->sc_int, &bthidev_int_proto, sc);
 		if (err)
 			goto fail;
 
@@ -762,7 +762,7 @@ bthidev_ctl_connected(void *arg)
 	return;
 
 fail:
-	l2cap_detach(&sc->sc_ctl);
+	l2cap_detach_pcb(&sc->sc_ctl);
 	sc->sc_ctl = NULL;
 
 	aprint_error_dev(sc->sc_dev, "connect failed (%d)\n", err);
@@ -799,7 +799,7 @@ bthidev_ctl_disconnected(void *arg, int 
 	struct bthidev_softc *sc = arg;
 
 	if (sc->sc_ctl != NULL) {
-		l2cap_detach(&sc->sc_ctl);
+		l2cap_detach_pcb(&sc->sc_ctl);
 		sc->sc_ctl = NULL;
 	}
 
@@ -831,7 +831,7 @@ bthidev_int_disconnected(void *arg, int 
 	struct bthidev_softc *sc = arg;
 
 	if (sc->sc_int != NULL) {
-		l2cap_detach(&sc->sc_int);
+		l2cap_detach_pcb(&sc->sc_int);
 		sc->sc_int = NULL;
 	}
 
@@ -884,7 +884,7 @@ bthidev_ctl_newconn(void *arg, struct so
 		return NULL;
 	}
 
-	l2cap_attach(&sc->sc_ctl, &bthidev_ctl_proto, sc);
+	l2cap_attach_pcb(&sc->sc_ctl, &bthidev_ctl_proto, sc);
 	return sc->sc_ctl;
 }
 
@@ -910,7 +910,7 @@ bthidev_int_newconn(void *arg, struct so
 		return NULL;
 	}
 
-	l2cap_attach(&sc->sc_int, &bthidev_int_proto, sc);
+	l2cap_attach_pcb(&sc->sc_int, &bthidev_int_proto, sc);
 	return sc->sc_int;
 }
 

Index: src/sys/dev/bluetooth/btmagic.c
diff -u src/sys/dev/bluetooth/btmagic.c:1.6 src/sys/dev/bluetooth/btmagic.c:1.7
--- src/sys/dev/bluetooth/btmagic.c:1.6	Tue Feb 25 18:30:09 2014
+++ src/sys/dev/bluetooth/btmagic.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: btmagic.c,v 1.6 2014/02/25 18:30:09 pooka Exp $	*/
+/*	$NetBSD: btmagic.c,v 1.7 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -85,7 +85,7 @@
  *****************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btmagic.c,v 1.6 2014/02/25 18:30:09 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btmagic.c,v 1.7 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -401,27 +401,27 @@ btmagic_detach(device_t self, int flags)
 
 	/* release interrupt listen */
 	if (sc->sc_int_l != NULL) {
-		l2cap_detach(&sc->sc_int_l);
+		l2cap_detach_pcb(&sc->sc_int_l);
 		sc->sc_int_l = NULL;
 	}
 
 	/* release control listen */
 	if (sc->sc_ctl_l != NULL) {
-		l2cap_detach(&sc->sc_ctl_l);
+		l2cap_detach_pcb(&sc->sc_ctl_l);
 		sc->sc_ctl_l = NULL;
 	}
 
 	/* close interrupt channel */
 	if (sc->sc_int != NULL) {
 		l2cap_disconnect(sc->sc_int, 0);
-		l2cap_detach(&sc->sc_int);
+		l2cap_detach_pcb(&sc->sc_int);
 		sc->sc_int = NULL;
 	}
 
 	/* close control channel */
 	if (sc->sc_ctl != NULL) {
 		l2cap_disconnect(sc->sc_ctl, 0);
-		l2cap_detach(&sc->sc_ctl);
+		l2cap_detach_pcb(&sc->sc_ctl);
 		sc->sc_ctl = NULL;
 	}
 
@@ -463,7 +463,7 @@ btmagic_listen(struct btmagic_softc *sc)
 	/*
 	 * Listen on control PSM
 	 */
-	err = l2cap_attach(&sc->sc_ctl_l, &btmagic_ctl_proto, sc);
+	err = l2cap_attach_pcb(&sc->sc_ctl_l, &btmagic_ctl_proto, sc);
 	if (err)
 		return err;
 
@@ -483,7 +483,7 @@ btmagic_listen(struct btmagic_softc *sc)
 	/*
 	 * Listen on interrupt PSM
 	 */
-	err = l2cap_attach(&sc->sc_int_l, &btmagic_int_proto, sc);
+	err = l2cap_attach_pcb(&sc->sc_int_l, &btmagic_int_proto, sc);
 	if (err)
 		return err;
 
@@ -519,7 +519,7 @@ btmagic_connect(struct btmagic_softc *sc
 	sa.bt_len = sizeof(sa);
 	sa.bt_family = AF_BLUETOOTH;
 
-	err = l2cap_attach(&sc->sc_ctl, &btmagic_ctl_proto, sc);
+	err = l2cap_attach_pcb(&sc->sc_ctl, &btmagic_ctl_proto, sc);
 	if (err) {
 		printf("%s: l2cap_attach failed (%d)\n",
 		    device_xname(sc->sc_dev), err);
@@ -811,7 +811,7 @@ btmagic_ctl_connected(void *arg)
 
 	if (ISSET(sc->sc_flags, BTMAGIC_CONNECTING)) {
 		/* initiate connect on interrupt PSM */
-		err = l2cap_attach(&sc->sc_int, &btmagic_int_proto, sc);
+		err = l2cap_attach_pcb(&sc->sc_int, &btmagic_int_proto, sc);
 		if (err)
 			goto fail;
 
@@ -839,7 +839,7 @@ btmagic_ctl_connected(void *arg)
 	return;
 
 fail:
-	l2cap_detach(&sc->sc_ctl);
+	l2cap_detach_pcb(&sc->sc_ctl);
 	sc->sc_ctl = NULL;
 
 	printf("%s: connect failed (%d)\n", device_xname(sc->sc_dev), err);
@@ -877,7 +877,7 @@ btmagic_ctl_disconnected(void *arg, int 
 	struct btmagic_softc *sc = arg;
 
 	if (sc->sc_ctl != NULL) {
-		l2cap_detach(&sc->sc_ctl);
+		l2cap_detach_pcb(&sc->sc_ctl);
 		sc->sc_ctl = NULL;
 	}
 
@@ -903,7 +903,7 @@ btmagic_int_disconnected(void *arg, int 
 	struct btmagic_softc *sc = arg;
 
 	if (sc->sc_int != NULL) {
-		l2cap_detach(&sc->sc_int);
+		l2cap_detach_pcb(&sc->sc_int);
 		sc->sc_int = NULL;
 	}
 
@@ -950,7 +950,7 @@ btmagic_ctl_newconn(void *arg, struct so
 		return NULL;
 	}
 
-	l2cap_attach(&sc->sc_ctl, &btmagic_ctl_proto, sc);
+	l2cap_attach_pcb(&sc->sc_ctl, &btmagic_ctl_proto, sc);
 	return sc->sc_ctl;
 }
 
@@ -976,7 +976,7 @@ btmagic_int_newconn(void *arg, struct so
 		return NULL;
 	}
 
-	l2cap_attach(&sc->sc_int, &btmagic_int_proto, sc);
+	l2cap_attach_pcb(&sc->sc_int, &btmagic_int_proto, sc);
 	return sc->sc_int;
 }
 

Index: src/sys/dev/bluetooth/btsco.c
diff -u src/sys/dev/bluetooth/btsco.c:1.28 src/sys/dev/bluetooth/btsco.c:1.29
--- src/sys/dev/bluetooth/btsco.c:1.28	Tue Apr  3 09:32:53 2012
+++ src/sys/dev/bluetooth/btsco.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: btsco.c,v 1.28 2012/04/03 09:32:53 plunky Exp $	*/
+/*	$NetBSD: btsco.c,v 1.29 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.28 2012/04/03 09:32:53 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.29 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/audioio.h>
@@ -360,13 +360,13 @@ btsco_detach(device_t self, int flags)
 	if (sc->sc_sco != NULL) {
 		DPRINTF("sc_sco=%p\n", sc->sc_sco);
 		sco_disconnect(sc->sc_sco, 0);
-		sco_detach(&sc->sc_sco);
+		sco_detach_pcb(&sc->sc_sco);
 		sc->sc_sco = NULL;
 	}
 
 	if (sc->sc_sco_l != NULL) {
 		DPRINTF("sc_sco_l=%p\n", sc->sc_sco_l);
-		sco_detach(&sc->sc_sco_l);
+		sco_detach_pcb(&sc->sc_sco_l);
 		sc->sc_sco_l = NULL;
 	}
 	mutex_exit(bt_lock);
@@ -430,7 +430,7 @@ btsco_sco_connected(void *arg)
 	 * If we are listening, no more need
 	 */
 	if (sc->sc_sco_l != NULL)
-		sco_detach(&sc->sc_sco_l);
+		sco_detach_pcb(&sc->sc_sco_l);
 
 	sc->sc_state = BTSCO_OPEN;
 	cv_broadcast(&sc->sc_connect);
@@ -446,7 +446,7 @@ btsco_sco_disconnected(void *arg, int er
 	KASSERT(sc->sc_sco != NULL);
 
 	sc->sc_err = err;
-	sco_detach(&sc->sc_sco);
+	sco_detach_pcb(&sc->sc_sco);
 
 	switch (sc->sc_state) {
 	case BTSCO_CLOSED:		/* dont think this can happen */
@@ -494,7 +494,7 @@ btsco_sco_newconn(void *arg, struct sock
 	    || sc->sc_sco != NULL)
 	    return NULL;
 
-	sco_attach(&sc->sc_sco, &btsco_sco_proto, sc);
+	sco_attach_pcb(&sc->sc_sco, &btsco_sco_proto, sc);
 	return sc->sc_sco;
 }
 
@@ -588,38 +588,38 @@ btsco_open(void *hdl, int flags)
 	bdaddr_copy(&sa.bt_bdaddr, &sc->sc_laddr);
 
 	if (sc->sc_flags & BTSCO_LISTEN) {
-		err = sco_attach(&sc->sc_sco_l, &btsco_sco_proto, sc);
+		err = sco_attach_pcb(&sc->sc_sco_l, &btsco_sco_proto, sc);
 		if (err)
 			goto done;
 
 		err = sco_bind(sc->sc_sco_l, &sa);
 		if (err) {
-			sco_detach(&sc->sc_sco_l);
+			sco_detach_pcb(&sc->sc_sco_l);
 			goto done;
 		}
 
 		err = sco_listen(sc->sc_sco_l);
 		if (err) {
-			sco_detach(&sc->sc_sco_l);
+			sco_detach_pcb(&sc->sc_sco_l);
 			goto done;
 		}
 
 		timo = 0;	/* no timeout */
 	} else {
-		err = sco_attach(&sc->sc_sco, &btsco_sco_proto, sc);
+		err = sco_attach_pcb(&sc->sc_sco, &btsco_sco_proto, sc);
 		if (err)
 			goto done;
 
 		err = sco_bind(sc->sc_sco, &sa);
 		if (err) {
-			sco_detach(&sc->sc_sco);
+			sco_detach_pcb(&sc->sc_sco);
 			goto done;
 		}
 
 		bdaddr_copy(&sa.bt_bdaddr, &sc->sc_raddr);
 		err = sco_connect(sc->sc_sco, &sa);
 		if (err) {
-			sco_detach(&sc->sc_sco);
+			sco_detach_pcb(&sc->sc_sco);
 			goto done;
 		}
 
@@ -637,10 +637,10 @@ btsco_open(void *hdl, int flags)
 		/* fall through to */
 	case BTSCO_WAIT_CONNECT:	/* error */
 		if (sc->sc_sco != NULL)
-			sco_detach(&sc->sc_sco);
+			sco_detach_pcb(&sc->sc_sco);
 
 		if (sc->sc_sco_l != NULL)
-			sco_detach(&sc->sc_sco_l);
+			sco_detach_pcb(&sc->sc_sco_l);
 
 		break;
 
@@ -673,11 +673,11 @@ btsco_close(void *hdl)
 
 	if (sc->sc_sco != NULL) {
 		sco_disconnect(sc->sc_sco, 0);
-		sco_detach(&sc->sc_sco);
+		sco_detach_pcb(&sc->sc_sco);
 	}
 
 	if (sc->sc_sco_l != NULL) {
-		sco_detach(&sc->sc_sco_l);
+		sco_detach_pcb(&sc->sc_sco_l);
 	}
 
 	if (sc->sc_rx_mbuf != NULL) {

Index: src/sys/dev/bluetooth/btuart.c
diff -u src/sys/dev/bluetooth/btuart.c:1.26 src/sys/dev/bluetooth/btuart.c:1.27
--- src/sys/dev/bluetooth/btuart.c:1.26	Sun Jul 31 13:51:53 2011
+++ src/sys/dev/bluetooth/btuart.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: btuart.c,v 1.26 2011/07/31 13:51:53 uebayasi Exp $	*/
+/*	$NetBSD: btuart.c,v 1.27 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007 KIYOHARA Takashi
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btuart.c,v 1.26 2011/07/31 13:51:53 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btuart.c,v 1.27 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -188,7 +188,7 @@ btuart_attach(device_t parent __unused, 
 	MBUFQ_INIT(&sc->sc_scoq);
 
 	/* Attach Bluetooth unit */
-	sc->sc_unit = hci_attach(&btuart_hci, self, 0);
+	sc->sc_unit = hci_attach_pcb(&btuart_hci, self, 0);
 	if (sc->sc_unit == NULL)
 		aprint_error_dev(self, "HCI attach failed\n");
 }
@@ -205,7 +205,7 @@ btuart_detach(device_t self, int flags _
 	btuart_disable(self);
 
 	if (sc->sc_unit) {
-		hci_detach(sc->sc_unit);
+		hci_detach_pcb(sc->sc_unit);
 		sc->sc_unit = NULL;
 	}
 

Index: src/sys/dev/pcmcia/bt3c.c
diff -u src/sys/dev/pcmcia/bt3c.c:1.22 src/sys/dev/pcmcia/bt3c.c:1.23
--- src/sys/dev/pcmcia/bt3c.c:1.22	Sat Jan 14 21:38:00 2012
+++ src/sys/dev/pcmcia/bt3c.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: bt3c.c,v 1.22 2012/01/14 21:38:00 plunky Exp $ */
+/* $NetBSD: bt3c.c,v 1.23 2014/05/20 18:25:54 rmind Exp $ */
 
 /*-
  * Copyright (c) 2005 Iain D. Hibbert,
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bt3c.c,v 1.22 2012/01/14 21:38:00 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bt3c.c,v 1.23 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -976,7 +976,7 @@ bt3c_attach(device_t parent, device_t se
 	}
 
 	/* Attach Bluetooth unit */
-	sc->sc_unit = hci_attach(&bt3c_hci, self, BTF_POWER_UP_NOOP);
+	sc->sc_unit = hci_attach_pcb(&bt3c_hci, self, BTF_POWER_UP_NOOP);
 	if (sc->sc_unit == NULL)
 		aprint_error_dev(self, "HCI attach failed\n");
 
@@ -1003,7 +1003,7 @@ bt3c_detach(device_t self, int flags)
 	bt3c_disable(self);
 
 	if (sc->sc_unit) {
-		hci_detach(sc->sc_unit);
+		hci_detach_pcb(sc->sc_unit);
 		sc->sc_unit = NULL;
 	}
 
@@ -1022,7 +1022,7 @@ bt3c_suspend(device_t self, const pmf_qu
 	struct bt3c_softc *sc = device_private(self);
 
 	if (sc->sc_unit) {
-		hci_detach(sc->sc_unit);
+		hci_detach_pcb(sc->sc_unit);
 		sc->sc_unit = NULL;
 	}
 
@@ -1036,7 +1036,7 @@ bt3c_resume(device_t self, const pmf_qua
 
 	KASSERT(sc->sc_unit == NULL);
 
-	sc->sc_unit = hci_attach(&bt3c_hci, self, BTF_POWER_UP_NOOP);
+	sc->sc_unit = hci_attach_pcb(&bt3c_hci, self, BTF_POWER_UP_NOOP);
 	if (sc->sc_unit == NULL)
 		return false;
 

Index: src/sys/dev/pcmcia/btbc.c
diff -u src/sys/dev/pcmcia/btbc.c:1.15 src/sys/dev/pcmcia/btbc.c:1.16
--- src/sys/dev/pcmcia/btbc.c:1.15	Wed Feb 24 22:38:08 2010
+++ src/sys/dev/pcmcia/btbc.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: btbc.c,v 1.15 2010/02/24 22:38:08 dyoung Exp $	*/
+/*	$NetBSD: btbc.c,v 1.16 2014/05/20 18:25:54 rmind Exp $	*/
 /*
  * Copyright (c) 2007 KIYOHARA Takashi
  * All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btbc.c,v 1.15 2010/02/24 22:38:08 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btbc.c,v 1.16 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/callout.h>
@@ -187,7 +187,7 @@ btbc_attach(device_t parent, device_t se
 	sc->sc_pcioh = cfe->iospace[0].handle;
 
 	/* Attach Bluetooth unit */
-	sc->sc_unit = hci_attach(&btbc_hci, self, 0);
+	sc->sc_unit = hci_attach_pcb(&btbc_hci, self, 0);
 	if (sc->sc_unit == NULL)
 		aprint_error_dev(self, "HCI attach failed\n");
 
@@ -214,7 +214,7 @@ btbc_detach(device_t self, int flags)
 	callout_destroy(&sc->sc_ledch);
 
 	if (sc->sc_unit) {
-		hci_detach(sc->sc_unit);
+		hci_detach_pcb(sc->sc_unit);
 		sc->sc_unit = NULL;
 	}
 
@@ -229,7 +229,7 @@ btbc_suspend(device_t self, const pmf_qu
 	struct btbc_softc *sc = device_private(self);
 
 	if (sc->sc_unit) {
-		hci_detach(sc->sc_unit);
+		hci_detach_pcb(sc->sc_unit);
 		sc->sc_unit = NULL;
 	}
 
@@ -244,7 +244,7 @@ btbc_resume(device_t self, const pmf_qua
 
 	KASSERT(sc->sc_unit == NULL);
 
-	sc->sc_unit = hci_attach(&btbc_hci, sc->sc_dev, 0);
+	sc->sc_unit = hci_attach_pcb(&btbc_hci, sc->sc_dev, 0);
 	if (sc->sc_unit == NULL)
 		return false;
 

Index: src/sys/dev/sdmmc/sbt.c
diff -u src/sys/dev/sdmmc/sbt.c:1.3 src/sys/dev/sdmmc/sbt.c:1.4
--- src/sys/dev/sdmmc/sbt.c:1.3	Sat Oct 27 17:18:38 2012
+++ src/sys/dev/sdmmc/sbt.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbt.c,v 1.3 2012/10/27 17:18:38 chs Exp $	*/
+/*	$NetBSD: sbt.c,v 1.4 2014/05/20 18:25:54 rmind Exp $	*/
 /*	$OpenBSD: sbt.c,v 1.9 2007/06/19 07:59:57 uwe Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Driver for Type-A/B SDIO Bluetooth cards */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbt.c,v 1.3 2012/10/27 17:18:38 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbt.c,v 1.4 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -202,7 +202,7 @@ sbt_attach(device_t parent, device_t sel
 	/*
 	 * Attach Bluetooth unit (machine-independent HCI).
 	 */
-	sc->sc_unit = hci_attach(&sbt_hci, self, 0);
+	sc->sc_unit = hci_attach_pcb(&sbt_hci, self, 0);
 }
 
 static int
@@ -213,7 +213,7 @@ sbt_detach(device_t self, int flags)
 	sc->sc_dying = 1;
 
 	if (sc->sc_unit) {
-		hci_detach(sc->sc_unit);
+		hci_detach_pcb(sc->sc_unit);
 		sc->sc_unit = NULL;
 	}
 

Index: src/sys/dev/usb/ubt.c
diff -u src/sys/dev/usb/ubt.c:1.50 src/sys/dev/usb/ubt.c:1.51
--- src/sys/dev/usb/ubt.c:1.50	Tue Feb 25 18:30:10 2014
+++ src/sys/dev/usb/ubt.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubt.c,v 1.50 2014/02/25 18:30:10 pooka Exp $	*/
+/*	$NetBSD: ubt.c,v 1.51 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ubt.c,v 1.50 2014/02/25 18:30:10 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubt.c,v 1.51 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -471,7 +471,7 @@ ubt_attach(device_t parent, device_t sel
 	}
 
 	/* Attach HCI */
-	sc->sc_unit = hci_attach(&ubt_hci, sc->sc_dev, 0);
+	sc->sc_unit = hci_attach_pcb(&ubt_hci, sc->sc_dev, 0);
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
 			   sc->sc_dev);
@@ -552,16 +552,16 @@ ubt_detach(device_t self, int flags)
 
 	/* Detach HCI interface */
 	if (sc->sc_unit) {
-		hci_detach(sc->sc_unit);
+		hci_detach_pcb(sc->sc_unit);
 		sc->sc_unit = NULL;
 	}
 
 	/*
 	 * Abort all pipes. Causes processes waiting for transfer to wake.
 	 *
-	 * Actually, hci_detach() above will call ubt_disable() which may
-	 * call ubt_abortdealloc(), but lets be sure since doing it twice
-	 * wont cause an error.
+	 * Actually, hci_detach_pcb() above will call ubt_disable() which
+	 * may call ubt_abortdealloc(), but lets be sure since doing it
+	 * twice wont cause an error.
 	 */
 	ubt_abortdealloc(sc);
 

Index: src/sys/netbt/hci.h
diff -u src/sys/netbt/hci.h:1.36 src/sys/netbt/hci.h:1.37
--- src/sys/netbt/hci.h:1.36	Sun May 18 14:46:16 2014
+++ src/sys/netbt/hci.h	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci.h,v 1.36 2014/05/18 14:46:16 rmind Exp $	*/
+/*	$NetBSD: hci.h,v 1.37 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -54,7 +54,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: hci.h,v 1.36 2014/05/18 14:46:16 rmind Exp $
+ * $Id: hci.h,v 1.37 2014/05/20 18:25:54 rmind Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_hci.h,v 1.6 2005/01/07 01:45:43 imp Exp $
  */
 
@@ -2571,8 +2571,8 @@ int hci_ctloutput(int, struct socket *, 
 void hci_mtap(struct mbuf *, struct hci_unit *);
 
 /* hci_unit.c */
-struct hci_unit *hci_attach(const struct hci_if *, device_t, uint16_t);
-void hci_detach(struct hci_unit *);
+struct hci_unit *hci_attach_pcb(const struct hci_if *, device_t, uint16_t);
+void hci_detach_pcb(struct hci_unit *);
 int hci_enable(struct hci_unit *);
 void hci_disable(struct hci_unit *);
 struct hci_unit *hci_unit_lookup(const bdaddr_t *);

Index: src/sys/netbt/hci_link.c
diff -u src/sys/netbt/hci_link.c:1.23 src/sys/netbt/hci_link.c:1.24
--- src/sys/netbt/hci_link.c:1.23	Wed Jul 27 10:25:09 2011
+++ src/sys/netbt/hci_link.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci_link.c,v 1.23 2011/07/27 10:25:09 plunky Exp $	*/
+/*	$NetBSD: hci_link.c,v 1.24 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hci_link.c,v 1.23 2011/07/27 10:25:09 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_link.c,v 1.24 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -799,7 +799,7 @@ hci_sco_newconn(struct hci_unit *unit, b
 
 		sco = hci_link_alloc(unit, bdaddr, HCI_LINK_SCO);
 		if (sco == NULL) {
-			sco_detach(&new);
+			sco_detach_pcb(&new);
 			return NULL;
 		}
 

Index: src/sys/netbt/hci_socket.c
diff -u src/sys/netbt/hci_socket.c:1.22 src/sys/netbt/hci_socket.c:1.23
--- src/sys/netbt/hci_socket.c:1.22	Mon May 19 02:51:24 2014
+++ src/sys/netbt/hci_socket.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci_socket.c,v 1.22 2014/05/19 02:51:24 rmind Exp $	*/
+/*	$NetBSD: hci_socket.c,v 1.23 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hci_socket.c,v 1.22 2014/05/19 02:51:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_socket.c,v 1.23 2014/05/20 18:25:54 rmind Exp $");
 
 /* load symbolic names */
 #ifdef BLUETOOTH_DEBUG
@@ -427,7 +427,7 @@ bad:
 }
 
 static int
-hci_attach1(struct socket *so, int proto)
+hci_attach(struct socket *so, int proto)
 {
 	struct hci_pcb *pcb;
 	int error;
@@ -465,7 +465,7 @@ hci_attach1(struct socket *so, int proto
 }
 
 static void
-hci_detach1(struct socket *so)
+hci_detach(struct socket *so)
 {
 	struct hci_pcb *pcb;
 
@@ -542,7 +542,7 @@ hci_usrreq(struct socket *up, int req, s
 
 	case PRU_ABORT:
 		soisdisconnected(up);
-		hci_detach1(up);
+		hci_detach(up);
 		return 0;
 
 	case PRU_BIND:
@@ -866,10 +866,12 @@ hci_mtap(struct mbuf *m, struct hci_unit
 
 PR_WRAP_USRREQ(hci_usrreq)
 
+//#define	hci_attach		hci_attach_wrapper
+//#define	hci_detach		hci_detach_wrapper
 #define	hci_usrreq		hci_usrreq_wrapper
 
 const struct pr_usrreqs hci_usrreqs = {
-	.pr_attach	= hci_attach1,
-	.pr_detach	= hci_detach1,
+	.pr_attach	= hci_attach,
+	.pr_detach	= hci_detach,
 	.pr_generic	= hci_usrreq,
 };

Index: src/sys/netbt/hci_unit.c
diff -u src/sys/netbt/hci_unit.c:1.13 src/sys/netbt/hci_unit.c:1.14
--- src/sys/netbt/hci_unit.c:1.13	Sat Sep 17 08:23:37 2011
+++ src/sys/netbt/hci_unit.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci_unit.c,v 1.13 2011/09/17 08:23:37 plunky Exp $	*/
+/*	$NetBSD: hci_unit.c,v 1.14 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hci_unit.c,v 1.13 2011/09/17 08:23:37 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_unit.c,v 1.14 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -81,7 +81,7 @@ static const uint8_t hci_cmds_v10[HCI_CO
 static void hci_intr (void *);
 
 struct hci_unit *
-hci_attach(const struct hci_if *hci_if, device_t dev, uint16_t flags)
+hci_attach_pcb(const struct hci_if *hci_if, device_t dev, uint16_t flags)
 {
 	struct hci_unit *unit;
 
@@ -120,7 +120,7 @@ hci_attach(const struct hci_if *hci_if, 
 }
 
 void
-hci_detach(struct hci_unit *unit)
+hci_detach_pcb(struct hci_unit *unit)
 {
 
 	mutex_enter(bt_lock);
Index: src/sys/netbt/l2cap_socket.c
diff -u src/sys/netbt/l2cap_socket.c:1.13 src/sys/netbt/l2cap_socket.c:1.14
--- src/sys/netbt/l2cap_socket.c:1.13	Mon May 19 03:18:57 2014
+++ src/sys/netbt/l2cap_socket.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: l2cap_socket.c,v 1.13 2014/05/19 03:18:57 rmind Exp $	*/
+/*	$NetBSD: l2cap_socket.c,v 1.14 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: l2cap_socket.c,v 1.13 2014/05/19 03:18:57 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: l2cap_socket.c,v 1.14 2014/05/20 18:25:54 rmind Exp $");
 
 /* load symbolic names */
 #ifdef BLUETOOTH_DEBUG
@@ -83,7 +83,7 @@ int l2cap_sendspace = 4096;
 int l2cap_recvspace = 4096;
 
 static int
-l2cap_attach1(struct socket *so, int proto)
+l2cap_attach(struct socket *so, int proto)
 {
 	int error;
 
@@ -104,15 +104,15 @@ l2cap_attach1(struct socket *so, int pro
 	if (error)
 		return error;
 
-	return l2cap_attach((struct l2cap_channel **)&so->so_pcb,
+	return l2cap_attach_pcb((struct l2cap_channel **)&so->so_pcb,
 				&l2cap_proto, so);
 }
 
 static void
-l2cap_detach1(struct socket *so)
+l2cap_detach(struct socket *so)
 {
 	KASSERT(so->so_pcb != NULL);
-	l2cap_detach((struct l2cap_channel **)&so->so_pcb);
+	l2cap_detach_pcb((struct l2cap_channel **)&so->so_pcb);
 	KASSERT(so->so_pcb == NULL);
 }
 
@@ -168,7 +168,7 @@ l2cap_usrreq(struct socket *up, int req,
 	case PRU_ABORT:
 		l2cap_disconnect(pcb, 0);
 		soisdisconnected(up);
-		l2cap_detach1(up);
+		l2cap_detach(up);
 		return 0;
 
 	case PRU_BIND:
@@ -413,10 +413,12 @@ l2cap_input(void *arg, struct mbuf *m)
 
 PR_WRAP_USRREQ(l2cap_usrreq)
 
+//#define	l2cap_attach		l2cap_attach_wrapper
+//#define	l2cap_detach		l2cap_detach_wrapper
 #define	l2cap_usrreq		l2cap_usrreq_wrapper
 
 const struct pr_usrreqs l2cap_usrreqs = {
-	.pr_attach	= l2cap_attach1,
-	.pr_detach	= l2cap_detach1,
+	.pr_attach	= l2cap_attach,
+	.pr_detach	= l2cap_detach,
 	.pr_generic	= l2cap_usrreq,
 };

Index: src/sys/netbt/l2cap.h
diff -u src/sys/netbt/l2cap.h:1.12 src/sys/netbt/l2cap.h:1.13
--- src/sys/netbt/l2cap.h:1.12	Mon May 19 02:51:24 2014
+++ src/sys/netbt/l2cap.h	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: l2cap.h,v 1.12 2014/05/19 02:51:24 rmind Exp $	*/
+/*	$NetBSD: l2cap.h,v 1.13 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -54,7 +54,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: l2cap.h,v 1.12 2014/05/19 02:51:24 rmind Exp $
+ * $Id: l2cap.h,v 1.13 2014/05/20 18:25:54 rmind Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/include/l2cap.h,v 1.4 2005/08/31 18:13:23 emax Exp $
  */
 
@@ -461,13 +461,13 @@ int l2cap_send_connect_rsp(struct hci_li
 int l2cap_ctloutput(int, struct socket *, struct sockopt *);
 
 /* l2cap_upper.c */
-int l2cap_attach(struct l2cap_channel **, const struct btproto *, void *);
+int l2cap_attach_pcb(struct l2cap_channel **, const struct btproto *, void *);
 int l2cap_bind(struct l2cap_channel *, struct sockaddr_bt *);
 int l2cap_sockaddr(struct l2cap_channel *, struct sockaddr_bt *);
 int l2cap_connect(struct l2cap_channel *, struct sockaddr_bt *);
 int l2cap_peeraddr(struct l2cap_channel *, struct sockaddr_bt *);
 int l2cap_disconnect(struct l2cap_channel *, int);
-void l2cap_detach(struct l2cap_channel **);
+void l2cap_detach_pcb(struct l2cap_channel **);
 int l2cap_listen(struct l2cap_channel *);
 int l2cap_send(struct l2cap_channel *, struct mbuf *);
 int l2cap_setopt(struct l2cap_channel *, const struct sockopt *);
Index: src/sys/netbt/l2cap_upper.c
diff -u src/sys/netbt/l2cap_upper.c:1.12 src/sys/netbt/l2cap_upper.c:1.13
--- src/sys/netbt/l2cap_upper.c:1.12	Mon May 19 02:51:24 2014
+++ src/sys/netbt/l2cap_upper.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: l2cap_upper.c,v 1.12 2014/05/19 02:51:24 rmind Exp $	*/
+/*	$NetBSD: l2cap_upper.c,v 1.13 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: l2cap_upper.c,v 1.12 2014/05/19 02:51:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: l2cap_upper.c,v 1.13 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -52,13 +52,13 @@ __KERNEL_RCSID(0, "$NetBSD: l2cap_upper.
  */
 
 /*
- * l2cap_attach(handle, btproto, upper)
+ * l2cap_attach_pcb(handle, btproto, upper)
  *
  *	attach new l2cap_channel to handle, populate
  *	with reasonable defaults
  */
 int
-l2cap_attach(struct l2cap_channel **handle,
+l2cap_attach_pcb(struct l2cap_channel **handle,
 		const struct btproto *proto, void *upper)
 {
 	struct l2cap_channel *chan;
@@ -260,12 +260,12 @@ l2cap_disconnect(struct l2cap_channel *c
 }
 
 /*
- * l2cap_detach(handle)
+ * l2cap_detach_pcb(handle)
  *
  *	Detach l2cap channel from handle & close it down
  */
 void
-l2cap_detach(struct l2cap_channel **handle)
+l2cap_detach_pcb(struct l2cap_channel **handle)
 {
 	struct l2cap_channel *chan;
 

Index: src/sys/netbt/rfcomm.h
diff -u src/sys/netbt/rfcomm.h:1.11 src/sys/netbt/rfcomm.h:1.12
--- src/sys/netbt/rfcomm.h:1.11	Mon May 19 02:51:24 2014
+++ src/sys/netbt/rfcomm.h	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rfcomm.h,v 1.11 2014/05/19 02:51:24 rmind Exp $	*/
+/*	$NetBSD: rfcomm.h,v 1.12 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -55,7 +55,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: rfcomm.h,v 1.11 2014/05/19 02:51:24 rmind Exp $
+ * $Id: rfcomm.h,v 1.12 2014/05/20 18:25:54 rmind Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h,v 1.4 2005/01/11 01:39:53 emax Exp $
  */
 
@@ -407,13 +407,13 @@ void rfcomm_init(void);
 int rfcomm_ctloutput(int, struct socket *, struct sockopt *);
 
 /* rfcomm_upper.c */
-int rfcomm_attach(struct rfcomm_dlc **, const struct btproto *, void *);
+int rfcomm_attach_pcb(struct rfcomm_dlc **, const struct btproto *, void *);
 int rfcomm_bind(struct rfcomm_dlc *, struct sockaddr_bt *);
 int rfcomm_sockaddr(struct rfcomm_dlc *, struct sockaddr_bt *);
 int rfcomm_connect(struct rfcomm_dlc *, struct sockaddr_bt *);
 int rfcomm_peeraddr(struct rfcomm_dlc *, struct sockaddr_bt *);
 int rfcomm_disconnect(struct rfcomm_dlc *, int);
-void rfcomm_detach(struct rfcomm_dlc **);
+void rfcomm_detach_pcb(struct rfcomm_dlc **);
 int rfcomm_listen(struct rfcomm_dlc *);
 int rfcomm_send(struct rfcomm_dlc *, struct mbuf *);
 int rfcomm_rcvd(struct rfcomm_dlc *, size_t);

Index: src/sys/netbt/rfcomm_session.c
diff -u src/sys/netbt/rfcomm_session.c:1.18 src/sys/netbt/rfcomm_session.c:1.19
--- src/sys/netbt/rfcomm_session.c:1.18	Wed Jul 27 10:25:09 2011
+++ src/sys/netbt/rfcomm_session.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rfcomm_session.c,v 1.18 2011/07/27 10:25:09 plunky Exp $	*/
+/*	$NetBSD: rfcomm_session.c,v 1.19 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rfcomm_session.c,v 1.18 2011/07/27 10:25:09 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rfcomm_session.c,v 1.19 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -185,7 +185,7 @@ rfcomm_session_alloc(struct rfcomm_sessi
 	SIMPLEQ_INIT(&rs->rs_credits);
 	LIST_INIT(&rs->rs_dlcs);
 
-	err = l2cap_attach(&rs->rs_l2cap, &rfcomm_session_proto, rs);
+	err = l2cap_attach_pcb(&rs->rs_l2cap, &rfcomm_session_proto, rs);
 	if (err) {
 		free(rs, M_BLUETOOTH);
 		return NULL;
@@ -250,7 +250,7 @@ rfcomm_session_free(struct rfcomm_sessio
 
 	/* Goodbye! */
 	LIST_REMOVE(rs, rs_next);
-	l2cap_detach(&rs->rs_l2cap);
+	l2cap_detach_pcb(&rs->rs_l2cap);
 	callout_destroy(&rs->rs_timeout);
 	free(rs, M_BLUETOOTH);
 }

Index: src/sys/netbt/rfcomm_socket.c
diff -u src/sys/netbt/rfcomm_socket.c:1.14 src/sys/netbt/rfcomm_socket.c:1.15
--- src/sys/netbt/rfcomm_socket.c:1.14	Mon May 19 15:44:04 2014
+++ src/sys/netbt/rfcomm_socket.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rfcomm_socket.c,v 1.14 2014/05/19 15:44:04 martin Exp $	*/
+/*	$NetBSD: rfcomm_socket.c,v 1.15 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rfcomm_socket.c,v 1.14 2014/05/19 15:44:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rfcomm_socket.c,v 1.15 2014/05/20 18:25:54 rmind Exp $");
 
 /* load symbolic names */
 #ifdef BLUETOOTH_DEBUG
@@ -82,7 +82,7 @@ int rfcomm_sendspace = 4096;
 int rfcomm_recvspace = 4096;
 
 static int
-rfcomm_attach1(struct socket *so, int proto)
+rfcomm_attach(struct socket *so, int proto)
 {
 	int error;
 
@@ -103,24 +103,24 @@ rfcomm_attach1(struct socket *so, int pr
 	if (error)
 		return error;
 
-	error = rfcomm_attach((struct rfcomm_dlc **)&so->so_pcb,
+	error = rfcomm_attach_pcb((struct rfcomm_dlc **)&so->so_pcb,
 				&rfcomm_proto, so);
 	if (error)
 		return error;
 
 	error = rfcomm_rcvd(so->so_pcb, sbspace(&so->so_rcv));
 	if (error) {
-		rfcomm_detach((struct rfcomm_dlc **)&so->so_pcb);
+		rfcomm_detach_pcb((struct rfcomm_dlc **)&so->so_pcb);
 		return error;
 	}
 	return 0;
 }
 
 static void
-rfcomm_detach1(struct socket *so)
+rfcomm_detach(struct socket *so)
 {
 	KASSERT(so->so_pcb != NULL);
-	rfcomm_detach((struct rfcomm_dlc **)&so->so_pcb);
+	rfcomm_detach_pcb((struct rfcomm_dlc **)&so->so_pcb);
 	KASSERT(so->so_pcb == NULL);
 }
 
@@ -175,7 +175,7 @@ rfcomm_usrreq(struct socket *up, int req
 	case PRU_ABORT:
 		rfcomm_disconnect(pcb, 0);
 		soisdisconnected(up);
-		rfcomm_detach1(up);
+		rfcomm_detach(up);
 		return 0;
 
 	case PRU_BIND:
@@ -426,10 +426,12 @@ rfcomm_input(void *arg, struct mbuf *m)
 
 PR_WRAP_USRREQ(rfcomm_usrreq)
 
+//#define	rfcomm_attach		rfcomm_attach_wrapper
+//#define	rfcomm_detach		rfcomm_detach_wrapper
 #define	rfcomm_usrreq		rfcomm_usrreq_wrapper
 
 const struct pr_usrreqs rfcomm_usrreqs = {
-	.pr_attach	= rfcomm_attach1,
-	.pr_detach	= rfcomm_detach1,
+	.pr_attach	= rfcomm_attach,
+	.pr_detach	= rfcomm_detach,
 	.pr_generic	= rfcomm_usrreq,
 };
Index: src/sys/netbt/rfcomm_upper.c
diff -u src/sys/netbt/rfcomm_upper.c:1.14 src/sys/netbt/rfcomm_upper.c:1.15
--- src/sys/netbt/rfcomm_upper.c:1.14	Mon May 19 02:51:24 2014
+++ src/sys/netbt/rfcomm_upper.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rfcomm_upper.c,v 1.14 2014/05/19 02:51:24 rmind Exp $	*/
+/*	$NetBSD: rfcomm_upper.c,v 1.15 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rfcomm_upper.c,v 1.14 2014/05/19 02:51:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rfcomm_upper.c,v 1.15 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -56,12 +56,12 @@ __KERNEL_RCSID(0, "$NetBSD: rfcomm_upper
  */
 
 /*
- * rfcomm_attach(handle, proto, upper)
+ * rfcomm_attach_pcb(handle, proto, upper)
  *
  * attach a new RFCOMM DLC to handle, populate with reasonable defaults
  */
 int
-rfcomm_attach(struct rfcomm_dlc **handle,
+rfcomm_attach_pcb(struct rfcomm_dlc **handle,
 		const struct btproto *proto, void *upper)
 {
 	struct rfcomm_dlc *dlc;
@@ -268,12 +268,12 @@ rfcomm_disconnect(struct rfcomm_dlc *dlc
 }
 
 /*
- * rfcomm_detach(handle)
+ * rfcomm_detach_pcb(handle)
  *
  * detach RFCOMM DLC from handle
  */
 void
-rfcomm_detach(struct rfcomm_dlc **handle)
+rfcomm_detach_pcb(struct rfcomm_dlc **handle)
 {
 	struct rfcomm_dlc *dlc = *handle;
 

Index: src/sys/netbt/sco.h
diff -u src/sys/netbt/sco.h:1.5 src/sys/netbt/sco.h:1.6
--- src/sys/netbt/sco.h:1.5	Mon May 19 02:51:24 2014
+++ src/sys/netbt/sco.h	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sco.h,v 1.5 2014/05/19 02:51:24 rmind Exp $	*/
+/*	$NetBSD: sco.h,v 1.6 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -68,13 +68,13 @@ extern int sco_recvspace;
 int sco_ctloutput(int, struct socket *, struct sockopt *);
 
 /* sco_upper.c */
-int sco_attach(struct sco_pcb **, const struct btproto *, void *);
+int sco_attach_pcb(struct sco_pcb **, const struct btproto *, void *);
 int sco_bind(struct sco_pcb *, struct sockaddr_bt *);
 int sco_sockaddr(struct sco_pcb *, struct sockaddr_bt *);
 int sco_connect(struct sco_pcb *, struct sockaddr_bt *);
 int sco_peeraddr(struct sco_pcb *, struct sockaddr_bt *);
 int sco_disconnect(struct sco_pcb *, int);
-void sco_detach(struct sco_pcb **);
+void sco_detach_pcb(struct sco_pcb **);
 int sco_listen(struct sco_pcb *);
 int sco_send(struct sco_pcb *, struct mbuf *);
 int sco_setopt(struct sco_pcb *, const struct sockopt *);

Index: src/sys/netbt/sco_socket.c
diff -u src/sys/netbt/sco_socket.c:1.15 src/sys/netbt/sco_socket.c:1.16
--- src/sys/netbt/sco_socket.c:1.15	Mon May 19 15:44:04 2014
+++ src/sys/netbt/sco_socket.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sco_socket.c,v 1.15 2014/05/19 15:44:04 martin Exp $	*/
+/*	$NetBSD: sco_socket.c,v 1.16 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sco_socket.c,v 1.15 2014/05/19 15:44:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sco_socket.c,v 1.16 2014/05/20 18:25:54 rmind Exp $");
 
 /* load symbolic names */
 #ifdef BLUETOOTH_DEBUG
@@ -79,7 +79,7 @@ int sco_sendspace = 4096;
 int sco_recvspace = 4096;
 
 static int
-sco_attach1(struct socket *so, int proto)
+sco_attach(struct socket *so, int proto)
 {
 	int error;
 
@@ -96,14 +96,14 @@ sco_attach1(struct socket *so, int proto
 	if (error) {
 		return error;
 	}
-	return sco_attach((struct sco_pcb **)&so->so_pcb, &sco_proto, so);
+	return sco_attach_pcb((struct sco_pcb **)&so->so_pcb, &sco_proto, so);
 }
 
 static void
-sco_detach1(struct socket *so)
+sco_detach(struct socket *so)
 {
 	KASSERT(so->so_pcb != NULL);
-	sco_detach((struct sco_pcb **)&so->so_pcb);
+	sco_detach_pcb((struct sco_pcb **)&so->so_pcb);
 	KASSERT(so->so_pcb == NULL);
 }
 
@@ -157,7 +157,7 @@ sco_usrreq(struct socket *up, int req, s
 	case PRU_ABORT:
 		sco_disconnect(pcb, 0);
 		soisdisconnected(up);
-		sco_detach1(up);
+		sco_detach(up);
 		return 0;
 
 	case PRU_BIND:
@@ -381,10 +381,12 @@ sco_input(void *arg, struct mbuf *m)
 
 PR_WRAP_USRREQ(sco_usrreq)
 
+//#define	sco_attach		sco_attach_wrapper
+//#define	sco_detach		sco_detach_wrapper
 #define	sco_usrreq		sco_usrreq_wrapper
 
 const struct pr_usrreqs sco_usrreqs = {
-	.pr_attach	= sco_attach1,
-	.pr_detach	= sco_detach1,
+	.pr_attach	= sco_attach,
+	.pr_detach	= sco_detach,
 	.pr_generic	= sco_usrreq,
 };

Index: src/sys/netbt/sco_upper.c
diff -u src/sys/netbt/sco_upper.c:1.10 src/sys/netbt/sco_upper.c:1.11
--- src/sys/netbt/sco_upper.c:1.10	Mon May 19 02:51:24 2014
+++ src/sys/netbt/sco_upper.c	Tue May 20 18:25:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sco_upper.c,v 1.10 2014/05/19 02:51:24 rmind Exp $	*/
+/*	$NetBSD: sco_upper.c,v 1.11 2014/05/20 18:25:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sco_upper.c,v 1.10 2014/05/19 02:51:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sco_upper.c,v 1.11 2014/05/20 18:25:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -53,12 +53,12 @@ __KERNEL_RCSID(0, "$NetBSD: sco_upper.c,
 struct sco_pcb_list sco_pcb = LIST_HEAD_INITIALIZER(sco_pcb);
 
 /*
- * sco_attach(handle, proto, upper)
+ * sco_attach_pcb(handle, proto, upper)
  *
  *	Attach a new instance of SCO pcb to handle
  */
 int
-sco_attach(struct sco_pcb **handle,
+sco_attach_pcb(struct sco_pcb **handle,
 		const struct btproto *proto, void *upper)
 {
 	struct sco_pcb *pcb;
@@ -222,12 +222,12 @@ sco_disconnect(struct sco_pcb *pcb, int 
 }
 
 /*
- * sco_detach(handle)
+ * sco_detach_pcb(handle)
  *
  *	Detach SCO pcb from handle and clear up
  */
 void
-sco_detach(struct sco_pcb **handle)
+sco_detach_pcb(struct sco_pcb **handle)
 {
 	struct sco_pcb *pcb;
 

Reply via email to