summaryrefslogtreecommitdiff
path: root/drivers/usb/core/message.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-11-06 19:43:42 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2007-11-29 00:58:35 +0300
commit7e61559f6199bb387037abfc7d10a893973561fc (patch)
treedd3e8f8cca77077bc4567a047cfe9ee74d100525 /drivers/usb/core/message.c
parent5fdcd0396be443e36a4e2128f51818acca570ee7 (diff)
downloadlinux-7e61559f6199bb387037abfc7d10a893973561fc.tar.xz
USB: keep track of whether interface sysfs files exist
This patch (as1009) solves the problem of multiple registrations for USB sysfs files in a more satisfying way than the existing code. It simply adds a flag to keep track of whether or not the files have been created; that way the files can be created or removed as needed. Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Diffstat (limited to 'drivers/usb/core/message.c')
-rw-r--r--drivers/usb/core/message.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 316a746e0080..40fd39de5bf9 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1172,7 +1172,6 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
struct usb_host_interface *alt;
int ret;
int manual = 0;
- int changed;
if (dev->state == USB_STATE_SUSPENDED)
return -EHOSTUNREACH;
@@ -1212,8 +1211,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
*/
/* prevent submissions using previous endpoint settings */
- changed = (iface->cur_altsetting != alt);
- if (changed && device_is_registered(&iface->dev))
+ if (iface->cur_altsetting != alt && device_is_registered(&iface->dev))
usb_remove_sysfs_intf_files(iface);
usb_disable_interface(dev, iface);
@@ -1250,7 +1248,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate)
* (Likewise, EP0 never "halts" on well designed devices.)
*/
usb_enable_interface(dev, iface);
- if (changed && device_is_registered(&iface->dev))
+ if (device_is_registered(&iface->dev))
usb_create_sysfs_intf_files(iface);
return 0;
@@ -1641,12 +1639,6 @@ free_interfaces:
intf->dev.bus_id, ret);
continue;
}
-
- /* The driver's probe method can call usb_set_interface(),
- * which would mean the interface's sysfs files are already
- * created. Just in case, we'll remove them first.
- */
- usb_remove_sysfs_intf_files(intf);
usb_create_sysfs_intf_files(intf);
}