diff options
-rw-r--r-- | drivers/usb/core/message.c | 12 |
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 | } |