Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 May 2009 00:04:17 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192499 - in head/sys/dev/usb: . bluetooth controller input misc net serial storage wlan
Message-ID:  <200905210004.n4L04HQ4048379@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: thompsa
Date: Thu May 21 00:04:17 2009
New Revision: 192499
URL: http://svn.freebsd.org/changeset/base/192499

Log:
  - rename usb2_mode to usb_mode [1]
  - change variable types to use the enum
  
  Submitted by:	Hans Petter Selasky [1]

Modified:
  head/sys/dev/usb/bluetooth/ng_ubt.c
  head/sys/dev/usb/bluetooth/ubtbcmfw.c
  head/sys/dev/usb/controller/at91dci.c
  head/sys/dev/usb/controller/atmegadci.c
  head/sys/dev/usb/controller/ehci.c
  head/sys/dev/usb/controller/musb_otg.c
  head/sys/dev/usb/controller/ohci.c
  head/sys/dev/usb/controller/uhci.c
  head/sys/dev/usb/controller/uss820dci.c
  head/sys/dev/usb/input/uhid.c
  head/sys/dev/usb/input/ukbd.c
  head/sys/dev/usb/input/ums.c
  head/sys/dev/usb/misc/udbp.c
  head/sys/dev/usb/misc/ufm.c
  head/sys/dev/usb/net/if_aue.c
  head/sys/dev/usb/net/if_axe.c
  head/sys/dev/usb/net/if_cdce.c
  head/sys/dev/usb/net/if_cue.c
  head/sys/dev/usb/net/if_kue.c
  head/sys/dev/usb/net/if_rue.c
  head/sys/dev/usb/net/if_udav.c
  head/sys/dev/usb/serial/u3g.c
  head/sys/dev/usb/serial/uark.c
  head/sys/dev/usb/serial/ubsa.c
  head/sys/dev/usb/serial/ubser.c
  head/sys/dev/usb/serial/uchcom.c
  head/sys/dev/usb/serial/ucycom.c
  head/sys/dev/usb/serial/ufoma.c
  head/sys/dev/usb/serial/uftdi.c
  head/sys/dev/usb/serial/ugensa.c
  head/sys/dev/usb/serial/uipaq.c
  head/sys/dev/usb/serial/ulpt.c
  head/sys/dev/usb/serial/umct.c
  head/sys/dev/usb/serial/umodem.c
  head/sys/dev/usb/serial/umoscom.c
  head/sys/dev/usb/serial/uplcom.c
  head/sys/dev/usb/serial/uslcom.c
  head/sys/dev/usb/serial/uvisor.c
  head/sys/dev/usb/serial/uvscom.c
  head/sys/dev/usb/storage/umass.c
  head/sys/dev/usb/storage/urio.c
  head/sys/dev/usb/storage/ustorage_fs.c
  head/sys/dev/usb/usb_busdma.c
  head/sys/dev/usb/usb_compat_linux.c
  head/sys/dev/usb/usb_core.h
  head/sys/dev/usb/usb_dev.c
  head/sys/dev/usb/usb_device.c
  head/sys/dev/usb/usb_device.h
  head/sys/dev/usb/usb_generic.c
  head/sys/dev/usb/usb_hub.c
  head/sys/dev/usb/usb_hub.h
  head/sys/dev/usb/usb_request.c
  head/sys/dev/usb/usb_revision.h
  head/sys/dev/usb/usb_transfer.c
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_uath.c
  head/sys/dev/usb/wlan/if_upgt.c
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_zyd.c

Modified: head/sys/dev/usb/bluetooth/ng_ubt.c
==============================================================================
--- head/sys/dev/usb/bluetooth/ng_ubt.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/bluetooth/ng_ubt.c	Thu May 21 00:04:17 2009	(r192499)
@@ -399,7 +399,7 @@ ubt_probe(device_t dev)
 {
 	struct usb2_attach_arg	*uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST)
+	if (uaa->usb_mode != USB_MODE_HOST)
 		return (ENXIO);
 
 	if (uaa->info.bIfaceIndex != 0)

Modified: head/sys/dev/usb/bluetooth/ubtbcmfw.c
==============================================================================
--- head/sys/dev/usb/bluetooth/ubtbcmfw.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/bluetooth/ubtbcmfw.c	Thu May 21 00:04:17 2009	(r192499)
@@ -174,7 +174,7 @@ ubtbcmfw_probe(device_t dev)
 
 	struct usb2_attach_arg	*uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST)
+	if (uaa->usb_mode != USB_MODE_HOST)
 		return (ENXIO);
 
 	if (uaa->info.bIfaceIndex != 0)

Modified: head/sys/dev/usb/controller/at91dci.c
==============================================================================
--- head/sys/dev/usb/controller/at91dci.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/controller/at91dci.c	Thu May 21 00:04:17 2009	(r192499)
@@ -1193,7 +1193,7 @@ at91dci_device_done(struct usb2_xfer *xf
 	DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n",
 	    xfer, xfer->pipe, error);
 
