Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*


 441             usba_hcdi_get_hcdi(usba_device->usb_root_hub_dip)->
 442             hcdi_iblock_cookie;
 443 
 444         USB_DPRINTF_L4(DPRINT_MASK_USBAI, usbai_log_handle,
 445             "usba_init_pipe_handle: "
 446             "usba_device=0x%p ep=0x%x", (void *)usba_device,
 447             ep->bEndpointAddress);
 448         mutex_init(&ph_data->p_mutex, NULL, MUTEX_DRIVER, iblock_cookie);
 449 
 450         /* just to keep warlock happy, there is no contention yet */
 451         mutex_enter(&ph_data->p_mutex);
 452         mutex_enter(&usba_device->usb_mutex);
 453 
 454         ASSERT(pipe_policy->pp_max_async_reqs);
 455 
 456         if (instance != -1) {
 457                 (void) snprintf(tq_name, sizeof (tq_name),
 458                     "USB_%s_%x_pipehndl_tq_%d",
 459                     ddi_driver_name(dip), ep->bEndpointAddress, instance);
 460         } else {
 461                 def_instance = atomic_add_32_nv(&anon_instance, 1);
 462 
 463                 (void) snprintf(tq_name, sizeof (tq_name),
 464                     "USB_%s_%x_pipehndl_tq_%d_",
 465                     ddi_driver_name(dip), ep->bEndpointAddress, def_instance);
 466         }
 467 
 468         ph_data->p_taskq = taskq_create(tq_name,
 469             pipe_policy->pp_max_async_reqs + 1,
 470             ((ep->bmAttributes & USB_EP_ATTR_MASK) ==
 471             USB_EP_ATTR_ISOCH) ?
 472             (maxclsyspri - 5) : minclsyspri,
 473             2 * (pipe_policy->pp_max_async_reqs + 1),
 474             8 * (pipe_policy->pp_max_async_reqs + 1),
 475             TASKQ_PREPOPULATE);
 476 
 477         /*
 478          * Create a shared taskq.
 479          */
 480         if (ph_data->p_spec_flag & USBA_PH_FLAG_TQ_SHARE) {
 481                 int iface = usb_get_if_number(dip);




 441             usba_hcdi_get_hcdi(usba_device->usb_root_hub_dip)->
 442             hcdi_iblock_cookie;
 443 
 444         USB_DPRINTF_L4(DPRINT_MASK_USBAI, usbai_log_handle,
 445             "usba_init_pipe_handle: "
 446             "usba_device=0x%p ep=0x%x", (void *)usba_device,
 447             ep->bEndpointAddress);
 448         mutex_init(&ph_data->p_mutex, NULL, MUTEX_DRIVER, iblock_cookie);
 449 
 450         /* just to keep warlock happy, there is no contention yet */
 451         mutex_enter(&ph_data->p_mutex);
 452         mutex_enter(&usba_device->usb_mutex);
 453 
 454         ASSERT(pipe_policy->pp_max_async_reqs);
 455 
 456         if (instance != -1) {
 457                 (void) snprintf(tq_name, sizeof (tq_name),
 458                     "USB_%s_%x_pipehndl_tq_%d",
 459                     ddi_driver_name(dip), ep->bEndpointAddress, instance);
 460         } else {
 461                 def_instance = atomic_inc_32_nv(&anon_instance);
 462 
 463                 (void) snprintf(tq_name, sizeof (tq_name),
 464                     "USB_%s_%x_pipehndl_tq_%d_",
 465                     ddi_driver_name(dip), ep->bEndpointAddress, def_instance);
 466         }
 467 
 468         ph_data->p_taskq = taskq_create(tq_name,
 469             pipe_policy->pp_max_async_reqs + 1,
 470             ((ep->bmAttributes & USB_EP_ATTR_MASK) ==
 471             USB_EP_ATTR_ISOCH) ?
 472             (maxclsyspri - 5) : minclsyspri,
 473             2 * (pipe_policy->pp_max_async_reqs + 1),
 474             8 * (pipe_policy->pp_max_async_reqs + 1),
 475             TASKQ_PREPOPULATE);
 476 
 477         /*
 478          * Create a shared taskq.
 479          */
 480         if (ph_data->p_spec_flag & USBA_PH_FLAG_TQ_SHARE) {
 481                 int iface = usb_get_if_number(dip);