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

     Subject: USB hub: use usb_reset_composite_device

to my gregkh-2.6 tree.  Its filename is

     usb-hub-use-usb_reset_composite_device.patch

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


>From [EMAIL PROTECTED] Thu Jun  1 10:37:33 2006
Date: Thu, 1 Jun 2006 13:37:24 -0400 (EDT)
From: Alan Stern <[EMAIL PROTECTED]>
To: Greg KH <[EMAIL PROTECTED]>
cc: USB development list <linux-usb-devel@lists.sourceforge.net>
Subject: USB hub: use usb_reset_composite_device
Message-ID: <[EMAIL PROTECTED]>

This patch (as700) modifies the hub driver to take advantage of the new
usb_reset_composite_device API.  The existing code had special-case
calls stuck into usb_reset_device, just before and after the reset.
With the new version there's no need for special-case stuff; it all
happens naturally in the form of pre_reset and post_reset notifications.

Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

---
 drivers/usb/core/hub.c |   34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

--- gregkh-2.6.orig/drivers/usb/core/hub.c
+++ gregkh-2.6/drivers/usb/core/hub.c
@@ -525,15 +525,16 @@ static int hub_port_disable(struct usb_h
 
 
 /* caller has locked the hub device */
-static void hub_pre_reset(struct usb_hub *hub, int disable_ports)
+static void hub_pre_reset(struct usb_interface *intf)
 {
+       struct usb_hub *hub = usb_get_intfdata(intf);
        struct usb_device *hdev = hub->hdev;
        int port1;
 
        for (port1 = 1; port1 <= hdev->maxchild; ++port1) {
                if (hdev->children[port1 - 1]) {
                        usb_disconnect(&hdev->children[port1 - 1]);
-                       if (disable_ports)
+                       if (hub->error == 0)
                                hub_port_disable(hub, port1, 0);
                }
        }
@@ -541,8 +542,10 @@ static void hub_pre_reset(struct usb_hub
 }
 
 /* caller has locked the hub device */
-static void hub_post_reset(struct usb_hub *hub)
+static void hub_post_reset(struct usb_interface *intf)
 {
+       struct usb_hub *hub = usb_get_intfdata(intf);
+
        hub_activate(hub);
        hub_power_on(hub);
 }
@@ -802,15 +805,16 @@ static void hub_disconnect(struct usb_in
        struct usb_hub *hub = usb_get_intfdata (intf);
        struct usb_device *hdev;
 
+       /* Disconnect all children and quiesce the hub */
+       hub->error = 0;
+       hub_pre_reset(intf);
+
        usb_set_intfdata (intf, NULL);
        hdev = hub->hdev;
 
        if (hdev->speed == USB_SPEED_HIGH)
                highspeed_hubs--;
 
-       /* Disconnect all children and quiesce the hub */
-       hub_pre_reset(hub, 1);
-
        usb_free_urb(hub->urb);
        hub->urb = NULL;
 
@@ -2745,7 +2749,8 @@ static void hub_events(void)
 
                /* If the hub has died, clean up after it */
                if (hdev->state == USB_STATE_NOTATTACHED) {
-                       hub_pre_reset(hub, 0);
+                       hub->error = -ENODEV;
+                       hub_pre_reset(intf);
                        goto loop;
                }
 
@@ -2757,7 +2762,7 @@ static void hub_events(void)
                        dev_dbg (hub_dev, "resetting for error %d\n",
                                hub->error);
 
-                       ret = usb_reset_device(hdev);
+                       ret = usb_reset_composite_device(hdev, intf);
                        if (ret) {
                                dev_dbg (hub_dev,
                                        "error resetting hub: %d\n", ret);
@@ -2926,6 +2931,8 @@ static struct usb_driver hub_driver = {
        .disconnect =   hub_disconnect,
        .suspend =      hub_suspend,
        .resume =       hub_resume,
+       .pre_reset =    hub_pre_reset,
+       .post_reset =   hub_post_reset,
        .ioctl =        hub_ioctl,
        .id_table =     hub_id_table,
 };
@@ -3031,7 +3038,6 @@ int usb_reset_device(struct usb_device *
        struct usb_device               *parent_hdev = udev->parent;
        struct usb_hub                  *parent_hub;
        struct usb_device_descriptor    descriptor = udev->descriptor;
-       struct usb_hub                  *hub = NULL;
        int                             i, ret = 0;
        int                             port1 = udev->portnum;
 
@@ -3049,14 +3055,6 @@ int usb_reset_device(struct usb_device *
        }
        parent_hub = hdev_to_hub(parent_hdev);
 
-       /* If we're resetting an active hub, take some special actions */
-       if (udev->actconfig && udev->actconfig->desc.bNumInterfaces > 0 &&
-                       udev->actconfig->interface[0]->dev.driver ==
-                               &hub_driver.driver &&
-                       (hub = hdev_to_hub(udev)) != NULL) {
-               hub_pre_reset(hub, 0);
-       }
-
        set_bit(port1, parent_hub->busy_bits);
        for (i = 0; i < SET_CONFIG_TRIES; ++i) {
 
@@ -3115,8 +3113,6 @@ int usb_reset_device(struct usb_device *
        }
 
 done:
-       if (hub)
-               hub_post_reset(hub);
        return 0;
  
 re_enumerate:


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

usb/uhci-reimplement-fsbr.patch
usb/uhci-eliminate-the-td-removal-list.patch
usb/uhci-work-around-old-intel-bug.patch
usb/usb-usbcore-always-turn-on-hub-port-power.patch
usb/usbhid-automatically-set-hid_quirk_noget-for-keyboards-and-mice.patch
usb/uhci-common-result-routine-for-control-bulk-interrupt.patch
usb/uhci-move-code-for-cleaning-up-unlinked-urbs.patch
usb/usb-net2280-add-a-shutdown-routine.patch
usb/usb-uhci-fix-obscure-bug-in-enqueue.patch
usb/usb-uhci-store-the-endpoint-type-in-the-qh-structure.patch
usb/uhci-remove-non-iso-tds-as-they-are-used.patch
usb/uhci-fix-race-in-iso-dequeuing.patch
usb/uhci-remove-iso-tds-as-they-are-used.patch
usb/uhci-store-the-period-in-the-queue-header.patch
usb/uhci-use-integer-sized-frame-numbers.patch
usb/usb-print-message-when-device-is-rejected-due-to-insufficient-power.patch
usb/usb-storage-get-rid-of-the-timer-during-urb-submission.patch
usb/usbcore-fix-broken-rndis-config-selection.patch
usb/usbtest-report-errors-in-iso-tests.patch
usb/usbhid-remove-unneeded-blacklist-entries.patch
usb/gadgetfs-fix-aio-interface-bugs.patch
usb/gadgetfs-fix-memory-leaks.patch
usb/usb-hub-use-usb_reset_composite_device.patch
usb/usb-storage-use-usb_reset_composite_device.patch
usb/usbcore-port-reset-for-composite-devices.patch
usb/usbcore-recovery-from-set-configuration-failure.patch
usb/usbhid-use-usb_reset_composite_device.patch


_______________________________________________
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