patch-2.3.43 linux/drivers/usb/devices.c

Next file: linux/drivers/usb/devio.c
Previous file: linux/drivers/usb/dabusb.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.42/linux/drivers/usb/devices.c linux/drivers/usb/devices.c
@@ -366,7 +366,7 @@
 /*****************************************************************/
 
 static char *usb_device_dump(char *start, char *end, struct usb_device *usbdev,
-			     int bus, int level, int index, int count)
+			     struct usb_bus *bus, int level, int index, int count)
 {
 	int chix;
 	int cnt = 0;
@@ -380,7 +380,7 @@
 	 * So the root hub's parent is 0 and any device that is
 	 * plugged into the root hub has a parent of 0.
 	 */
-	start += sprintf(start, format_topo, bus, level, parent_devnum, index, count,
+	start += sprintf(start, format_topo, bus->busnum, level, parent_devnum, index, count,
 			 usbdev->devnum, usbdev->slow ? "1.5" : "12 ", usbdev->maxchild);
 	/*
 	 * level = topology-tier level;
@@ -388,9 +388,13 @@
 	 * index = parent's connector number;
 	 * count = device count at this level
 	 */
-	/* do not dump descriptors for root hub */
-	if (usbdev->devnum >= 0)
-		start = usb_dump_desc(start, end, usbdev);
+	/* If this is the root hub, display the bandwidth information */
+	if (level == 0)
+		start += sprintf(start, format_bandwidth, bus->bandwidth_allocated, 
+				FRAME_TIME_MAX_USECS_ALLOC,
+				(100 * bus->bandwidth_allocated + FRAME_TIME_MAX_USECS_ALLOC / 2) / FRAME_TIME_MAX_USECS_ALLOC,
+			         bus->bandwidth_int_reqs, bus->bandwidth_isoc_reqs);
+	start = usb_dump_desc(start, end, usbdev);
 	if (start > end)
 		return start + sprintf(start, "(truncated)\n");
 	/* Now look at all of this device's children. */
@@ -422,12 +426,9 @@
 	pos = *ppos;
 	/* enumerate busses */
 	for (buslist = usb_bus_list.next; buslist != &usb_bus_list; buslist = buslist->next) {
-		/* print bandwidth allocation */
+		/* print devices for this bus */
 		bus = list_entry(buslist, struct usb_bus, bus_list);
-		len = sprintf(page, format_bandwidth, bus->bandwidth_allocated, FRAME_TIME_MAX_USECS_ALLOC,
-			      (100 * bus->bandwidth_allocated + FRAME_TIME_MAX_USECS_ALLOC / 2) / FRAME_TIME_MAX_USECS_ALLOC,
-			      bus->bandwidth_int_reqs, bus->bandwidth_isoc_reqs);
-		end = usb_device_dump(page + len, page + (2*PAGE_SIZE - 256), bus->root_hub, bus->busnum, 0, 0, 0);
+		end = usb_device_dump(page, page + (2*PAGE_SIZE - 256), bus->root_hub, bus, 0, 0, 0);
 		len = end - page;
 		if (len > pos) {
 			len -= pos;
@@ -512,15 +513,9 @@
 }
 
 struct file_operations usbdevfs_devices_fops = {
-	usb_device_lseek,   /* lseek   */
-	usb_device_read,    /* read    */
-	NULL,               /* write   */
-	NULL,               /* readdir */
-	usb_device_poll,    /* poll    */
-	NULL,               /* ioctl   */
-	NULL,               /* mmap    */
-	usb_device_open,    /* open    */
-	NULL,               /* flush   */
-	usb_device_release, /* release */
-	NULL                /* fsync   */
+	llseek:		usb_device_lseek,
+	read:		usb_device_read,
+	poll:		usb_device_poll,
+	open:		usb_device_open,
+	release:	usb_device_release,
 };

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)