From owner-p4-projects@FreeBSD.ORG Thu Jan 8 18:01:03 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BE44E10658B6; Thu, 8 Jan 2009 18:01:02 +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 4B87A10658B3 for ; Thu, 8 Jan 2009 18:01:02 +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 391AF8FC0A for ; Thu, 8 Jan 2009 18:01:02 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n08I12rG058938 for ; Thu, 8 Jan 2009 18:01:02 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n08I1222058936 for perforce@freebsd.org; Thu, 8 Jan 2009 18:01:02 GMT (envelope-from hselasky@FreeBSD.org) Date: Thu, 8 Jan 2009 18:01:02 GMT Message-Id: <200901081801.n08I1222058936@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 Cc: Subject: PERFORCE change 155829 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jan 2009 18:01:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=155829 Change 155829 by hselasky@hselasky_laptop001 on 2009/01/08 18:00:49 Cody style changes requested by: M. Warner Losh Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_core.h#31 edit .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_device.c#46 edit .. //depot/projects/usb/src/sys/dev/usb2/core/usb2_hub.c#29 edit .. //depot/projects/usb/src/sys/dev/usb2/include/usb2_defs.h#8 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_core.h#31 (text+ko) ==== @@ -101,8 +101,6 @@ #define USB_HOST_ALIGN 8 /* bytes, must be power of two */ -#define USB_ROOT_HUB_ADDR 1 /* value */ - #define USB_ISOC_TIME_MAX 128 /* ms */ #define USB_FS_ISOC_UFRAME_MAX 4 /* exclusive unit */ ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_device.c#46 (text+ko) ==== @@ -1293,18 +1293,15 @@ * Device index zero is not used and device index 1 should * always be the root hub. */ - for (device_index = USB_ROOT_HUB_ADDR;; device_index++) { -#if (USB_ROOT_HUB_ADDR > USB_MIN_DEVICES) -#error "Incorrect device limit." -#endif - if (device_index == bus->devices_max) { - device_printf(bus->bdev, - "No free USB device " - "index for new device!\n"); - return (NULL); - } - if (bus->devices[device_index] == NULL) - break; + for (device_index = USB_ROOT_HUB_ADDR; + (device_index != bus->devices_max) && + (bus->devices[device_index] != NULL); + device_index++) /* nop */; + + if (device_index == bus->devices_max) { + device_printf(bus->bdev, + "No free USB device index for new device!\n"); + return (NULL); } if (depth > 0x10) { ==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_hub.c#29 (text+ko) ==== @@ -1520,12 +1520,8 @@ * The root HUB device is never suspended * and we simply skip it. */ - for (x = USB_ROOT_HUB_ADDR + 1;; x++) { -#if ((USB_ROOT_HUB_ADDR + 1) > USB_MIN_DEVICES) -#error "Incorrect device limit." -#endif - if (x == bus->devices_max) - break; + for (x = USB_ROOT_HUB_ADDR + 1; + x != bus->devices_max; x++) { udev = bus->devices[x]; if (udev == NULL) @@ -1568,12 +1564,8 @@ /* Re-loop all the devices to get the actual state */ - for (x = USB_ROOT_HUB_ADDR + 1;; x++) { -#if ((USB_ROOT_HUB_ADDR + 1) > USB_MIN_DEVICES) -#error "Incorrect device limit." -#endif - if (x == bus->devices_max) - break; + for (x = USB_ROOT_HUB_ADDR + 1; + x != bus->devices_max; x++) { udev = bus->devices[x]; if (udev == NULL) ==== //depot/projects/usb/src/sys/dev/usb2/include/usb2_defs.h#8 (text+ko) ==== @@ -35,6 +35,8 @@ #define USB_EP_MAX (2*16) /* hardcoded */ #define USB_FIFO_MAX (4 * USB_EP_MAX) +#define USB_ROOT_HUB_ADDR 1 /* index */ + #define USB_MIN_DEVICES 2 /* unused + root HUB */ #define USB_MAX_DEVICES USB_DEV_MAX /* including virtual root HUB and @@ -58,15 +60,18 @@ /* sanity checks */ #if (USB_FIFO_MAX < USB_EP_MAX) -#error "Misconfigured limits #1" +#error "There cannot be less FIFOs than USB endpoints." #endif #if (USB_FIFO_MAX & 1) -#error "Misconfigured limits #2" +#error "Number of FIFOs must be odd." #endif #if (USB_EP_MAX < (2*16)) -#error "Misconfigured limits #3" +#error "Number of hardware USB endpoints cannot be less than 32." #endif #if (USB_MAX_DEVICES < USB_MIN_DEVICES) -#error "Misconfigured limits #4" +#error "Minimum number of devices is greater than maximum number of devices." +#endif +#if (USB_ROOT_HUB_ADDR >= USB_MIN_DEVICES) +#error "The root hub address must be less than USB_MIN_DEVICES." #endif #endif /* _USB2_DEFS_H_ */