sys/netgraph7/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c
static int
ubtbcmfw_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag,
  struct thread *p)
{
	ubtbcmfw_softc_p	sc = NULL;
	int			error = 0;

	sc = devclass_get_softc(ubtbcmfw_devclass, UBTBCMFW_UNIT(dev));
	if (sc == NULL || sc->sc_dying)
		return (ENXIO);

	if (UBTBCMFW_ENDPOINT(dev) != USB_CONTROL_ENDPOINT)
		return (EOPNOTSUPP);

	sc->sc_refcnt ++;

	switch (cmd) {
	case USB_GET_DEVICE_DESC:
		*(usb_device_descriptor_t *) data =
				*usbd_get_device_descriptor(sc->sc_udev);
		break;

	default:
		error = EINVAL;
		break;
	}

	if (-- sc->sc_refcnt < 0)
		usb_detach_wakeup(sc->sc_dev);

	return (error);
}
/*
 * Process ioctl on the endpoint device
 * XXX FIXME softc locking
 */
Process ioctl on the endpoint device
XXX FIXME softc locking
Process ioctl on the endpoint device XXX FIXME softc locking
static int
ubtbcmfw_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag,
  struct thread *p)
{
	ubtbcmfw_softc_p	sc = NULL;
	int			error = 0;
	sc = devclass_get_softc(ubtbcmfw_devclass, UBTBCMFW_UNIT(dev));
	if (sc == NULL || sc->sc_dying)
		return (ENXIO);
	if (UBTBCMFW_ENDPOINT(dev) != USB_CONTROL_ENDPOINT)
		return (EOPNOTSUPP);
	sc->sc_refcnt ++;
	switch (cmd) {
	case USB_GET_DEVICE_DESC:
		*(usb_device_descriptor_t *) data =
				*usbd_get_device_descriptor(sc->sc_udev);
		break;
	default:
		error = EINVAL;
		break;
	}
	if (-- sc->sc_refcnt < 0)
		usb_detach_wakeup(sc->sc_dev);
	return (error);
}
static int ubtbcmfw_ioctl ( struct cdev * dev , u_long cmd , caddr_t data , int flag , struct thread * p ) { ubtbcmfw_softc_p sc = NULL ; int error = 0 ; sc = devclass_get_softc ( ubtbcmfw_devclass , UBTBCMFW_UNIT ( dev ) ) ; if ( sc == NULL || sc -> sc_dying ) return ( ENXIO ) ; if ( UBTBCMFW_ENDPOINT ( dev ) != USB_CONTROL_ENDPOINT ) return ( EOPNOTSUPP ) ; sc -> sc_refcnt ++ ; switch ( cmd ) { case USB_GET_DEVICE_DESC : * ( usb_device_descriptor_t * ) data = * usbd_get_device_descriptor ( sc -> sc_udev ) ; break ; default : error = EINVAL ; break ; } if ( -- sc -> sc_refcnt < 0 ) usb_detach_wakeup ( sc -> sc_dev ) ; return ( error ) ; }
Process ioctl on the endpoint device
 XXX FIXME softc locking
Process ioctl on the endpoint device XXX FIXME softc locking