Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d74d4a69dc1cc7ddc0eabb9c9f1e45005e2984eb
Commit:     d74d4a69dc1cc7ddc0eabb9c9f1e45005e2984eb
Parent:     e9df41c5c5899259541dc928872cad4d07b82076
Author:     Alan Stern <[EMAIL PROTECTED]>
AuthorDate: Wed Aug 8 11:59:18 2007 -0400
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Fri Oct 12 14:55:10 2007 -0700

    USB: don't touch sysfs stuff when altsetting is unchanged
    
    This patch (as955) prevents the interface-related sysfs files and
    endpoint pseudo-devices from being deleted and recreated when a call
    to usb_set_interface() specifies the current altsetting.  Since the
    altsetting doesn't get changed, there's no need to do anything.
    
    Furthermore, avoiding changes to the endpoint devices will be
    necessary in the future.  This code is called from usb_reset_device(),
    which gets invoked for reset-resume processing, but upcoming changes
    to the PM and driver cores will make it impossible to register devices
    while a suspend/resume transition is in progress.  Since we don't need
    to re-register those endpoint devices anyhow, it's best to skip the
    whole thing.
    
    Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 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 c905b35..d638375 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)
        struct usb_host_interface *alt;
        int ret;
        int manual = 0;
+       int changed;
 
        if (dev->state == USB_STATE_SUSPENDED)
                return -EHOSTUNREACH;
@@ -1212,7 +1213,8 @@ int usb_set_interface(struct usb_device *dev, int 
interface, int alternate)
         */
 
        /* prevent submissions using previous endpoint settings */
-       if (device_is_registered(&iface->dev))
+       changed = (iface->cur_altsetting != alt);
+       if (changed && device_is_registered(&iface->dev))
                usb_remove_sysfs_intf_files(iface);
        usb_disable_interface(dev, iface);
 
@@ -1249,7 +1251,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 (device_is_registered(&iface->dev))
+       if (changed && device_is_registered(&iface->dev))
                usb_create_sysfs_intf_files(iface);
 
        return 0;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to