aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-04-04 23:46:59 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-25 00:16:48 -0400
commit61a5c657892a43653d6189972159590751a0673e (patch)
tree3e3da283513b7cde81c0ccd5a67692500a196afb
parent96e12fced365262e185a8e935db23973337b8a2a (diff)
USB: rework sysfs removal of interface files
Removing an interface's sysfs files before unregistering the interface doesn't work properly, because usb_unbind_interface() will reinstall altsetting 0 and thereby create new sysfs files. This patch (as1074) removes the files after the unregistration is finished. It's not quite as clean, but at least it works. Also, there's no need to check if an interface has been registered before removing its sysfs files. If it hasn't been registered then the files won't have been created, so usb_remove_sysfs_intf_files() will simply do nothing. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Tested-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/core/message.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index a3695b5115ff..5b23f6b017d7 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1089,8 +1089,8 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
1089 continue; 1089 continue;
1090 dev_dbg(&dev->dev, "unregistering interface %s\n", 1090 dev_dbg(&dev->dev, "unregistering interface %s\n",
1091 interface->dev.bus_id); 1091 interface->dev.bus_id);
1092 usb_remove_sysfs_intf_files(interface);
1093 device_del(&interface->dev); 1092 device_del(&interface->dev);
1093 usb_remove_sysfs_intf_files(interface);
1094 } 1094 }
1095 1095
1096 /* Now that the interfaces are unbound, nobody should 1096 /* Now that the interfaces are unbound, nobody should
@@ -1231,7 +1231,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
1231 */ 1231 */
1232 1232
1233 /* prevent submissions using previous endpoint settings */ 1233 /* prevent submissions using previous endpoint settings */
1234 if (iface->cur_altsetting != alt && device_is_registered(&iface->dev)) 1234 if (iface->cur_altsetting != alt)
1235 usb_remove_sysfs_intf_files(iface); 1235 usb_remove_sysfs_intf_files(iface);
1236 usb_disable_interface(dev, iface); 1236 usb_disable_interface(dev, iface);
1237 1237
@@ -1330,8 +1330,7 @@ int usb_reset_configuration(struct usb_device *dev)
1330 struct usb_interface *intf = config->interface[i]; 1330 struct usb_interface *intf = config->interface[i];
1331 struct usb_host_interface *alt; 1331 struct usb_host_interface *alt;
1332 1332
1333 if (device_is_registered(&intf->dev)) 1333 usb_remove_sysfs_intf_files(intf);
1334 usb_remove_sysfs_intf_files(intf);
1335 alt = usb_altnum_to_altsetting(intf, 0); 1334 alt = usb_altnum_to_altsetting(intf, 0);
1336 1335
1337 /* No altsetting 0? We'll assume the first altsetting. 1336 /* No altsetting 0? We'll assume the first altsetting.