Re: usb suspend backtraces.

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Mon, 16 Jul 2007, Dave Jones wrote:

>  > > in usb_autopm_do_device()
>  > > I'm suspecting logic is underflowing here causing this.
>  > 
>  > Yes, that's what it means.  I'm puzzled as to how this could occur; let 
>  > me try some tests.  What types of devices give rise to these warnings?
> 
> On the machine I tried it on, there's nothing really exotic..
> lsusb shows..
> Bus 005 Device 054: ID 0781:5150 SanDisk Corp. SDCZ2 Cruzer Mini Flash Drive (thin)
> Bus 005 Device 002: ID 050d:0234 Belkin Components F5U234 USB 2.0 4-Port Hub
> Bus 005 Device 001: ID 0000:0000  
> Bus 004 Device 003: ID 0aec:3050 Neodio Technologies Corp. ND3050 8-in-1 Card Reader
> Bus 004 Device 001: ID 0000:0000  
> Bus 003 Device 001: ID 0000:0000  
> Bus 002 Device 004: ID 04a9:1097 Canon, Inc. 
> Bus 002 Device 003: ID 045e:0053 Microsoft Corp. 
> Bus 002 Device 001: ID 0000:0000  
> Bus 001 Device 001: ID 0000:0000  
> 
> so, usb memory stick, hub, card reader, printer, mouse.
> 
> The 28 warnings in my dmesg are all preceded by..
> usb 5-1.4: new high speed USB device using ehci_hcd and address 51
> usb 5-1.4: configuration #1 chosen from 1 choice
> 
> I'm not sure how that 5-1.4 relates to the above map.
> 
> oh, there's one other case, where it prints the same thing for usb 4-2:

All right, it turns out there really is a minor bug that shows up only 
with the autosuspend delay set to 0.  The patch below fixes it (should 
you happen to care).

Alan Stern


Index: 2.6.22/drivers/usb/core/hub.c
===================================================================
--- 2.6.22.orig/drivers/usb/core/hub.c
+++ 2.6.22/drivers/usb/core/hub.c
@@ -1388,6 +1388,10 @@ int usb_new_device(struct usb_device *ud
 	udev->dev.devt = MKDEV(USB_DEVICE_MAJOR,
 			(((udev->bus->busnum-1) * 128) + (udev->devnum-1)));
 
+	/* Increment the parent's count of unsuspended children */
+	if (udev->parent)
+		usb_autoresume_device(udev->parent);
+
 	/* Register the device.  The device driver is responsible
 	 * for adding the device files to sysfs and for configuring
 	 * the device.
@@ -1395,13 +1399,11 @@ int usb_new_device(struct usb_device *ud
 	err = device_add(&udev->dev);
 	if (err) {
 		dev_err(&udev->dev, "can't device_add, error %d\n", err);
+		if (udev->parent)
+			usb_autosuspend_device(udev->parent);
 		goto fail;
 	}
 
-	/* Increment the parent's count of unsuspended children */
-	if (udev->parent)
-		usb_autoresume_device(udev->parent);
-
 exit:
 	return err;
 


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.