diff options
-rw-r--r-- | drivers/usb/core/message.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index c905b35d4f85..d638375e22e7 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1173,6 +1173,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1173 | struct usb_host_interface *alt; | 1173 | struct usb_host_interface *alt; |
1174 | int ret; | 1174 | int ret; |
1175 | int manual = 0; | 1175 | int manual = 0; |
1176 | int changed; | ||
1176 | 1177 | ||
1177 | if (dev->state == USB_STATE_SUSPENDED) | 1178 | if (dev->state == USB_STATE_SUSPENDED) |
1178 | return -EHOSTUNREACH; | 1179 | return -EHOSTUNREACH; |
@@ -1212,7 +1213,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1212 | */ | 1213 | */ |
1213 | 1214 | ||
1214 | /* prevent submissions using previous endpoint settings */ | 1215 | /* prevent submissions using previous endpoint settings */ |
1215 | if (device_is_registered(&iface->dev)) | 1216 | changed = (iface->cur_altsetting != alt); |
1217 | if (changed && device_is_registered(&iface->dev)) | ||
1216 | usb_remove_sysfs_intf_files(iface); | 1218 | usb_remove_sysfs_intf_files(iface); |
1217 | usb_disable_interface(dev, iface); | 1219 | usb_disable_interface(dev, iface); |
1218 | 1220 | ||
@@ -1249,7 +1251,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1249 | * (Likewise, EP0 never "halts" on well designed devices.) | 1251 | * (Likewise, EP0 never "halts" on well designed devices.) |
1250 | */ | 1252 | */ |
1251 | usb_enable_interface(dev, iface); | 1253 | usb_enable_interface(dev, iface); |
1252 | if (device_is_registered(&iface->dev)) | 1254 | if (changed && device_is_registered(&iface->dev)) |
1253 | usb_create_sysfs_intf_files(iface); | 1255 | usb_create_sysfs_intf_files(iface); |
1254 | 1256 | ||
1255 | return 0; | 1257 | return 0; |