Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/usb/usb_device.c
Show First 20 Lines • Show All 1,779 Lines • ▼ Show 20 Lines | usb_alloc_device(device_t parent_dev, struct usb_bus *bus, | ||||
} | } | ||||
if (depth > 0x10) { | if (depth > 0x10) { | ||||
device_printf(bus->bdev, | device_printf(bus->bdev, | ||||
"Invalid device depth\n"); | "Invalid device depth\n"); | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
udev = malloc(sizeof(*udev), M_USB, M_WAITOK | M_ZERO); | udev = malloc(sizeof(*udev), M_USB, M_WAITOK | M_ZERO); | ||||
#if (USB_HAVE_MALLOC_WAITOK == 0) | |||||
if (udev == NULL) { | if (udev == NULL) { | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
#endif | |||||
/* initialise our SX-lock */ | /* initialise our SX-lock */ | ||||
sx_init_flags(&udev->enum_sx, "USB config SX lock", SX_DUPOK); | sx_init_flags(&udev->enum_sx, "USB config SX lock", SX_DUPOK); | ||||
sx_init_flags(&udev->sr_sx, "USB suspend and resume SX lock", SX_NOWITNESS); | sx_init_flags(&udev->sr_sx, "USB suspend and resume SX lock", SX_NOWITNESS); | ||||
sx_init_flags(&udev->ctrl_sx, "USB control transfer SX lock", SX_DUPOK); | sx_init_flags(&udev->ctrl_sx, "USB control transfer SX lock", SX_DUPOK); | ||||
cv_init(&udev->ctrlreq_cv, "WCTRL"); | cv_init(&udev->ctrlreq_cv, "WCTRL"); | ||||
cv_init(&udev->ref_cv, "UGONE"); | cv_init(&udev->ref_cv, "UGONE"); | ||||
▲ Show 20 Lines • Show All 1,303 Lines • Show Last 20 Lines |