sys/netgraph7/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c
static int
ubtbcmfw_close(struct cdev *dev, int flag, int mode, struct thread *p)
{
	ubtbcmfw_softc_p	sc = NULL;

	sc = devclass_get_softc(ubtbcmfw_devclass, UBTBCMFW_UNIT(dev));
	if (sc == NULL)
		return (ENXIO);

	switch (UBTBCMFW_ENDPOINT(dev)) {
	case USB_CONTROL_ENDPOINT:
		sc->sc_flags &= ~UBTBCMFW_CTRL_DEV;
		break;

	case UBTBCMFW_INTR_IN:
		if (sc->sc_intr_in_pipe != NULL)
			usbd_abort_pipe(sc->sc_intr_in_pipe);

		sc->sc_flags &= ~UBTBCMFW_INTR_IN_DEV;
		break;

	case UBTBCMFW_BULK_OUT:
		if (sc->sc_bulk_out_pipe != NULL)
			usbd_abort_pipe(sc->sc_bulk_out_pipe);

		sc->sc_flags &= ~UBTBCMFW_BULK_OUT_DEV;
		break;
	}

	return (0);
}
/*
 * Close endpoint device
 * XXX FIXME softc locking
 */
Close endpoint device
XXX FIXME softc locking
Close endpoint device XXX FIXME softc locking
static int
ubtbcmfw_close(struct cdev *dev, int flag, int mode, struct thread *p)
{
	ubtbcmfw_softc_p	sc = NULL;
	sc = devclass_get_softc(ubtbcmfw_devclass, UBTBCMFW_UNIT(dev));
	if (sc == NULL)
		return (ENXIO);
	switch (UBTBCMFW_ENDPOINT(dev)) {
	case USB_CONTROL_ENDPOINT:
		sc->sc_flags &= ~UBTBCMFW_CTRL_DEV;
		break;
	case UBTBCMFW_INTR_IN:
		if (sc->sc_intr_in_pipe != NULL)
			usbd_abort_pipe(sc->sc_intr_in_pipe);
		sc->sc_flags &= ~UBTBCMFW_INTR_IN_DEV;
		break;
	case UBTBCMFW_BULK_OUT:
		if (sc->sc_bulk_out_pipe != NULL)
			usbd_abort_pipe(sc->sc_bulk_out_pipe);
		sc->sc_flags &= ~UBTBCMFW_BULK_OUT_DEV;
		break;
	}
	return (0);
}
static int ubtbcmfw_close ( struct cdev * dev , int flag , int mode , struct thread * p ) { ubtbcmfw_softc_p sc = NULL ; sc = devclass_get_softc ( ubtbcmfw_devclass , UBTBCMFW_UNIT ( dev ) ) ; if ( sc == NULL ) return ( ENXIO ) ; switch ( UBTBCMFW_ENDPOINT ( dev ) ) { case USB_CONTROL_ENDPOINT : sc -> sc_flags &= ~ UBTBCMFW_CTRL_DEV ; break ; case UBTBCMFW_INTR_IN : if ( sc -> sc_intr_in_pipe != NULL ) usbd_abort_pipe ( sc -> sc_intr_in_pipe ) ; sc -> sc_flags &= ~ UBTBCMFW_INTR_IN_DEV ; break ; case UBTBCMFW_BULK_OUT : if ( sc -> sc_bulk_out_pipe != NULL ) usbd_abort_pipe ( sc -> sc_bulk_out_pipe ) ; sc -> sc_flags &= ~ UBTBCMFW_BULK_OUT_DEV ; break ; } return ( 0 ) ; }
Close endpoint device
 XXX FIXME softc locking
Close endpoint device XXX FIXME softc locking