Date: Fri, 8 Apr 2011 06:37:22 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r220439 - stable/8/sys/dev/usb Message-ID: <201104080637.p386bMHN066492@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Fri Apr 8 06:37:22 2011 New Revision: 220439 URL: http://svn.freebsd.org/changeset/base/220439 Log: MFC r220304. - Fix for missing event if a libUSB USB transfer is started and stopped rapidly in succession. Modified: stable/8/sys/dev/usb/usb_generic.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) Modified: stable/8/sys/dev/usb/usb_generic.c ============================================================================== --- stable/8/sys/dev/usb/usb_generic.c Fri Apr 8 06:29:41 2011 (r220438) +++ stable/8/sys/dev/usb/usb_generic.c Fri Apr 8 06:37:22 2011 (r220439) @@ -1400,6 +1400,7 @@ ugen_ioctl(struct usb_fifo *f, u_long cm } u; struct usb_endpoint *ep; struct usb_endpoint_descriptor *ed; + struct usb_xfer *xfer; int error = 0; uint8_t iface_index; uint8_t isread; @@ -1426,11 +1427,11 @@ ugen_ioctl(struct usb_fifo *f, u_long cm case USB_FS_START: error = ugen_fs_copy_in(f, u.pstart->ep_index); - if (error) { + if (error) break; - } mtx_lock(f->priv_mtx); - usbd_transfer_start(f->fs_xfer[u.pstart->ep_index]); + xfer = f->fs_xfer[u.pstart->ep_index]; + usbd_transfer_start(xfer); mtx_unlock(f->priv_mtx); break; @@ -1440,7 +1441,19 @@ ugen_ioctl(struct usb_fifo *f, u_long cm break; } mtx_lock(f->priv_mtx); - usbd_transfer_stop(f->fs_xfer[u.pstop->ep_index]); + xfer = f->fs_xfer[u.pstart->ep_index]; + if (usbd_transfer_pending(xfer)) { + usbd_transfer_stop(xfer); + /* + * Check if the USB transfer was stopped + * before it was even started. Else a cancel + * callback will be pending. + */ + if (!xfer->flags_int.transferring) { + ugen_fs_set_complete(xfer->priv_sc, + USB_P2U(xfer->priv_fifo)); + } + } mtx_unlock(f->priv_mtx); break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104080637.p386bMHN066492>