This is a note to let you know that I've just added the patch titled

     Subject: USB: don't touch sysfs stuff when altsetting is unchanged

to my gregkh-2.6 tree.  Its filename is

     usb-don-t-touch-sysfs-stuff-when-altsetting-is-unchanged.patch

This tree can be found at 
    http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/


>From [EMAIL PROTECTED]  Fri Aug 10 11:06:57 2007
From: Alan Stern <[EMAIL PROTECTED]>
Date: Wed, 8 Aug 2007 11:59:18 -0400 (EDT)
Subject: USB: don't touch sysfs stuff when altsetting is unchanged
To: Greg KH <[EMAIL PROTECTED]>
Cc: USB development list <linux-usb-devel@lists.sourceforge.net>
Message-ID: <[EMAIL PROTECTED]>


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 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1173,6 +1173,7 @@ int usb_set_interface(struct usb_device 
        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 
         */
 
        /* 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 
         * (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;


Patches currently in gregkh-2.6 which might be from [EMAIL PROTECTED] are

driver/sysfs-fix-locking-in-sysfs_lookup-and-sysfs_rename_dir.patch
driver/sysfs-remove-first-pass-at-shadow-directory-support.patch
driver/sysfs-cosmetic-changes-in-sysfs_lookup.patch
driver/sysfs-make-sysfs_add-remove_one-call-link-unlink_sibling-implictly.patch
driver/sysfs-make-sysfs_add_one-automatically-check-for-duplicate-entry.patch
driver/sysfs-make-sysfs_addrm_finish-return-void.patch
driver/sysfs-simplify-sysfs_rename_dir.patch
usb/usb-add-ep-enable.patch
usb/usb-fix-bug-with-ehci-cpufreq-patch-on-nvidia-controllers.patch
usb/usb-add-direction-bit-to-urb-transfer_flags.patch
usb/usb-add-urb-ep.patch
usb/usb-address-0-handling-during-device-initialization.patch
usb/usb-avoid-urb-pipe-in-usbfs.patch
usb/usb-avoid-urb-pipe-in-usbmon.patch
usb/usb-avoid-using-urb-pipe-in-usbcore.patch
usb/usb-cdc-acm-fix-sysfs-attribute-registration-bug.patch
usb/usb-cleanup-for-previous-patches.patch
usb/usb-gadget-file-storage-gadget-cleanups.patch
usb/usb-separate-out-endpoint-queue-management-and-dma-mapping-routines.patch
usb/usb-update-spinlock-usage-for-root-hub-urbs.patch
usb/usb-stall-control-endpoint-when-file-storage-class-request-wvalue-0.patch
usb/usb-cleanups-for-g_file_storage.patch
usb/usb-don-t-touch-sysfs-stuff-when-altsetting-is-unchanged.patch
usb/usb-make-hcds-responsible-for-managing-endpoint-queues.patch
usb/usb-remove-debug-definition-from-dummy_hcd.patch

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to