aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2005-10-24 15:33:03 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 19:47:51 -0400
commit0e6c8e8db508fcb292836b23d039649c5de29090 (patch)
tree5a65aa48c6dbc5c81d1665802d4e632c64b850e3 /drivers/usb
parentbe69e5b1900a19a545becda822b18d6f09168ba5 (diff)
[PATCH] usbcore: endpoint attributes track altsetting changes
This patch (as588) fixes the way endpoint attribute files are registered and unregistered. Now they will correctly track along with altsetting changes. This fixes bugzilla entry #5467. In a separate but related change, when a usb_reset_configuration call fails, the device state is not changed to USB_STATE_ADDRESS. In the first place, failure means that we don't know what the state is, not that we know the device is unconfigured. In the second place, doing this can potentially lead to a memory leak, since usbcore might not realize there still is a current configuration that needs to be destroyed. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/message.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 574d0d4b3401..5ad0d5e28119 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1149,6 +1149,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1149 */ 1149 */
1150 1150
1151 /* prevent submissions using previous endpoint settings */ 1151 /* prevent submissions using previous endpoint settings */
1152 if (device_is_registered(&iface->dev))
1153 usb_remove_sysfs_intf_files(iface);
1152 usb_disable_interface(dev, iface); 1154 usb_disable_interface(dev, iface);
1153 1155
1154 iface->cur_altsetting = alt; 1156 iface->cur_altsetting = alt;
@@ -1184,6 +1186,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1184 * (Likewise, EP0 never "halts" on well designed devices.) 1186 * (Likewise, EP0 never "halts" on well designed devices.)
1185 */ 1187 */
1186 usb_enable_interface(dev, iface); 1188 usb_enable_interface(dev, iface);
1189 if (device_is_registered(&iface->dev))
1190 usb_create_sysfs_intf_files(iface);
1187 1191
1188 return 0; 1192 return 0;
1189} 1193}
@@ -1233,10 +1237,8 @@ int usb_reset_configuration(struct usb_device *dev)
1233 USB_REQ_SET_CONFIGURATION, 0, 1237 USB_REQ_SET_CONFIGURATION, 0,
1234 config->desc.bConfigurationValue, 0, 1238 config->desc.bConfigurationValue, 0,
1235 NULL, 0, USB_CTRL_SET_TIMEOUT); 1239 NULL, 0, USB_CTRL_SET_TIMEOUT);
1236 if (retval < 0) { 1240 if (retval < 0)
1237 usb_set_device_state(dev, USB_STATE_ADDRESS);
1238 return retval; 1241 return retval;
1239 }
1240 1242
1241 dev->toggle[0] = dev->toggle[1] = 0; 1243 dev->toggle[0] = dev->toggle[1] = 0;
1242 1244
@@ -1245,6 +1247,8 @@ int usb_reset_configuration(struct usb_device *dev)
1245 struct usb_interface *intf = config->interface[i]; 1247 struct usb_interface *intf = config->interface[i];
1246 struct usb_host_interface *alt; 1248 struct usb_host_interface *alt;
1247 1249
1250 if (device_is_registered(&intf->dev))
1251 usb_remove_sysfs_intf_files(intf);
1248 alt = usb_altnum_to_altsetting(intf, 0); 1252 alt = usb_altnum_to_altsetting(intf, 0);
1249 1253
1250 /* No altsetting 0? We'll assume the first altsetting. 1254 /* No altsetting 0? We'll assume the first altsetting.
@@ -1257,6 +1261,8 @@ int usb_reset_configuration(struct usb_device *dev)
1257 1261
1258 intf->cur_altsetting = alt; 1262 intf->cur_altsetting = alt;
1259 usb_enable_interface(dev, intf); 1263 usb_enable_interface(dev, intf);
1264 if (device_is_registered(&intf->dev))
1265 usb_create_sysfs_intf_files(intf);
1260 } 1266 }
1261 return 0; 1267 return 0;
1262} 1268}