Deleted Added
sdiff udiff text old ( 249178 ) new ( 253255 )
full compact
1/*
2 * ng_ubt.c
3 */
4
5/*-
6 * Copyright (c) 2001-2009 Maksim Yevmenkin <m_evmenkin@yahoo.com>
7 * All rights reserved.
8 *

--- 14 unchanged lines hidden (view full) ---

23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * $Id: ng_ubt.c,v 1.16 2003/10/10 19:15:06 max Exp $
31 * $FreeBSD: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c 249178 2013-04-05 23:41:38Z adrian $
32 */
33
34/*
35 * NOTE: ng_ubt2 driver has a split personality. On one side it is
36 * a USB device driver and on the other it is a Netgraph node. This
37 * driver will *NOT* create traditional /dev/ enties, only Netgraph
38 * node.
39 *

--- 64 unchanged lines hidden (view full) ---

104#include <sys/lock.h>
105#include <sys/mutex.h>
106#include <sys/condvar.h>
107#include <sys/sysctl.h>
108#include <sys/sx.h>
109#include <sys/unistd.h>
110#include <sys/callout.h>
111#include <sys/malloc.h>
112#include <sys/priv.h>
113
114#include "usbdevs.h"
115#include <dev/usb/usb.h>
116#include <dev/usb/usbdi.h>
117#include <dev/usb/usbdi_util.h>
118
119#define USB_DEBUG_VAR usb_debug
120#include <dev/usb/usb_debug.h>
121#include <dev/usb/usb_busdma.h>
122
123#include <sys/mbuf.h>
124#include <sys/taskqueue.h>
125
126#include <netgraph/ng_message.h>
127#include <netgraph/netgraph.h>
128#include <netgraph/ng_parse.h>
129#include <netgraph/bluetooth/include/ng_bluetooth.h>
130#include <netgraph/bluetooth/include/ng_hci.h>
131#include <netgraph/bluetooth/include/ng_ubt.h>
132#include <netgraph/bluetooth/drivers/ubt/ng_ubt_var.h>
133

--- 348 unchanged lines hidden (view full) ---

482 uint16_t wMaxPacketSize;
483 uint8_t alt_index, i, j;
484 uint8_t iface_index[2] = { 0, 1 };
485
486 device_set_usb_desc(dev);
487
488 sc->sc_dev = dev;
489 sc->sc_debug = NG_UBT_WARN_LEVEL;
490
491 /*
492 * Create Netgraph node
493 */
494
495 if (ng_make_node_common(&typestruct, &sc->sc_node) != 0) {
496 UBT_ALERT(sc, "could not create Netgraph node\n");
497 return (ENXIO);
498 }
499
500 /* Name Netgraph node */
501 if (ng_name_node(sc->sc_node, device_get_nameunit(dev)) != 0) {
502 UBT_ALERT(sc, "could not name Netgraph node\n");
503 NG_NODE_UNREF(sc->sc_node);
504 return (ENXIO);
505 }
506 NG_NODE_SET_PRIVATE(sc->sc_node, sc);
507 NG_NODE_FORCE_WRITER(sc->sc_node);
508
509 /*
510 * Initialize device softc structure
511 */
512
513 /* initialize locks */
514 mtx_init(&sc->sc_ng_mtx, "ubt ng", NULL, MTX_DEF);
515 mtx_init(&sc->sc_if_mtx, "ubt if", NULL, MTX_DEF | MTX_RECURSE);

--- 110 unchanged lines hidden (view full) ---

626ubt_detach(device_t dev)
627{
628 struct ubt_softc *sc = device_get_softc(dev);
629 node_p node = sc->sc_node;
630
631 /* Destroy Netgraph node */
632 if (node != NULL) {
633 sc->sc_node = NULL;
634 NG_NODE_REALLY_DIE(node);
635 ng_rmnode_self(node);
636 }
637
638 /* Make sure ubt_task in gone */
639 taskqueue_drain(taskqueue_swi, &sc->sc_task);
640
641 /* Free USB transfers, if any */
642 usbd_transfer_unsetup(sc->sc_xfer, UBT_N_TRANSFER);
643

--- 1174 unchanged lines hidden ---