From owner-p4-projects@FreeBSD.ORG Thu Sep 11 08:02:09 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 04FC51065673; Thu, 11 Sep 2008 08:02:09 +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 BDE9E1065671 for ; Thu, 11 Sep 2008 08:02:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id A7F458FC1F for ; Thu, 11 Sep 2008 08:02:08 +0000 (UTC) (envelope-from hselasky@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 m8B828DX068836 for ; Thu, 11 Sep 2008 08:02:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m8B828rd068818 for perforce@freebsd.org; Thu, 11 Sep 2008 08:02:08 GMT (envelope-from hselasky@FreeBSD.org) Date: Thu, 11 Sep 2008 08:02:08 GMT Message-Id: <200809110802.m8B828rd068818@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 149590 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, 11 Sep 2008 08:02:09 -0000 http://perforce.freebsd.org/chv.cgi?CH=149590 Change 149590 by hselasky@hselasky_laptop001 on 2008/09/11 08:01:24 When there is no buffer we need to call start_read/start_write function. Maybe it will create a buffer, which is the case for UGEN. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_dev.c#28 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_dev.c#28 (text+ko) ==== @@ -847,6 +847,7 @@ f->flag_iserror = 1; /* need to wait until all callers have exited */ while (f->refcount != 0) { + mtx_unlock(&usb2_ref_lock); /* avoid LOR */ mtx_lock(f->priv_mtx); /* get I/O thread out of any sleep state */ if (f->flag_sleeping) { @@ -854,6 +855,7 @@ usb2_cv_broadcast(&f->cv_io); } mtx_unlock(f->priv_mtx); + mtx_lock(&usb2_ref_lock); /* wait for sync */ usb2_cv_wait(&f->cv_drain, &usb2_ref_lock); @@ -1462,7 +1464,8 @@ } static int -usb2_ioctl_f_sub(struct usb2_fifo *f, u_long cmd, void *addr, struct thread *td) +usb2_ioctl_f_sub(struct usb2_fifo *f, u_long cmd, void *addr, + struct thread *td) { int error = 0; @@ -1526,17 +1529,10 @@ if (fflags & FREAD) { if (fflags & FWRITE) { /* - * Automagically figure out if we have an IOCTL that - * should not be replicated to both FIFOs: + * Make sure that the IOCTL is not + * duplicated: */ - if ((loc.rxfifo->priv_sc0 == - loc.txfifo->priv_sc0) && - (loc.rxfifo->priv_sc1 == - loc.txfifo->priv_sc1) && - (loc.rxfifo->methods == - loc.txfifo->methods)) { - is_common = 1; - } + is_common = 1; } err_rx = usb2_ioctl_f_sub(loc.rxfifo, cmd, addr, td); if (err_rx == ENOTTY) { @@ -1624,6 +1620,13 @@ /* we got an error */ m = (void *)1; } else { + if (f->queue_data == NULL) { + /* + * start write transfer, if not + * already started + */ + (f->methods->f_start_write) (f); + } /* check if any packets are available */ USB_IF_POLL(&f->free_q, m); } @@ -1656,6 +1659,13 @@ /* we have and error */ m = (void *)1; } else { + if (f->queue_data == NULL) { + /* + * start read transfer, if not + * already started + */ + (f->methods->f_start_read) (f); + } /* check if any packets are available */ USB_IF_POLL(&f->used_q, m); } @@ -1860,6 +1870,10 @@ err = EIO; goto done; } + if ((f->queue_data == NULL) && (f->fs_ep_max == 0)) { + /* start write transfer, if not already started */ + (f->methods->f_start_write) (f); + } while (uio->uio_resid > 0) { if (f->fs_ep_max == 0) {