Date: Thu, 4 Jun 2009 22:42:28 GMT From: Andrew Thompson <thompsa@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 163529 for review Message-ID: <200906042242.n54MgSlt055604@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906042242.n54MgSlt055604>