PERFORCE change 149590 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Sep 11 08:02:09 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=149590
Change 149590 by hselasky at 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) {
More information about the p4-projects
mailing list