diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-19 12:59:04 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-19 12:59:04 -0800 |
commit | 460223d21d960e420775ca4d11ddaa8389af4d25 (patch) | |
tree | c1e9d3e661180263f5e4ac72af85a151d3c183e7 /drivers/usb/core/message.c | |
parent | 255f0385c8e0d6b9005c0e09fffb5bd852f3b506 (diff) | |
parent | ed077bb714816e942ea9b740156659a28a34112f (diff) | |
download | linux-460223d21d960e420775ca4d11ddaa8389af4d25.tar.gz linux-460223d21d960e420775ca4d11ddaa8389af4d25.tar.bz2 linux-460223d21d960e420775ca4d11ddaa8389af4d25.zip |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (39 commits)
USB: at91-ohci, handle extra at91sam9261 ahb clock
USB: another id for cp2101 driver
USB: ueagle-atm.c needs sched.h
USB: at91_udc, shrink runtime footprint
usbnet: add missing Kconfig for KC2190 cables
usbnet: init fault (oops) cleanup, whitespace fixes
usbnet: recognize SiteCom CN-124
usb: Remove Airprime device from option.c
USB: change __init to __devinit for isp116x_probe
USB: ps3: don't call ps3_system_bus_driver_register on other platforms
USB: hid-core.c: Removes GTCO CalComp Interwrite IPanel PIDs from blacklist
USB: kernel-doc fixes
USB: quirky device for cdc-acm
USB: cdc-acm: fix incorrect throtteling, make set_control optional
USB: unconfigure devices which have config 0
USB: make usb_iso_packet_descriptor.status signed
USB: fix g_serial small error
USB: use __u32 rather than u32 in userspace ioctls in usbdevice_fs.h
USB Storage: US_FL_IGNORE_RESIDUE needed for Aiptek MP3 Player
USB: Fix misspelled "USBNET_MII" kernel config option.
...
Diffstat (limited to 'drivers/usb/core/message.c')
-rw-r--r-- | drivers/usb/core/message.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 8aca3574c2b5..74edaea5665d 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1316,6 +1316,14 @@ static void release_interface(struct device *dev) * use this kind of configurability; many devices only have one * configuration. * + * @configuration is the value of the configuration to be installed. + * According to the USB spec (e.g. section 9.1.1.5), configuration values + * must be non-zero; a value of zero indicates that the device in + * unconfigured. However some devices erroneously use 0 as one of their + * configuration values. To help manage such devices, this routine will + * accept @configuration = -1 as indicating the device should be put in + * an unconfigured state. + * * USB device configurations may affect Linux interoperability, * power consumption and the functionality available. For example, * the default configuration is limited to using 100mA of bus power, @@ -1347,10 +1355,15 @@ int usb_set_configuration(struct usb_device *dev, int configuration) struct usb_interface **new_interfaces = NULL; int n, nintf; - for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { - if (dev->config[i].desc.bConfigurationValue == configuration) { - cp = &dev->config[i]; - break; + if (configuration == -1) + configuration = 0; + else { + for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { + if (dev->config[i].desc.bConfigurationValue == + configuration) { + cp = &dev->config[i]; + break; + } } } if ((!cp && configuration != 0)) @@ -1359,6 +1372,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration) /* The USB spec says configuration 0 means unconfigured. * But if a device includes a configuration numbered 0, * we will accept it as a correctly configured state. + * Use -1 if you really want to unconfigure the device. */ if (cp && configuration == 0) dev_warn(&dev->dev, "config 0 descriptor??\n"); |