-	if (xfer->flags_int.usb2_mode == USB_MODE_DEVICE) {
+	if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
 		ep_no = (xfer->endpoint & UE_ADDR);
 
 		/* disable endpoint interrupt */
@@ -1337,7 +1337,7 @@ at91dci_clear_stall(struct usb2_device *
 	USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
 
 	/* check mode */
-	if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
+	if (udev->flags.usb_mode != USB_MODE_DEVICE) {
 		/* not supported */
 		return;
 	}
@@ -2264,12 +2264,12 @@ at91dci_pipe_init(struct usb2_device *ud
 
 	DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
 	    pipe, udev->address,
-	    edesc->bEndpointAddress, udev->flags.usb2_mode,
+	    edesc->bEndpointAddress, udev->flags.usb_mode,
 	    sc->sc_rt_addr);
 
 	if (udev->device_index != sc->sc_rt_addr) {
 
-		if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
+		if (udev->flags.usb_mode != USB_MODE_DEVICE) {
 			/* not supported */
 			return;
 		}

Modified: head/sys/dev/usb/controller/atmegadci.c
==============================================================================
--- head/sys/dev/usb/controller/atmegadci.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/controller/atmegadci.c	Thu May 21 00:04:17 2009	(r192499)
@@ -1076,7 +1076,7 @@ atmegadci_device_done(struct usb2_xfer *
 	DPRINTFN(9, "xfer=%p, pipe=%p, error=%d\n",
 	    xfer, xfer->pipe, error);
 
-	if (xfer->flags_int.usb2_mode == USB_MODE_DEVICE) {
+	if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
 		ep_no = (xfer->endpoint & UE_ADDR);
 
 		/* select endpoint number */
@@ -1187,7 +1187,7 @@ atmegadci_clear_stall(struct usb2_device
 	USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
 
 	/* check mode */
-	if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
+	if (udev->flags.usb_mode != USB_MODE_DEVICE) {
 		/* not supported */
 		return;
 	}
@@ -2094,12 +2094,12 @@ atmegadci_pipe_init(struct usb2_device *
 
 	DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d,%d)\n",
 	    pipe, udev->address,
-	    edesc->bEndpointAddress, udev->flags.usb2_mode,
+	    edesc->bEndpointAddress, udev->flags.usb_mode,
 	    sc->sc_rt_addr, udev->device_index);
 
 	if (udev->device_index != sc->sc_rt_addr) {
 
-		if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
+		if (udev->flags.usb_mode != USB_MODE_DEVICE) {
 			/* not supported */
 			return;
 		}

Modified: head/sys/dev/usb/controller/ehci.c
==============================================================================
--- head/sys/dev/usb/controller/ehci.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/controller/ehci.c	Thu May 21 00:04:17 2009	(r192499)
@@ -3649,10 +3649,10 @@ ehci_pipe_init(struct usb2_device *udev,
 
 	DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
 	    pipe, udev->address,
-	    edesc->bEndpointAddress, udev->flags.usb2_mode,
+	    edesc->bEndpointAddress, udev->flags.usb_mode,
 	    sc->sc_addr);
 
-	if (udev->flags.usb2_mode != USB_MODE_HOST) {
+	if (udev->flags.usb_mode != USB_MODE_HOST) {
 		/* not supported */
 		return;
 	}

Modified: head/sys/dev/usb/controller/musb_otg.c
==============================================================================
--- head/sys/dev/usb/controller/musb_otg.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/controller/musb_otg.c	Thu May 21 00:04:17 2009	(r192499)
@@ -1441,7 +1441,7 @@ musbotg_device_done(struct usb2_xfer *xf
 	DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n",
 	    xfer, xfer->pipe, error);
 
-	if (xfer->flags_int.usb2_mode == USB_MODE_DEVICE) {
+	if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
 
 		musbotg_ep_int_set(xfer, 0);
 
@@ -1645,7 +1645,7 @@ musbotg_clear_stall(struct usb2_device *
 	USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED);
 
 	/* check mode */
-	if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
+	if (udev->flags.usb_mode != USB_MODE_DEVICE) {
 		/* not supported */
 		return;
 	}
@@ -2673,12 +2673,12 @@ musbotg_pipe_init(struct usb2_device *ud
 
 	DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
 	    pipe, udev->address,
-	    edesc->bEndpointAddress, udev->flags.usb2_mode,
+	    edesc->bEndpointAddress, udev->flags.usb_mode,
 	    sc->sc_rt_addr);
 
 	if (udev->device_index != sc->sc_rt_addr) {
 
-		if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
+		if (udev->flags.usb_mode != USB_MODE_DEVICE) {
 			/* not supported */
 			return;
 		}

Modified: head/sys/dev/usb/controller/ohci.c
==============================================================================
--- head/sys/dev/usb/controller/ohci.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/controller/ohci.c	Thu May 21 00:04:17 2009	(r192499)
@@ -2570,10 +2570,10 @@ ohci_pipe_init(struct usb2_device *udev,
 
 	DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
 	    pipe, udev->address,
-	    edesc->bEndpointAddress, udev->flags.usb2_mode,
+	    edesc->bEndpointAddress, udev->flags.usb_mode,
 	    sc->sc_addr);
 
-	if (udev->flags.usb2_mode != USB_MODE_HOST) {
+	if (udev->flags.usb_mode != USB_MODE_HOST) {
 		/* not supported */
 		return;
 	}

Modified: head/sys/dev/usb/controller/uhci.c
==============================================================================
--- head/sys/dev/usb/controller/uhci.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/controller/uhci.c	Thu May 21 00:04:17 2009	(r192499)
@@ -3050,10 +3050,10 @@ uhci_pipe_init(struct usb2_device *udev,
 
 	DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
 	    pipe, udev->address,
-	    edesc->bEndpointAddress, udev->flags.usb2_mode,
+	    edesc->bEndpointAddress, udev->flags.usb_mode,
 	    sc->sc_addr);
 
-	if (udev->flags.usb2_mode != USB_MODE_HOST) {
+	if (udev->flags.usb_mode != USB_MODE_HOST) {
 		/* not supported */
 		return;
 	}

Modified: head/sys/dev/usb/controller/uss820dci.c
==============================================================================
--- head/sys/dev/usb/controller/uss820dci.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/controller/uss820dci.c	Thu May 21 00:04:17 2009	(r192499)
@@ -1173,7 +1173,7 @@ uss820dci_device_done(struct usb2_xfer *
 	DPRINTFN(2, "xfer=%p, pipe=%p, error=%d\n",
 	    xfer, xfer->pipe, error);
 
-	if (xfer->flags_int.usb2_mode == USB_MODE_DEVICE) {
+	if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
 		uss820dci_intr_set(xfer, 0);
 	}
 	/* dequeue transfer and start next transfer */
@@ -1279,7 +1279,7 @@ uss820dci_clear_stall(struct usb2_device
 	DPRINTFN(5, "pipe=%p\n", pipe);
 
 	/* check mode */
-	if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
+	if (udev->flags.usb_mode != USB_MODE_DEVICE) {
 		/* not supported */
 		return;
 	}
@@ -2298,12 +2298,12 @@ uss820dci_pipe_init(struct usb2_device *
 
 	DPRINTFN(2, "pipe=%p, addr=%d, endpt=%d, mode=%d (%d)\n",
 	    pipe, udev->address,
-	    edesc->bEndpointAddress, udev->flags.usb2_mode,
+	    edesc->bEndpointAddress, udev->flags.usb_mode,
 	    sc->sc_rt_addr);
 
 	if (udev->device_index != sc->sc_rt_addr) {
 
-		if (udev->flags.usb2_mode != USB_MODE_DEVICE) {
+		if (udev->flags.usb_mode != USB_MODE_DEVICE) {
 			/* not supported */
 			return;
 		}

Modified: head/sys/dev/usb/input/uhid.c
==============================================================================
--- head/sys/dev/usb/input/uhid.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/input/uhid.c	Thu May 21 00:04:17 2009	(r192499)
@@ -599,7 +599,7 @@ uhid_probe(device_t dev)
 
 	DPRINTFN(11, "\n");
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->use_generic == 0) {

Modified: head/sys/dev/usb/input/ukbd.c
==============================================================================
--- head/sys/dev/usb/input/ukbd.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/input/ukbd.c	Thu May 21 00:04:17 2009	(r192499)
@@ -598,7 +598,7 @@ ukbd_probe(device_t dev)
 	if (sw == NULL) {
 		return (ENXIO);
 	}
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	/* check that the keyboard speaks the boot protocol: */

Modified: head/sys/dev/usb/input/ums.c
==============================================================================
--- head/sys/dev/usb/input/ums.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/input/ums.c	Thu May 21 00:04:17 2009	(r192499)
@@ -339,7 +339,7 @@ ums_probe(device_t dev)
 
 	DPRINTFN(11, "\n");
 
-	if (uaa->usb2_mode != USB_MODE_HOST)
+	if (uaa->usb_mode != USB_MODE_HOST)
 		return (ENXIO);
 
 	id = usb2_get_interface_descriptor(uaa->iface);

Modified: head/sys/dev/usb/misc/udbp.c
==============================================================================
--- head/sys/dev/usb/misc/udbp.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/misc/udbp.c	Thu May 21 00:04:17 2009	(r192499)
@@ -279,7 +279,7 @@ udbp_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	/*

Modified: head/sys/dev/usb/misc/ufm.c
==============================================================================
--- head/sys/dev/usb/misc/ufm.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/misc/ufm.c	Thu May 21 00:04:17 2009	(r192499)
@@ -112,7 +112,7 @@ ufm_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if ((uaa->info.idVendor == USB_VENDOR_CYPRESS) &&

Modified: head/sys/dev/usb/net/if_aue.c
==============================================================================
--- head/sys/dev/usb/net/if_aue.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/net/if_aue.c	Thu May 21 00:04:17 2009	(r192499)
@@ -628,7 +628,7 @@ aue_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST)
+	if (uaa->usb_mode != USB_MODE_HOST)
 		return (ENXIO);
 	if (uaa->info.bConfigIndex != AUE_CONFIG_INDEX)
 		return (ENXIO);

Modified: head/sys/dev/usb/net/if_axe.c
==============================================================================
--- head/sys/dev/usb/net/if_axe.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/net/if_axe.c	Thu May 21 00:04:17 2009	(r192499)
@@ -662,7 +662,7 @@ axe_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST)
+	if (uaa->usb_mode != USB_MODE_HOST)
 		return (ENXIO);
 	if (uaa->info.bConfigIndex != AXE_CONFIG_IDX)
 		return (ENXIO);

Modified: head/sys/dev/usb/net/if_cdce.c
==============================================================================
--- head/sys/dev/usb/net/if_cdce.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/net/if_cdce.c	Thu May 21 00:04:17 2009	(r192499)
@@ -105,7 +105,7 @@ static const struct usb2_config cdce_con
 		.flags = {.pipe_bof = 1,.short_frames_ok = 1,.short_xfer_ok = 1,.ext_buffer = 1,},
 		.callback = cdce_bulk_read_callback,
 		.timeout = 0,	/* no timeout */
-		.usb_mode = USB_MODE_MAX,	/* both modes */
+		.usb_mode = USB_MODE_DUAL,	/* both modes */
 	},
 
 	[CDCE_BULK_TX] = {
@@ -118,7 +118,7 @@ static const struct usb2_config cdce_con
 		.flags = {.pipe_bof = 1,.force_short_xfer = 1,.ext_buffer = 1,},
 		.callback = cdce_bulk_write_callback,
 		.timeout = 10000,	/* 10 seconds */
-		.usb_mode = USB_MODE_MAX,	/* both modes */
+		.usb_mode = USB_MODE_DUAL,	/* both modes */
 	},
 
 	[CDCE_INTR_RX] = {
@@ -361,7 +361,7 @@ alloc_transfers:
 			sc->sc_ue.ue_eaddr[i / 2] |= c;
 		}
 
-		if (uaa->usb2_mode == USB_MODE_DEVICE) {
+		if (uaa->usb_mode == USB_MODE_DEVICE) {
 			/*
 			 * Do not use the same MAC address like the peer !
 			 */

Modified: head/sys/dev/usb/net/if_cue.c
==============================================================================
--- head/sys/dev/usb/net/if_cue.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/net/if_cue.c	Thu May 21 00:04:17 2009	(r192499)
@@ -360,7 +360,7 @@ cue_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST)
+	if (uaa->usb_mode != USB_MODE_HOST)
 		return (ENXIO);
 	if (uaa->info.bConfigIndex != CUE_CONFIG_IDX)
 		return (ENXIO);

Modified: head/sys/dev/usb/net/if_kue.c
==============================================================================
--- head/sys/dev/usb/net/if_kue.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/net/if_kue.c	Thu May 21 00:04:17 2009	(r192499)
@@ -436,7 +436,7 @@ kue_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST)
+	if (uaa->usb_mode != USB_MODE_HOST)
 		return (ENXIO);
 	if (uaa->info.bConfigIndex != KUE_CONFIG_IDX)
 		return (ENXIO);

Modified: head/sys/dev/usb/net/if_rue.c
==============================================================================
--- head/sys/dev/usb/net/if_rue.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/net/if_rue.c	Thu May 21 00:04:17 2009	(r192499)
@@ -546,7 +546,7 @@ rue_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST)
+	if (uaa->usb_mode != USB_MODE_HOST)
 		return (ENXIO);
 	if (uaa->info.bConfigIndex != RUE_CONFIG_IDX)
 		return (ENXIO);

Modified: head/sys/dev/usb/net/if_udav.c
==============================================================================
--- head/sys/dev/usb/net/if_udav.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/net/if_udav.c	Thu May 21 00:04:17 2009	(r192499)
@@ -211,7 +211,7 @@ udav_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST)
+	if (uaa->usb_mode != USB_MODE_HOST)
 		return (ENXIO);
 	if (uaa->info.bConfigIndex != UDAV_CONFIG_INDEX)
 		return (ENXIO);

Modified: head/sys/dev/usb/serial/u3g.c
==============================================================================
--- head/sys/dev/usb/serial/u3g.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/u3g.c	Thu May 21 00:04:17 2009	(r192499)
@@ -420,7 +420,7 @@ u3g_probe(device_t self)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(self);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigIndex != U3G_CONFIG_INDEX) {

Modified: head/sys/dev/usb/serial/uark.c
==============================================================================
--- head/sys/dev/usb/serial/uark.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/uark.c	Thu May 21 00:04:17 2009	(r192499)
@@ -161,7 +161,7 @@ uark_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigIndex != 0) {

Modified: head/sys/dev/usb/serial/ubsa.c
==============================================================================
--- head/sys/dev/usb/serial/ubsa.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/ubsa.c	Thu May 21 00:04:17 2009	(r192499)
@@ -268,7 +268,7 @@ ubsa_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigIndex != UBSA_CONFIG_INDEX) {

Modified: head/sys/dev/usb/serial/ubser.c
==============================================================================
--- head/sys/dev/usb/serial/ubser.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/ubser.c	Thu May 21 00:04:17 2009	(r192499)
@@ -205,7 +205,7 @@ ubser_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	/* check if this is a BWCT vendor specific ubser interface */

Modified: head/sys/dev/usb/serial/uchcom.c
==============================================================================
--- head/sys/dev/usb/serial/uchcom.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/uchcom.c	Thu May 21 00:04:17 2009	(r192499)
@@ -281,7 +281,7 @@ uchcom_probe(device_t dev)
 
 	DPRINTFN(11, "\n");
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigIndex != UCHCOM_CONFIG_INDEX) {

Modified: head/sys/dev/usb/serial/ucycom.c
==============================================================================
--- head/sys/dev/usb/serial/ucycom.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/ucycom.c	Thu May 21 00:04:17 2009	(r192499)
@@ -179,7 +179,7 @@ ucycom_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigIndex != 0) {

Modified: head/sys/dev/usb/serial/ufoma.c
==============================================================================
--- head/sys/dev/usb/serial/ufoma.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/ufoma.c	Thu May 21 00:04:17 2009	(r192499)
@@ -322,7 +322,7 @@ ufoma_probe(device_t dev)
 	struct usb2_config_descriptor *cd;
 	usb2_mcpc_acm_descriptor *mad;
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	id = usb2_get_interface_descriptor(uaa->iface);

Modified: head/sys/dev/usb/serial/uftdi.c
==============================================================================
--- head/sys/dev/usb/serial/uftdi.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/uftdi.c	Thu May 21 00:04:17 2009	(r192499)
@@ -240,7 +240,7 @@ uftdi_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigIndex != UFTDI_CONFIG_INDEX) {

Modified: head/sys/dev/usb/serial/ugensa.c
==============================================================================
--- head/sys/dev/usb/serial/ugensa.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/ugensa.c	Thu May 21 00:04:17 2009	(r192499)
@@ -161,7 +161,7 @@ ugensa_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigIndex != UGENSA_CONFIG_INDEX) {

Modified: head/sys/dev/usb/serial/uipaq.c
==============================================================================
--- head/sys/dev/usb/serial/uipaq.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/uipaq.c	Thu May 21 00:04:17 2009	(r192499)
@@ -1078,7 +1078,7 @@ uipaq_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigIndex != UIPAQ_CONFIG_INDEX) {

Modified: head/sys/dev/usb/serial/ulpt.c
==============================================================================
--- head/sys/dev/usb/serial/ulpt.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/ulpt.c	Thu May 21 00:04:17 2009	(r192499)
@@ -471,7 +471,7 @@ ulpt_probe(device_t dev)
 
 	DPRINTFN(11, "\n");
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if ((uaa->info.bInterfaceClass == UICLASS_PRINTER) &&

Modified: head/sys/dev/usb/serial/umct.c
==============================================================================
--- head/sys/dev/usb/serial/umct.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/umct.c	Thu May 21 00:04:17 2009	(r192499)
@@ -208,7 +208,7 @@ umct_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigIndex != UMCT_CONFIG_INDEX) {

Modified: head/sys/dev/usb/serial/umodem.c
==============================================================================
--- head/sys/dev/usb/serial/umodem.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/umodem.c	Thu May 21 00:04:17 2009	(r192499)
@@ -257,7 +257,7 @@ umodem_probe(device_t dev)
 
 	DPRINTFN(11, "\n");
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	error = usb2_lookup_id_by_uaa(umodem_devs, sizeof(umodem_devs), uaa);

Modified: head/sys/dev/usb/serial/umoscom.c
==============================================================================
--- head/sys/dev/usb/serial/umoscom.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/umoscom.c	Thu May 21 00:04:17 2009	(r192499)
@@ -274,7 +274,7 @@ umoscom_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigIndex != UMOSCOM_CONFIG_INDEX) {

Modified: head/sys/dev/usb/serial/uplcom.c
==============================================================================
--- head/sys/dev/usb/serial/uplcom.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/uplcom.c	Thu May 21 00:04:17 2009	(r192499)
@@ -306,7 +306,7 @@ uplcom_probe(device_t dev)
 
 	DPRINTFN(11, "\n");
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigIndex != UPLCOM_CONFIG_INDEX) {

Modified: head/sys/dev/usb/serial/uslcom.c
==============================================================================
--- head/sys/dev/usb/serial/uslcom.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/uslcom.c	Thu May 21 00:04:17 2009	(r192499)
@@ -206,7 +206,7 @@ uslcom_probe(device_t dev)
 
 	DPRINTFN(11, "\n");
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigIndex != USLCOM_CONFIG_INDEX) {

Modified: head/sys/dev/usb/serial/uvisor.c
==============================================================================
--- head/sys/dev/usb/serial/uvisor.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/uvisor.c	Thu May 21 00:04:17 2009	(r192499)
@@ -273,7 +273,7 @@ uvisor_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigIndex != UVISOR_CONFIG_INDEX) {

Modified: head/sys/dev/usb/serial/uvscom.c
==============================================================================
--- head/sys/dev/usb/serial/uvscom.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/serial/uvscom.c	Thu May 21 00:04:17 2009	(r192499)
@@ -257,7 +257,7 @@ uvscom_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->info.bConfigIndex != UVSCOM_CONFIG_INDEX) {

Modified: head/sys/dev/usb/storage/umass.c
==============================================================================
--- head/sys/dev/usb/storage/umass.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/storage/umass.c	Thu May 21 00:04:17 2009	(r192499)
@@ -1428,7 +1428,7 @@ umass_probe(device_t dev)
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 	struct umass_probe_proto temp;
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if (uaa->use_generic == 0) {

Modified: head/sys/dev/usb/storage/urio.c
==============================================================================
--- head/sys/dev/usb/storage/urio.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/storage/urio.c	Thu May 21 00:04:17 2009	(r192499)
@@ -189,7 +189,7 @@ urio_probe(device_t dev)
 {
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	if ((((uaa->info.idVendor == USB_VENDOR_DIAMOND) &&

Modified: head/sys/dev/usb/storage/ustorage_fs.c
==============================================================================
--- head/sys/dev/usb/storage/ustorage_fs.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/storage/ustorage_fs.c	Thu May 21 00:04:17 2009	(r192499)
@@ -317,7 +317,7 @@ ustorage_fs_probe(device_t dev)
 	struct usb2_attach_arg *uaa = device_get_ivars(dev);
 	struct usb2_interface_descriptor *id;
 
-	if (uaa->usb2_mode != USB_MODE_DEVICE) {
+	if (uaa->usb_mode != USB_MODE_DEVICE) {
 		return (ENXIO);
 	}
 	if (uaa->use_generic == 0) {

Modified: head/sys/dev/usb/usb_busdma.c
==============================================================================
--- head/sys/dev/usb/usb_busdma.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/usb_busdma.c	Thu May 21 00:04:17 2009	(r192499)
@@ -1279,7 +1279,7 @@ usb2_bdma_work_loop(struct usb2_xfer_que
 		if (xfer->flags_int.control_xfr &&
 		    xfer->flags_int.control_hdr) {
 			/* special case */
-			if (xfer->flags_int.usb2_mode == USB_MODE_DEVICE) {
+			if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) {
 				/* The device controller writes to memory */
 				xfer->frbuffers[0].isread = 1;
 			} else {

Modified: head/sys/dev/usb/usb_compat_linux.c
==============================================================================
--- head/sys/dev/usb/usb_compat_linux.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/usb_compat_linux.c	Thu May 21 00:04:17 2009	(r192499)
@@ -194,7 +194,7 @@ usb_linux_probe(device_t dev)
 	struct usb_driver *udrv;
 	int err = ENXIO;
 
-	if (uaa->usb2_mode != USB_MODE_HOST) {
+	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
 	mtx_lock(&Giant);
@@ -640,7 +640,7 @@ usb_control_msg(struct usb_device *dev, 
 		}
 		return (err);
 	}
-	if (dev->bsd_udev->flags.usb2_mode != USB_MODE_HOST) {
+	if (dev->bsd_udev->flags.usb_mode != USB_MODE_HOST) {
 		/* not supported */
 		return (-EINVAL);
 	}

Modified: head/sys/dev/usb/usb_core.h
==============================================================================
--- head/sys/dev/usb/usb_core.h	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/usb_core.h	Thu May 21 00:04:17 2009	(r192499)
@@ -233,7 +233,7 @@
  * The following macro will tell if an USB transfer is currently
  * receiving or transferring data.
  */
-#define	USB_GET_DATA_ISREAD(xfer) ((xfer)->flags_int.usb2_mode == \
+#define	USB_GET_DATA_ISREAD(xfer) ((xfer)->flags_int.usb_mode == \
 	USB_MODE_DEVICE ? (((xfer)->endpoint & UE_DIR_IN) ? 0 : 1) : \
 	(((xfer)->endpoint & UE_DIR_IN) ? 1 : 0))
 
@@ -354,6 +354,8 @@ struct usb2_xfer_flags {
  * flags.
  */
 struct usb2_xfer_flags_int {
+
+	enum usb_hc_mode usb_mode;	/* shadow copy of "udev->usb_mode" */
 	uint16_t control_rem;		/* remainder in bytes */
 
 	uint8_t	open:1;			/* set if USB pipe has been opened */
@@ -381,7 +383,6 @@ struct usb2_xfer_flags_int {
 	uint8_t	bdma_setup:1;		/* set if BUS-DMA has been setup */
 #endif
 	uint8_t	isochronous_xfr:1;	/* set if isochronous transfer */
-	uint8_t	usb2_mode:1;		/* shadow copy of "udev->usb2_mode" */
 	uint8_t	curr_dma_set:1;		/* used by USB HC/DC driver */
 	uint8_t	can_cancel_immed:1;	/* set if USB transfer can be
 					 * cancelled immediately */
@@ -399,13 +400,12 @@ struct usb2_config {
 #define	USB_DEFAULT_INTERVAL	0
 	usb2_timeout_t timeout;		/* transfer timeout in milliseconds */
 	struct usb2_xfer_flags flags;	/* transfer flags */
+	enum usb_hc_mode usb_mode;	/* host or device mode */
 	uint8_t	type;			/* pipe type */
 	uint8_t	endpoint;		/* pipe number */
 	uint8_t	direction;		/* pipe direction */
 	uint8_t	ep_index;		/* pipe index match to use */
 	uint8_t	if_index;		/* "ifaces" index to use */
-	uint8_t usb_mode;		/* see "USB_MODE_XXX", 
-					 * "USB_MODE_MAX" means any mode! */
 };
 
 /*
@@ -495,7 +495,7 @@ struct usb2_attach_arg {
 	const void *driver_info;	/* for internal use */
 	struct usb2_device *device;	/* current device */
 	struct usb2_interface *iface;	/* current interface */
-	uint8_t	usb2_mode;		/* see USB_MODE_XXX */
+	enum usb_hc_mode usb_mode;	/* host or device mode */
 	uint8_t	port;
 	uint8_t	use_generic;		/* hint for generic drivers */
 };
@@ -529,7 +529,7 @@ uint8_t	usb2_clear_stall_callback(struct
 uint8_t	usb2_get_interface_altindex(struct usb2_interface *iface);
 usb2_error_t usb2_set_alt_interface_index(struct usb2_device *udev,
 	    uint8_t iface_index, uint8_t alt_index);
-uint8_t	usb2_get_mode(struct usb2_device *udev);
+enum usb_hc_mode	usb2_get_mode(struct usb2_device *udev);
 uint8_t	usb2_get_speed(struct usb2_device *udev);
 uint32_t usb2_get_isoc_fps(struct usb2_device *udev);
 usb2_error_t usb2_transfer_setup(struct usb2_device *udev,

Modified: head/sys/dev/usb/usb_dev.c
==============================================================================
--- head/sys/dev/usb/usb_dev.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/usb_dev.c	Thu May 21 00:04:17 2009	(r192499)
@@ -597,13 +597,13 @@ usb2_dev_get_pipe(struct usb2_device *ud
 		pipe = &udev->default_pipe;
 	} else {
 		if (dir == USB_FIFO_RX) {
-			if (udev->flags.usb2_mode == USB_MODE_HOST) {
+			if (udev->flags.usb_mode == USB_MODE_HOST) {
 				ep_dir = UE_DIR_IN;
 			} else {
 				ep_dir = UE_DIR_OUT;
 			}
 		} else {
-			if (udev->flags.usb2_mode == USB_MODE_HOST) {
+			if (udev->flags.usb_mode == USB_MODE_HOST) {
 				ep_dir = UE_DIR_OUT;
 			} else {
 				ep_dir = UE_DIR_IN;

Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/usb_device.c	Thu May 21 00:04:17 2009	(r192499)
@@ -187,8 +187,8 @@ usb2_get_pipe(struct usb2_device *udev, 
 
 	/* check USB mode */
 
-	if ((setup->usb_mode != USB_MODE_MAX) &&
-	    (udev->flags.usb2_mode != setup->usb_mode)) {
+	if (setup->usb_mode != USB_MODE_DUAL &&
+	    udev->flags.usb_mode != setup->usb_mode) {
 		/* wrong mode - no pipe */
 		return (NULL);
 	}
@@ -197,11 +197,11 @@ usb2_get_pipe(struct usb2_device *udev, 
 
 	if (setup->direction == UE_DIR_RX) {
 		ea_mask = (UE_DIR_IN | UE_DIR_OUT);
-		ea_val = (udev->flags.usb2_mode == USB_MODE_DEVICE) ?
+		ea_val = (udev->flags.usb_mode == USB_MODE_DEVICE) ?
 		    UE_DIR_OUT : UE_DIR_IN;
 	} else if (setup->direction == UE_DIR_TX) {
 		ea_mask = (UE_DIR_IN | UE_DIR_OUT);
-		ea_val = (udev->flags.usb2_mode == USB_MODE_DEVICE) ?
+		ea_val = (udev->flags.usb_mode == USB_MODE_DEVICE) ?
 		    UE_DIR_IN : UE_DIR_OUT;
 	} else if (setup->direction == UE_DIR_ANY) {
 		/* match any endpoint direction */
@@ -416,7 +416,7 @@ usb2_unconfigure(struct usb2_device *ude
 
 	/* free "cdesc" after "ifaces" and "pipes", if any */
 	if (udev->cdesc != NULL) {
-		if (udev->flags.usb2_mode != USB_MODE_DEVICE)
+		if (udev->flags.usb_mode != USB_MODE_DEVICE)
 			free(udev->cdesc, M_USB);
 		udev->cdesc = NULL;
 	}
@@ -475,7 +475,7 @@ usb2_set_config_index(struct usb2_device
 		goto done;
 	}
 	/* get the full config descriptor */
-	if (udev->flags.usb2_mode == USB_MODE_DEVICE) {
+	if (udev->flags.usb_mode == USB_MODE_DEVICE) {
 		/* save some memory */
 		err = usb2_req_get_descriptor_ptr(udev, &cdp, 
 		    (UDESC_CONFIG << 8) | index);
@@ -495,7 +495,7 @@ usb2_set_config_index(struct usb2_device
 	selfpowered = 0;
 	if ((!udev->flags.uq_bus_powered) &&
 	    (cdp->bmAttributes & UC_SELF_POWERED) &&
-	    (udev->flags.usb2_mode == USB_MODE_HOST)) {
+	    (udev->flags.usb_mode == USB_MODE_HOST)) {
 		/* May be self powered. */
 		if (cdp->bmAttributes & UC_BUS_POWERED) {
 			/* Must ask device. */
@@ -533,7 +533,7 @@ usb2_set_config_index(struct usb2_device
 		goto done;
 	}
 	/* Only update "self_powered" in USB Host Mode */
-	if (udev->flags.usb2_mode == USB_MODE_HOST) {
+	if (udev->flags.usb_mode == USB_MODE_HOST) {
 		udev->flags.self_powered = selfpowered;
 	}
 	udev->power = power;
@@ -815,7 +815,7 @@ usb2_set_alt_interface_index(struct usb2
 		err = USB_ERR_INVAL;
 		goto done;
 	}
-	if (udev->flags.usb2_mode == USB_MODE_DEVICE) {
+	if (udev->flags.usb_mode == USB_MODE_DEVICE) {
 		usb2_detach_device(udev, iface_index,
 		    USB_UNCFG_FLAG_FREE_SUBDEV);
 	} else {
@@ -1178,7 +1178,7 @@ usb2_init_attach_arg(struct usb2_device 
 	bzero(uaa, sizeof(*uaa));
 
 	uaa->device = udev;
-	uaa->usb2_mode = udev->flags.usb2_mode;
+	uaa->usb_mode = udev->flags.usb_mode;
 	uaa->port = udev->port_no;
 
 	uaa->info.idVendor = UGETW(udev->ddesc.idVendor);
@@ -1416,8 +1416,8 @@ usb2_clear_stall_proc(struct usb2_proc_m
  *------------------------------------------------------------------------*/
 struct usb2_device *
 usb2_alloc_device(device_t parent_dev, struct usb2_bus *bus,
-    struct usb2_device *parent_hub, uint8_t depth,
-    uint8_t port_index, uint8_t port_no, uint8_t speed, uint8_t usb2_mode)
+    struct usb2_device *parent_hub, uint8_t depth, uint8_t port_index,
+    uint8_t port_no, uint8_t speed, enum usb_hc_mode mode)
 {
 	struct usb2_attach_arg uaa;
 	struct usb2_device *udev;
@@ -1429,9 +1429,9 @@ usb2_alloc_device(device_t parent_dev, s
 	uint8_t device_index;
 
 	DPRINTF("parent_dev=%p, bus=%p, parent_hub=%p, depth=%u, "
-	    "port_index=%u, port_no=%u, speed=%u, usb2_mode=%u\n",
+	    "port_index=%u, port_no=%u, speed=%u, usb_mode=%u\n",
 	    parent_dev, bus, parent_hub, depth, port_index, port_no,
-	    speed, usb2_mode);
+	    speed, mode);
 
 	/*
 	 * Find an unused device index. In USB Host mode this is the
@@ -1509,7 +1509,7 @@ usb2_alloc_device(device_t parent_dev, s
 	udev->ddesc.bMaxPacketSize = USB_MAX_IPACKET;
 
 	udev->speed = speed;
-	udev->flags.usb2_mode = usb2_mode;
+	udev->flags.usb_mode = mode;
 
 	/* search for our High Speed USB HUB, if any */
 
@@ -1548,7 +1548,7 @@ usb2_alloc_device(device_t parent_dev, s
 	/* Create a link from /dev/ugenX.X to the default endpoint */
 	make_dev_alias(udev->default_dev, udev->ugen_name);
 #endif
-	if (udev->flags.usb2_mode == USB_MODE_HOST) {
+	if (udev->flags.usb_mode == USB_MODE_HOST) {
 
 		err = usb2_req_set_address(udev, NULL, device_index);
 
@@ -1703,7 +1703,7 @@ usb2_alloc_device(device_t parent_dev, s
 	usb2_check_strings(udev);
 #endif
 
-	if (udev->flags.usb2_mode == USB_MODE_HOST) {
+	if (udev->flags.usb_mode == USB_MODE_HOST) {
 		uint8_t config_index;
 		uint8_t config_quirk;
 		uint8_t set_config_failed = 0;
@@ -1981,7 +1981,7 @@ usb2_free_device(struct usb2_device *ude
 	    udev->default_dev->si_drv1);
 #endif
 
-	if (udev->flags.usb2_mode == USB_MODE_DEVICE) {
+	if (udev->flags.usb_mode == USB_MODE_DEVICE) {
 		/* stop receiving any control transfers (Device Side Mode) */
 		usb2_transfer_unsetup(udev->default_xfer, USB_DEFAULT_XFER_MAX);
 	}
@@ -2239,10 +2239,10 @@ usb2_check_strings(struct usb2_device *u
  * Returns:
  * See: USB_MODE_XXX
  */
-uint8_t
+enum usb_hc_mode
 usb2_get_mode(struct usb2_device *udev)
 {
-	return (udev->flags.usb2_mode);
+	return (udev->flags.usb_mode);
 }
 
 /*
@@ -2452,7 +2452,7 @@ usb2_peer_can_wakeup(struct usb2_device 
 	const struct usb2_config_descriptor *cdp;
 
 	cdp = udev->cdesc;
-	if ((cdp != NULL) && (udev->flags.usb2_mode == USB_MODE_HOST)) {
+	if ((cdp != NULL) && (udev->flags.usb_mode == USB_MODE_HOST)) {
 		return (cdp->bmAttributes & UC_REMOTE_WAKEUP);
 	}
 	return (0);			/* not supported */

Modified: head/sys/dev/usb/usb_device.h
==============================================================================
--- head/sys/dev/usb/usb_device.h	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/usb_device.h	Thu May 21 00:04:17 2009	(r192499)
@@ -83,7 +83,7 @@ struct usb2_interface {
  * The following structure defines the USB device flags.
  */
 struct usb2_device_flags {
-	uint8_t	usb2_mode:1;		/* USB mode (see USB_MODE_XXX) */
+	enum usb_hc_mode usb_mode;	/* host or device mode */
 	uint8_t	self_powered:1;		/* set if USB device is self powered */
 	uint8_t	no_strings:1;		/* set if USB device does not support
 					 * strings */
@@ -190,7 +190,7 @@ extern int usb2_template;
 struct usb2_device *usb2_alloc_device(device_t parent_dev, struct usb2_bus *bus,
 		    struct usb2_device *parent_hub, uint8_t depth,
 		    uint8_t port_index, uint8_t port_no, uint8_t speed,
-		    uint8_t usb2_mode);
+		    enum usb_hc_mode mode);
 struct usb2_pipe *usb2_get_pipe(struct usb2_device *udev, uint8_t iface_index,
 		    const struct usb2_config *setup);
 struct usb2_pipe *usb2_get_pipe_by_addr(struct usb2_device *udev, uint8_t ea_val);

Modified: head/sys/dev/usb/usb_generic.c
==============================================================================
--- head/sys/dev/usb/usb_generic.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/usb_generic.c	Thu May 21 00:04:17 2009	(r192499)
@@ -233,7 +233,7 @@ ugen_open_pipe_write(struct usb2_fifo *f
 	usb2_config[0].direction = UE_DIR_TX;
 	usb2_config[0].interval = USB_DEFAULT_INTERVAL;
 	usb2_config[0].flags.proxy_buffer = 1;
-	usb2_config[0].usb_mode = USB_MODE_MAX;		/* both modes */
+	usb2_config[0].usb_mode = USB_MODE_DUAL;	/* both modes */
 
 	switch (ed->bmAttributes & UE_XFERTYPE) {
 	case UE_INTERRUPT:
@@ -301,7 +301,7 @@ ugen_open_pipe_read(struct usb2_fifo *f)
 	usb2_config[0].direction = UE_DIR_RX;
 	usb2_config[0].interval = USB_DEFAULT_INTERVAL;
 	usb2_config[0].flags.proxy_buffer = 1;
-	usb2_config[0].usb_mode = USB_MODE_MAX;		/* both modes */
+	usb2_config[0].usb_mode = USB_MODE_DUAL;	/* both modes */
 
 	switch (ed->bmAttributes & UE_XFERTYPE) {
 	case UE_INTERRUPT:
@@ -584,7 +584,7 @@ ugen_set_config(struct usb2_fifo *f, uin
 {
 	DPRINTFN(2, "index %u\n", index);
 
-	if (f->udev->flags.usb2_mode != USB_MODE_HOST) {
+	if (f->udev->flags.usb_mode != USB_MODE_HOST) {
 		/* not possible in device side mode */
 		return (ENOTTY);
 	}
@@ -615,7 +615,7 @@ ugen_set_interface(struct usb2_fifo *f,
 {
 	DPRINTFN(2, "%u, %u\n", iface_index, alt_index);
 
-	if (f->udev->flags.usb2_mode != USB_MODE_HOST) {
+	if (f->udev->flags.usb_mode != USB_MODE_HOST) {
 		/* not possible in device side mode */
 		return (ENOTTY);
 	}
@@ -821,7 +821,7 @@ usb2_gen_fill_deviceinfo(struct usb2_fif
 	di->udi_config_index = udev->curr_config_index;
 	di->udi_power = udev->flags.self_powered ? 0 : udev->power;
 	di->udi_speed = udev->speed;
-	di->udi_mode = udev->flags.usb2_mode;
+	di->udi_mode = udev->flags.usb_mode;
 	di->udi_power_mode = udev->power_mode;
 	di->udi_suspended = udev->flags.peer_suspended;
 
@@ -1465,10 +1465,10 @@ ugen_ioctl(struct usb2_fifo *f, u_long c
 		usb2_config[0].timeout = 0;	/* no timeout */
 		usb2_config[0].frames = u.popen->max_frames;
 		usb2_config[0].bufsize = u.popen->max_bufsize;
-		usb2_config[0].usb_mode = USB_MODE_MAX;		/* both modes */
+		usb2_config[0].usb_mode = USB_MODE_DUAL;	/* both modes */
 
 		if (usb2_config[0].type == UE_CONTROL) {
-			if (f->udev->flags.usb2_mode != USB_MODE_HOST) {
+			if (f->udev->flags.usb_mode != USB_MODE_HOST) {
 				error = EINVAL;
 				break;
 			}
@@ -1477,7 +1477,7 @@ ugen_ioctl(struct usb2_fifo *f, u_long c
 			isread = ((usb2_config[0].endpoint &
 			    (UE_DIR_IN | UE_DIR_OUT)) == UE_DIR_IN);
 
-			if (f->udev->flags.usb2_mode != USB_MODE_HOST) {
+			if (f->udev->flags.usb_mode != USB_MODE_HOST) {
 				isread = !isread;
 			}
 			/* check permissions */
@@ -1530,7 +1530,7 @@ ugen_ioctl(struct usb2_fifo *f, u_long c
 			error = EINVAL;
 			break;
 		}
-		if (f->udev->flags.usb2_mode != USB_MODE_HOST) {
+		if (f->udev->flags.usb_mode != USB_MODE_HOST) {
 			error = EINVAL;
 			break;
 		}

Modified: head/sys/dev/usb/usb_hub.c
==============================================================================
--- head/sys/dev/usb/usb_hub.c	Wed May 20 23:34:59 2009	(r192498)
+++ head/sys/dev/usb/usb_hub.c	Thu May 21 00:04:17 2009	(r192499)
@@ -223,7 +223,7 @@ uhub_explore_sub(struct uhub_softc *sc, 
 	}
 	/* start control transfer, if device mode */
 
-	if (child->flags.usb2_mode == USB_MODE_DEVICE) {
+	if (child->flags.usb_mode == USB_MODE_DEVICE) {
 		usb2_default_transfer_setup(child);
 	}
 	/* if a HUB becomes present, do a recursive HUB explore */
@@ -276,7 +276,7 @@ uhub_reattach_port(struct uhub_softc *sc
 	usb2_error_t err;
 	uint8_t timeout;
 	uint8_t speed;
-	uint8_t usb2_mode;
+	enum usb_hc_mode mode;
 
 	DPRINTF("reattaching port %d\n", portno);
 
@@ -404,14 +404,14 @@ repeat:
 	 * NOTE: This part is currently FreeBSD specific.
 	 */
 	if (sc->sc_st.port_status & UPS_PORT_MODE_DEVICE)
-		usb2_mode = USB_MODE_DEVICE;
+		mode = USB_MODE_DEVICE;
 	else
-		usb2_mode = USB_MODE_HOST;
+		mode = USB_MODE_HOST;
 
 	/* need to create a new child */
 
 	child = usb2_alloc_device(sc->sc_dev, udev->bus, udev,
-	    udev->depth + 1, portno - 1, portno, speed, usb2_mode);
+	    udev->depth + 1, portno - 1, portno, speed, mode);
 	if (child == NULL) {
 		DPRINTFN(0, "could not allocate new device!\n");
 		goto error;
@@ -495,7 +495,7 @@ uhub_suspend_resume_port(struct uhub_sof
 		 */
 		if (is_suspend == 0)
 			usb2_dev_resume_peer(child);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905210004.n4L04HQ4048379>