From owner-p4-projects@FreeBSD.ORG Thu Jun 4 22:42:29 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C44B91065693; Thu, 4 Jun 2009 22:42:28 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81902106568D for ; Thu, 4 Jun 2009 22:42:28 +0000 (UTC) (envelope-from thompsa@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 6FB7C8FC13 for ; Thu, 4 Jun 2009 22:42:28 +0000 (UTC) (envelope-from thompsa@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n54MgSju055606 for ; Thu, 4 Jun 2009 22:42:28 GMT (envelope-from thompsa@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n54MgSlt055604 for perforce@freebsd.org; Thu, 4 Jun 2009 22:42:28 GMT (envelope-from thompsa@freebsd.org) Date: Thu, 4 Jun 2009 22:42:28 GMT Message-Id: <200906042242.n54MgSlt055604@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to thompsa@freebsd.org using -f From: Andrew Thompson To: Perforce Change Reviews Cc: Subject: PERFORCE change 163529 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Jun 2009 22:42:29 -0000 http://perforce.freebsd.org/chv.cgi?CH=163529 Change 163529 by thompsa@thompsa_burger on 2009/06/04 22:42:02 Nuke usb2_transfer_pending(). Affected files ... .. //depot/projects/usb_buf/src/sys/dev/usb/usb_core.h#9 edit .. //depot/projects/usb_buf/src/sys/dev/usb/usb_generic.c#9 edit .. //depot/projects/usb_buf/src/sys/dev/usb/usb_transfer.c#9 edit Differences ... ==== //depot/projects/usb_buf/src/sys/dev/usb/usb_core.h#9 (text+ko) ==== @@ -549,7 +549,6 @@ usb_frcount_t frindex); void usb2_transfer_clear_stall(struct usb_pipe *pipe); void usb2_transfer_set_stall(struct usb_pipe *pipe); -uint8_t usb2_transfer_pending(struct usb_pipe *pipe); void usb2_transfer_start(struct usb_urb *urb); void usb2_transfer_unsetup(struct usb_pipe **pipe, uint16_t n_setup); void usb2_set_parent_iface(struct usb_device *udev, uint8_t iface_index, ==== //depot/projects/usb_buf/src/sys/dev/usb/usb_generic.c#9 (text+ko) ==== @@ -999,13 +999,8 @@ return (EINVAL); } urb = usb_get_urb(pipe, 0); - - mtx_lock(f->priv_mtx); - if (usb2_transfer_pending(pipe)) { - mtx_unlock(f->priv_mtx); + if (urb == NULL) return (EBUSY); /* should not happen */ - } - mtx_unlock(f->priv_mtx); error = copyin(f->fs_ep_ptr + ep_index, &fs_ep, sizeof(fs_ep)); @@ -1180,13 +1175,8 @@ return (EINVAL); urb = usb_get_urb(pipe, 0); - - mtx_lock(f->priv_mtx); - if (usb2_transfer_pending(pipe)) { - mtx_unlock(f->priv_mtx); + if (urb == NULL) return (EBUSY); /* should not happen */ - } - mtx_unlock(f->priv_mtx); fs_ep_uptr = f->fs_ep_ptr + ep_index; error = copyin(fs_ep_uptr, &fs_ep, sizeof(fs_ep)); @@ -1501,6 +1491,7 @@ error = EINVAL; break; } +#if 0 mtx_lock(f->priv_mtx); error = usb2_transfer_pending(f->fs_pipe[u.pstall->ep_index]); mtx_unlock(f->priv_mtx); @@ -1508,6 +1499,7 @@ if (error) { return (EBUSY); } +#endif ep = f->fs_pipe[u.pstall->ep_index]->endpoint; /* setup a clear-stall packet */ ==== //depot/projects/usb_buf/src/sys/dev/usb/usb_transfer.c#9 (text+ko) ==== @@ -1661,54 +1661,6 @@ } /*------------------------------------------------------------------------* - * usb2_transfer_pending - * - * This function will check if an USB transfer is pending which is a - * little bit complicated! - * Return values: - * 0: Not pending - * 1: Pending: The USB transfer will receive a callback in the future. - *------------------------------------------------------------------------*/ -uint8_t -usb2_transfer_pending(struct usb_pipe *pipe) -{ - struct usb_xfer_root *info; - struct usb_xfer_queue *pq; - - USB_PIPE_LOCK_ASSERT(pipe, MA_OWNED); - - if (TAILQ_FIRST(&pipe->urb_free_q) == NULL) - return (1); - - if (pipe->urb_curr == (&pipe->urb0)) { - /* XXX */ - USB_BUS_UNLOCK(pipe->xroot->bus); - return (1); - } - if (pipe->flags_int.transferring) { - /* trivial case */ - return (1); - } - USB_BUS_LOCK(pipe->xroot->bus); - if ((&pipe->urb0)->wait_queue) { - /* we are waiting on a queue somewhere */ - USB_BUS_UNLOCK(pipe->xroot->bus); - return (1); - } - info = pipe->xroot; - pq = &info->done_q; - - if (pq->curr == (&pipe->urb0)) { - /* we are currently scheduled for callback */ - USB_BUS_UNLOCK(pipe->xroot->bus); - return (1); - } - /* we are not pending */ - USB_BUS_UNLOCK(pipe->xroot->bus); - return (0); -} - -/*------------------------------------------------------------------------* * usb_pipe_drain * * This function will stop the USB transfer and wait for any