PERFORCE change 131548 for review

Hans Petter Selasky hselasky at FreeBSD.org
Mon Dec 24 14:29:06 PST 2007


http://perforce.freebsd.org/chv.cgi?CH=131548

Change 131548 by hselasky at hselasky_laptop001 on 2007/12/24 22:28:58

	
	Lock "bus->mtx" before calling "set_config" method.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/usb_requests.c#15 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/usb_requests.c#15 (text+ko) ====

@@ -652,16 +652,17 @@
 
 	PRINTF(("setting config %d\n", conf));
 
-	/* If we have a "set_config" method then call it */
+	/* call "set_config" method, if any */
 
 	if (udev->bus->methods->set_config) {
+		mtx_lock(&(udev->bus->mtx));
 		(udev->bus->methods->set_config)
 		    (udev, (conf == USB_UNCONFIG_NO) ?
 		    NULL : udev->cdesc);
+		mtx_unlock(&(udev->bus->mtx));
 	}
-	if (udev->flags.usb_mode == USB_MODE_DEVICE) {
-		return (0);		/* success */
-	}
+	/* do "set configuration" request */
+
 	req.bmRequestType = UT_WRITE_DEVICE;
 	req.bRequest = UR_SET_CONFIG;
 	req.wValue[0] = conf;


More information about the p4-projects mailing list