diff options
| author | Alan Stern <stern@rowland.harvard.edu> | 2006-08-30 15:47:18 -0400 | 
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-27 11:58:57 -0700 | 
| commit | 01d883d44a1ca8dc77486635d428cba63e7fdadf (patch) | |
| tree | 447a4293b2ec4dfa1b3d03a46a3a33498809f0e8 /drivers/usb/core/message.c | |
| parent | 645daaab0b6adc35c1838df2a82f9d729fdb1767 (diff) | |
usbcore: non-hub-specific uses of autosuspend
This patch (as741) makes the non-hub parts of usbcore actually use the
autosuspend facilities added by an earlier patch.
	Devices opened through usbfs are autoresumed and then
	autosuspended upon close.
	Likewise for usb-skeleton.
	Devices are autoresumed for usb_set_configuration.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/message.c')
| -rw-r--r-- | drivers/usb/core/message.c | 10 | 
1 files changed, 7 insertions, 3 deletions
| diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 1580c81a0db..28c6cf22578 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1366,9 +1366,6 @@ int usb_set_configuration(struct usb_device *dev, int configuration)  	if (cp && configuration == 0)  		dev_warn(&dev->dev, "config 0 descriptor??\n"); -	if (dev->state == USB_STATE_SUSPENDED) -		return -EHOSTUNREACH; -  	/* Allocate memory for new interfaces before doing anything else,  	 * so that if we run out then nothing will have changed. */  	n = nintf = 0; @@ -1403,6 +1400,11 @@ free_interfaces:  					configuration, -i);  	} +	/* Wake up the device so we can send it the Set-Config request */ +	ret = usb_autoresume_device(dev, 1); +	if (ret) +		goto free_interfaces; +  	/* if it's already configured, clear out old state first.  	 * getting rid of old interfaces means unbinding their drivers.  	 */ @@ -1422,6 +1424,7 @@ free_interfaces:  	dev->actconfig = cp;  	if (!cp) {  		usb_set_device_state(dev, USB_STATE_ADDRESS); +		usb_autosuspend_device(dev, 1);  		goto free_interfaces;  	}  	usb_set_device_state(dev, USB_STATE_CONFIGURED); @@ -1490,6 +1493,7 @@ free_interfaces:  		usb_create_sysfs_intf_files (intf);  	} +	usb_autosuspend_device(dev, 1);  	return 0;  } | 
