From owner-svn-src-stable@FreeBSD.ORG Thu Apr 29 22:48:20 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4DAE8106564A; Thu, 29 Apr 2010 22:48:20 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 3A7618FC1A; Thu, 29 Apr 2010 22:48:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3TMmKOc082082; Thu, 29 Apr 2010 22:48:20 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3TMmKtS082076; Thu, 29 Apr 2010 22:48:20 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201004292248.o3TMmKtS082076@svn.freebsd.org> From: Andrew Thompson Date: Thu, 29 Apr 2010 22:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207402 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Apr 2010 22:48:20 -0000 Author: thompsa Date: Thu Apr 29 22:48:19 2010 New Revision: 207402 URL: http://svn.freebsd.org/changeset/base/207402 Log: MFC r207079 Properly name the sxlocks, mutexes and condvars. Modified: stable/8/sys/dev/usb/usb_dev.c stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_device.h stable/8/sys/dev/usb/usb_request.c stable/8/sys/dev/usb/usb_transfer.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/geom/sched/ (props changed) Modified: stable/8/sys/dev/usb/usb_dev.c ============================================================================== --- stable/8/sys/dev/usb/usb_dev.c Thu Apr 29 22:48:16 2010 (r207401) +++ stable/8/sys/dev/usb/usb_dev.c Thu Apr 29 22:48:19 2010 (r207402) @@ -284,7 +284,7 @@ error: usbd_enum_unlock(cpd->udev); if (--(cpd->udev->refcount) == 0) { - cv_signal(cpd->udev->default_cv + 1); + cv_signal(&cpd->udev->ref_cv); } } mtx_unlock(&usb_ref_lock); @@ -352,7 +352,7 @@ usb_unref_device(struct usb_cdev_privdat } if (crd->is_uref) { if (--(cpd->udev->refcount) == 0) { - cv_signal(cpd->udev->default_cv + 1); + cv_signal(&cpd->udev->ref_cv); } crd->is_uref = 0; } @@ -500,7 +500,7 @@ usb_fifo_create(struct usb_cdev_privdata /* update some fields */ f->fifo_index = n + USB_FIFO_TX; f->dev_ep_index = e; - f->priv_mtx = udev->default_mtx; + f->priv_mtx = &udev->device_mtx; f->priv_sc0 = ep; f->methods = &usb_ugen_methods; f->iface_index = ep->iface_index; @@ -527,7 +527,7 @@ usb_fifo_create(struct usb_cdev_privdata /* update some fields */ f->fifo_index = n + USB_FIFO_RX; f->dev_ep_index = e; - f->priv_mtx = udev->default_mtx; + f->priv_mtx = &udev->device_mtx; f->priv_sc0 = ep; f->methods = &usb_ugen_methods; f->iface_index = ep->iface_index; Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Thu Apr 29 22:48:16 2010 (r207401) +++ stable/8/sys/dev/usb/usb_device.c Thu Apr 29 22:48:19 2010 (r207402) @@ -655,7 +655,7 @@ usb_config_parse(struct usb_device *udev goto cleanup; if (cmd == USB_CFG_INIT) { - sx_assert(udev->default_sx + 1, SA_LOCKED); + sx_assert(&udev->enum_sx, SA_LOCKED); /* check for in-use endpoints */ @@ -1062,7 +1062,7 @@ usb_detach_device(struct usb_device *ude } DPRINTFN(4, "udev=%p\n", udev); - sx_assert(udev->default_sx + 1, SA_LOCKED); + sx_assert(&udev->enum_sx, SA_LOCKED); /* * First detach the child to give the child's detach routine a @@ -1380,7 +1380,7 @@ usb_suspend_resume(struct usb_device *ud } DPRINTFN(4, "udev=%p do_suspend=%d\n", udev, do_suspend); - sx_assert(udev->default_sx + 1, SA_LOCKED); + sx_assert(&udev->enum_sx, SA_LOCKED); USB_BUS_LOCK(udev->bus); /* filter the suspend events */ @@ -1419,13 +1419,13 @@ usbd_clear_stall_proc(struct usb_proc_ms /* Change lock */ USB_BUS_UNLOCK(udev->bus); - mtx_lock(udev->default_mtx); + mtx_lock(&udev->device_mtx); /* Start clear stall callback */ usbd_transfer_start(udev->default_xfer[1]); /* Change lock */ - mtx_unlock(udev->default_mtx); + mtx_unlock(&udev->device_mtx); USB_BUS_LOCK(udev->bus); } @@ -1491,16 +1491,16 @@ usb_alloc_device(device_t parent_dev, st return (NULL); } /* initialise our SX-lock */ - sx_init_flags(udev->default_sx, "USB device SX lock", SX_DUPOK); + sx_init_flags(&udev->ctrl_sx, "USB device SX lock", SX_DUPOK); /* initialise our SX-lock */ - sx_init_flags(udev->default_sx + 1, "USB config SX lock", SX_DUPOK); + sx_init_flags(&udev->enum_sx, "USB config SX lock", SX_DUPOK); - cv_init(udev->default_cv, "WCTRL"); - cv_init(udev->default_cv + 1, "UGONE"); + cv_init(&udev->ctrlreq_cv, "WCTRL"); + cv_init(&udev->ref_cv, "UGONE"); /* initialise our mutex */ - mtx_init(udev->default_mtx, "USB device mutex", NULL, MTX_DEF); + mtx_init(&udev->device_mtx, "USB device mutex", NULL, MTX_DEF); /* initialise generic clear stall */ udev->cs_msg[0].hdr.pm_callback = &usbd_clear_stall_proc; @@ -2005,7 +2005,7 @@ usb_free_device(struct usb_device *udev, mtx_lock(&usb_ref_lock); udev->refcount--; while (udev->refcount != 0) { - cv_wait(udev->default_cv + 1, &usb_ref_lock); + cv_wait(&udev->ref_cv, &usb_ref_lock); } mtx_unlock(&usb_ref_lock); @@ -2036,13 +2036,13 @@ usb_free_device(struct usb_device *udev, &udev->cs_msg[0], &udev->cs_msg[1]); USB_BUS_UNLOCK(udev->bus); - sx_destroy(udev->default_sx); - sx_destroy(udev->default_sx + 1); + sx_destroy(&udev->ctrl_sx); + sx_destroy(&udev->enum_sx); - cv_destroy(udev->default_cv); - cv_destroy(udev->default_cv + 1); + cv_destroy(&udev->ctrlreq_cv); + cv_destroy(&udev->ref_cv); - mtx_destroy(udev->default_mtx); + mtx_destroy(&udev->device_mtx); #if USB_HAVE_UGEN KASSERT(LIST_FIRST(&udev->pd_list) == NULL, ("leaked cdev entries")); #endif @@ -2588,7 +2588,7 @@ usbd_device_attached(struct usb_device * void usbd_enum_lock(struct usb_device *udev) { - sx_xlock(udev->default_sx + 1); + sx_xlock(&udev->enum_sx); /* * NEWBUS LOCK NOTE: We should check if any parent SX locks * are locked before locking Giant. Else the lock can be @@ -2603,7 +2603,7 @@ void usbd_enum_unlock(struct usb_device *udev) { mtx_unlock(&Giant); - sx_xunlock(udev->default_sx + 1); + sx_xunlock(&udev->enum_sx); } /* @@ -2614,5 +2614,5 @@ usbd_enum_unlock(struct usb_device *udev uint8_t usbd_enum_is_locked(struct usb_device *udev) { - return (sx_xlocked(udev->default_sx + 1)); + return (sx_xlocked(&udev->enum_sx)); } Modified: stable/8/sys/dev/usb/usb_device.h ============================================================================== --- stable/8/sys/dev/usb/usb_device.h Thu Apr 29 22:48:16 2010 (r207401) +++ stable/8/sys/dev/usb/usb_device.h Thu Apr 29 22:48:19 2010 (r207402) @@ -113,9 +113,11 @@ struct usb_power_save { struct usb_device { struct usb_clear_stall_msg cs_msg[2]; /* generic clear stall * messages */ - struct sx default_sx[2]; - struct mtx default_mtx[1]; - struct cv default_cv[2]; + struct sx ctrl_sx; + struct sx enum_sx; + struct mtx device_mtx; + struct cv ctrlreq_cv; + struct cv ref_cv; struct usb_interface *ifaces; struct usb_endpoint default_ep; /* Control Endpoint 0 */ struct usb_endpoint *endpoints; Modified: stable/8/sys/dev/usb/usb_request.c ============================================================================== --- stable/8/sys/dev/usb/usb_request.c Thu Apr 29 22:48:16 2010 (r207401) +++ stable/8/sys/dev/usb/usb_request.c Thu Apr 29 22:48:19 2010 (r207402) @@ -99,7 +99,7 @@ usbd_do_request_callback(struct usb_xfer usbd_transfer_submit(xfer); break; default: - cv_signal(xfer->xroot->udev->default_cv); + cv_signal(&xfer->xroot->udev->ctrlreq_cv); break; } } @@ -319,7 +319,7 @@ usbd_do_request_flags(struct usb_device * is achieved when multiple threads are involved: */ - sx_xlock(udev->default_sx); + sx_xlock(&udev->ctrl_sx); hr_func = usbd_get_hr_func(udev); @@ -457,7 +457,7 @@ usbd_do_request_flags(struct usb_device usbd_transfer_start(xfer); while (usbd_transfer_pending(xfer)) { - cv_wait(udev->default_cv, + cv_wait(&udev->ctrlreq_cv, xfer->xroot->xfer_mtx); } @@ -534,7 +534,7 @@ usbd_do_request_flags(struct usb_device USB_XFER_UNLOCK(xfer); done: - sx_xunlock(udev->default_sx); + sx_xunlock(&udev->ctrl_sx); if (mtx) { mtx_lock(mtx); Modified: stable/8/sys/dev/usb/usb_transfer.c ============================================================================== --- stable/8/sys/dev/usb/usb_transfer.c Thu Apr 29 22:48:16 2010 (r207401) +++ stable/8/sys/dev/usb/usb_transfer.c Thu Apr 29 22:48:19 2010 (r207402) @@ -2821,7 +2821,7 @@ repeat: iface_index = 0; if (usbd_transfer_setup(udev, &iface_index, udev->default_xfer, usb_control_ep_cfg, USB_DEFAULT_XFER_MAX, NULL, - udev->default_mtx)) { + &udev->device_mtx)) { DPRINTFN(0, "could not setup default " "USB transfer\n"); } else {