Date: Mon, 18 Jun 2007 18:00:44 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 121925 for review Message-ID: <200706181800.l5II0idC043799@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=121925 Change 121925 by hselasky@hselasky_mini_itx on 2007/06/18 18:00:10 Remove "usbd_transfer_start_safe()" and fix a regression with regard to "usbd_do_request()" calls without Giant locked. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/uhub.c#13 edit .. //depot/projects/usb/src/sys/dev/usb/usb_subr.h#42 edit .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#27 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/uhub.c#13 (text+ko) ==== @@ -625,7 +625,9 @@ /* start the interrupt endpoint */ - usbd_transfer_start_safe(sc->sc_xfer[0]); + mtx_lock(sc->sc_xfer[0]->priv_mtx); + usbd_transfer_start(sc->sc_xfer[0]); + mtx_unlock(sc->sc_xfer[0]->priv_mtx); return 0; ==== //depot/projects/usb/src/sys/dev/usb/usb_subr.h#42 (text+ko) ==== @@ -644,7 +644,6 @@ void usbd_std_ctrl_copy_out(struct usbd_xfer *xfer); uint8_t usbd_std_ctrl_enter(struct usbd_xfer *xfer); void usbd_start_hardware(struct usbd_xfer *xfer); -void usbd_transfer_start_safe(struct usbd_xfer *xfer); void usbd_transfer_start(struct usbd_xfer *xfer); void usbd_transfer_stop(struct usbd_xfer *xfer); void __usbd_callback(struct usbd_xfer *xfer); ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#27 (text+ko) ==== @@ -697,15 +697,6 @@ return; } -void -usbd_transfer_start_safe(struct usbd_xfer *xfer) -{ - mtx_lock(xfer->priv_mtx); - usbd_transfer_start(xfer); - mtx_unlock(xfer->priv_mtx); - return; -} - /*---------------------------------------------------------------------------* * usbd_transfer_start - start an USB transfer * @@ -1221,12 +1212,16 @@ usbd_copy_in(&(xfer->buf_data), sizeof(*req), data, length); } - if (mtx) { - usbd_transfer_start(xfer); - } else { - usbd_transfer_start_safe(xfer); + if (mtx == NULL) { + /* XXX This code will go away + * when we have fixed all the + * callers + */ + mtx_lock(xfer->priv_mtx); } + usbd_transfer_start(xfer); + while (xfer->flags & USBD_DEV_TRANSFERRING) { level = mtx_drop_recurse(xfer->priv_mtx); @@ -1238,6 +1233,11 @@ mtx_pickup_recurse(xfer->priv_mtx, level); } + if (mtx == NULL) { + /* XXX */ + mtx_unlock(xfer->priv_mtx); + } + if(req->bmRequestType & UT_READ) { usbd_copy_out(&(xfer->buf_data), sizeof(*req), data, length);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706181800.l5II0idC043799>