From owner-p4-projects@FreeBSD.ORG Tue Aug 3 20:40:06 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id ACBAA10656A7; Tue, 3 Aug 2010 20:40:06 +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 70D1D10656A5 for ; Tue, 3 Aug 2010 20:40:06 +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 328528FC16 for ; Tue, 3 Aug 2010 20:40:06 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.4/8.14.4) with ESMTP id o73Ke6HU045454 for ; Tue, 3 Aug 2010 20:40:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.4/8.14.4/Submit) id o73Ke6WV045452 for perforce@freebsd.org; Tue, 3 Aug 2010 20:40:06 GMT (envelope-from hselasky@FreeBSD.org) Date: Tue, 3 Aug 2010 20:40:06 GMT Message-Id: <201008032040.o73Ke6WV045452@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 Precedence: bulk Cc: Subject: PERFORCE change 181804 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2010 20:40:06 -0000 http://p4web.freebsd.org/@@181804?ac=10 Change 181804 by hselasky@hselasky_laptop001 on 2010/08/03 20:39:29 USB core: - moved "start_dma_delay" to "bus_methods". - factored out reference to "bus" pointer. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/usb_controller.h#24 edit .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#182 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/usb_controller.h#24 (text+ko) ==== @@ -118,6 +118,10 @@ /* Optional device uninit */ void (*device_uninit) (struct usb_device *); + + /* Optional for device and host mode */ + + void (*start_dma_delay)(struct usb_xfer *); }; /* @@ -136,8 +140,6 @@ /* Optional */ - void (*start_dma_delay)(struct usb_xfer *); - void *info; }; ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#182 (text+ko) ==== @@ -2562,14 +2562,17 @@ usbd_callback_wrapper_sub(struct usb_xfer *xfer) { struct usb_endpoint *ep; + struct usb_bus *bus; usb_frcount_t x; + bus = xfer->xroot->bus; + if ((!xfer->flags_int.open) && (!xfer->flags_int.did_close)) { DPRINTF("close\n"); - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); (xfer->endpoint->methods->close) (xfer); - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); /* only close once */ xfer->flags_int.did_close = 1; return (1); /* wait for new callback */ @@ -2581,7 +2584,7 @@ if ((xfer->error != 0) && (!xfer->flags_int.did_dma_delay) && ((xfer->error == USB_ERR_CANCELLED) || (xfer->error == USB_ERR_TIMEOUT) || - (xfer->endpoint->methods->start_dma_delay != NULL))) { + (bus->methods->start_dma_delay != NULL))) { usb_timeout_t temp; @@ -2597,20 +2600,20 @@ "on %p\n", temp, xfer); if (temp != 0) { - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); /* * Some hardware solutions have dedicated * events when it is safe to free DMA'ed * memory. For the other hardware platforms we * use a static delay. */ - if (xfer->endpoint->methods->start_dma_delay != NULL) { - (xfer->endpoint->methods->start_dma_delay) (xfer); + if (bus->methods->start_dma_delay != NULL) { + (bus->methods->start_dma_delay) (xfer); } else { usbd_transfer_timeout_ms(xfer, (void *)&usb_dma_delay_done_cb, temp); } - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); return (1); /* wait for new callback */ } } @@ -2702,7 +2705,7 @@ * If the current USB transfer is completing we need to start the * next one: */ - USB_BUS_LOCK(xfer->xroot->bus); + USB_BUS_LOCK(bus); if (ep->endpoint_q.curr == xfer) { usb_command_wrapper(&ep->endpoint_q, NULL); @@ -2714,7 +2717,7 @@ xfer->endpoint->is_synced = 0; } } - USB_BUS_UNLOCK(xfer->xroot->bus); + USB_BUS_UNLOCK(bus); done: return (0); }