Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jun 2011 07:08:44 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r223411 - in stable/8/sys: dev/sound/usb dev/usb dev/usb/input dev/usb/storage netgraph/bluetooth/drivers/ubt
Message-ID:  <201106220708.p5M78ipT036672@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Wed Jun 22 07:08:44 2011
New Revision: 223411
URL: http://svn.freebsd.org/changeset/base/223411

Log:
  MFC r222051,222055: usb: change to one-pass probing of device drivers

Modified:
  stable/8/sys/dev/sound/usb/uaudio.c
  stable/8/sys/dev/usb/input/uhid.c
  stable/8/sys/dev/usb/input/ukbd.c
  stable/8/sys/dev/usb/input/ums.c
  stable/8/sys/dev/usb/storage/umass.c
  stable/8/sys/dev/usb/storage/ustorage_fs.c
  stable/8/sys/dev/usb/usb_device.c
  stable/8/sys/dev/usb/usbdi.h
  stable/8/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/sound/usb/uaudio.c
==============================================================================
--- stable/8/sys/dev/sound/usb/uaudio.c	Wed Jun 22 06:58:42 2011	(r223410)
+++ stable/8/sys/dev/sound/usb/uaudio.c	Wed Jun 22 07:08:44 2011	(r223411)
@@ -539,9 +539,6 @@ uaudio_probe(device_t dev)
 	if (uaa->usb_mode != USB_MODE_HOST)
 		return (ENXIO);
 
-	if (uaa->use_generic == 0)
-		return (ENXIO);
-
 	/* lookup non-standard device */
 
 	if (uaa->info.bInterfaceClass != UICLASS_AUDIO) {
@@ -555,7 +552,7 @@ uaudio_probe(device_t dev)
 		if (usb_test_quirk(uaa, UQ_BAD_AUDIO))
 			return (ENXIO);
 		else
-			return (0);
+			return (BUS_PROBE_GENERIC);
 	}
 
 	/* check for MIDI stream */
@@ -564,7 +561,7 @@ uaudio_probe(device_t dev)
 		if (usb_test_quirk(uaa, UQ_BAD_MIDI))
 			return (ENXIO);
 		else
-			return (0);
+			return (BUS_PROBE_GENERIC);
 	}
 	return (ENXIO);
 }

Modified: stable/8/sys/dev/usb/input/uhid.c
==============================================================================
--- stable/8/sys/dev/usb/input/uhid.c	Wed Jun 22 06:58:42 2011	(r223410)
+++ stable/8/sys/dev/usb/input/uhid.c	Wed Jun 22 07:08:44 2011	(r223411)
@@ -617,10 +617,6 @@ uhid_probe(device_t dev)
 	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
-	if (uaa->use_generic == 0) {
-		/* give Mouse and Keyboard drivers a try first */
-		return (ENXIO);
-	}
 	if (uaa->info.bInterfaceClass != UICLASS_HID) {
 
 		/* the Xbox 360 gamepad doesn't use the HID class */

Modified: stable/8/sys/dev/usb/input/ukbd.c
==============================================================================
--- stable/8/sys/dev/usb/input/ukbd.c	Wed Jun 22 06:58:42 2011	(r223410)
+++ stable/8/sys/dev/usb/input/ukbd.c	Wed Jun 22 07:08:44 2011	(r223411)
@@ -771,7 +771,7 @@ ukbd_probe(device_t dev)
 		if (usb_test_quirk(uaa, UQ_KBD_IGNORE))
 			return (ENXIO);
 		else
-			return (BUS_PROBE_GENERIC);
+			return (BUS_PROBE_DEFAULT);
 	}
 
 	error = usbd_req_get_hid_desc(uaa->device, NULL,
@@ -793,7 +793,7 @@ ukbd_probe(device_t dev)
 		if (usb_test_quirk(uaa, UQ_KBD_IGNORE))
 			error = ENXIO;
 		else
-			error = BUS_PROBE_GENERIC;
+			error = BUS_PROBE_DEFAULT;
 	} else
 		error = ENXIO;
 

Modified: stable/8/sys/dev/usb/input/ums.c
==============================================================================
--- stable/8/sys/dev/usb/input/ums.c	Wed Jun 22 06:58:42 2011	(r223410)
+++ stable/8/sys/dev/usb/input/ums.c	Wed Jun 22 07:08:44 2011	(r223411)
@@ -373,7 +373,7 @@ ums_probe(device_t dev)
 
 	if ((uaa->info.bInterfaceSubClass == UISUBCLASS_BOOT) &&
 	    (uaa->info.bInterfaceProtocol == UIPROTO_MOUSE))
-		return (BUS_PROBE_GENERIC);
+		return (BUS_PROBE_DEFAULT);
 
 	error = usbd_req_get_hid_desc(uaa->device, NULL,
 	    &d_ptr, &d_len, M_TEMP, uaa->info.bIfaceIndex);
@@ -383,7 +383,7 @@ ums_probe(device_t dev)
 
 	if (hid_is_collection(d_ptr, d_len,
 	    HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE)))
-		error = BUS_PROBE_GENERIC;
+		error = BUS_PROBE_DEFAULT;
 	else
 		error = ENXIO;
 

Modified: stable/8/sys/dev/usb/storage/umass.c
==============================================================================
--- stable/8/sys/dev/usb/storage/umass.c	Wed Jun 22 06:58:42 2011	(r223410)
+++ stable/8/sys/dev/usb/storage/umass.c	Wed Jun 22 07:08:44 2011	(r223411)
@@ -782,6 +782,7 @@ umass_probe_proto(device_t dev, struct u
 	uint32_t proto = umass_get_proto(uaa->iface);
 
 	memset(&ret, 0, sizeof(ret));
+	ret.error = BUS_PROBE_GENERIC;
 
 	/* Search for protocol enforcement */
 
@@ -870,10 +871,6 @@ umass_probe(device_t dev)
 	if (uaa->usb_mode != USB_MODE_HOST) {
 		return (ENXIO);
 	}
-	if (uaa->use_generic == 0) {
-		/* give other drivers a try first */
-		return (ENXIO);
-	}
 	temp = umass_probe_proto(dev, uaa);
 
 	return (temp.error);

Modified: stable/8/sys/dev/usb/storage/ustorage_fs.c
==============================================================================
--- stable/8/sys/dev/usb/storage/ustorage_fs.c	Wed Jun 22 06:58:42 2011	(r223410)
+++ stable/8/sys/dev/usb/storage/ustorage_fs.c	Wed Jun 22 07:08:44 2011	(r223411)
@@ -334,10 +334,6 @@ ustorage_fs_probe(device_t dev)
 	if (uaa->usb_mode != USB_MODE_DEVICE) {
 		return (ENXIO);
 	}
-	if (uaa->use_generic == 0) {
-		/* give other drivers a try first */
-		return (ENXIO);
-	}
 	/* Check for a standards compliant device */
 	id = usbd_get_interface_descriptor(uaa->iface);
 	if ((id == NULL) ||
@@ -346,7 +342,7 @@ ustorage_fs_probe(device_t dev)
 	    (id->bInterfaceProtocol != UIPROTO_MASS_BBB)) {
 		return (ENXIO);
 	}
-	return (0);
+	return (BUS_PROBE_GENERIC);
 }
 
 static int

Modified: stable/8/sys/dev/usb/usb_device.c
==============================================================================
--- stable/8/sys/dev/usb/usb_device.c	Wed Jun 22 06:58:42 2011	(r223410)
+++ stable/8/sys/dev/usb/usb_device.c	Wed Jun 22 07:08:44 2011	(r223411)
@@ -1334,7 +1334,6 @@ usb_probe_and_attach(struct usb_device *
 		uaa.info.bIfaceIndex = i;
 		uaa.info.bIfaceNum =
 		    iface->idesc->bInterfaceNumber;
-		uaa.use_generic = 0;
 		uaa.driver_info = 0;	/* reset driver_info */
 
 		DPRINTFN(2, "iclass=%u/%u/%u iindex=%u/%u\n",
@@ -1344,16 +1343,6 @@ usb_probe_and_attach(struct usb_device *
 		    uaa.info.bIfaceIndex,
 		    uaa.info.bIfaceNum);
 
-		/* try specific interface drivers first */
-
-		if (usb_probe_and_attach_sub(udev, &uaa)) {
-			/* ignore */
-		}
-		/* try generic interface drivers last */
-
-		uaa.use_generic = 1;
-		uaa.driver_info = 0;	/* reset driver_info */
-
 		if (usb_probe_and_attach_sub(udev, &uaa)) {
 			/* ignore */
 		}

Modified: stable/8/sys/dev/usb/usbdi.h
==============================================================================
--- stable/8/sys/dev/usb/usbdi.h	Wed Jun 22 06:58:42 2011	(r223410)
+++ stable/8/sys/dev/usb/usbdi.h	Wed Jun 22 07:08:44 2011	(r223411)
@@ -357,7 +357,6 @@ struct usb_attach_arg {
 	struct usb_interface *iface;	/* current interface */
 	enum usb_hc_mode usb_mode;	/* host or device mode */
 	uint8_t	port;
-	uint8_t	use_generic;		/* hint for generic drivers */
 	uint8_t dev_state;
 #define UAA_DEV_READY		0
 #define UAA_DEV_DISABLED	1

Modified: stable/8/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
==============================================================================
--- stable/8/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c	Wed Jun 22 06:58:42 2011	(r223410)
+++ stable/8/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c	Wed Jun 22 07:08:44 2011	(r223411)
@@ -409,6 +409,7 @@ static int
 ubt_probe(device_t dev)
 {
 	struct usb_attach_arg	*uaa = device_get_ivars(dev);
+	int error;
 
 	if (uaa->usb_mode != USB_MODE_HOST)
 		return (ENXIO);
@@ -416,14 +417,14 @@ ubt_probe(device_t dev)
 	if (uaa->info.bIfaceIndex != 0)
 		return (ENXIO);
 
-	if (uaa->use_generic == 0)
-		return (ENXIO);
-
 	if (usbd_lookup_id_by_uaa(ubt_ignore_devs,
 			sizeof(ubt_ignore_devs), uaa) == 0)
 		return (ENXIO);
 
-	return (usbd_lookup_id_by_uaa(ubt_devs, sizeof(ubt_devs), uaa));
+	error = usbd_lookup_id_by_uaa(ubt_devs, sizeof(ubt_devs), uaa);
+	if (error == 0)
+		return (BUS_PROBE_GENERIC);
+	return (error);
 } /* ubt_probe */
 
 /*



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