This is a note to let you know that I've just added the patch titled Subject: [PATCH 5/6] USB hub driver: perform autosuspend
to my gregkh-2.6 tree. Its filename is usb-hub-driver-perform-autosuspend.patch This tree can be found at http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/ >From [EMAIL PROTECTED] Wed Aug 30 12:47:30 2006 Date: Wed, 30 Aug 2006 15:47:23 -0400 (EDT) From: Alan Stern <[EMAIL PROTECTED]> To: Greg KH <[EMAIL PROTECTED]> cc: USB development list <linux-usb-devel@lists.sourceforge.net> Subject: [PATCH 5/6] USB hub driver: perform autosuspend Message-ID: <[EMAIL PROTECTED]> This patch (as742) adds autosuspend/autoresume support to the USB hub driver. The largest aspect of the change is that we no longer need a special flag for root hubs that want to be resumed. Now every hub is autoresumed whenever khubd needs to access it. Signed-off-by: Alan Stern <[EMAIL PROTECTED]> Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]> --- drivers/usb/core/hub.c | 45 +++++++++++++++++++++++++++------------------ drivers/usb/core/hub.h | 1 - 2 files changed, 27 insertions(+), 19 deletions(-) --- gregkh-2.6.orig/drivers/usb/core/hub.c +++ gregkh-2.6/drivers/usb/core/hub.c @@ -286,6 +286,9 @@ static void kick_khubd(struct usb_hub *h { unsigned long flags; + /* Suppress autosuspend until khubd runs */ + to_usb_interface(hub->intfdev)->pm_usage_cnt = 1; + spin_lock_irqsave(&hub_event_lock, flags); if (list_empty(&hub->event_list)) { list_add_tail(&hub->event_list, &hub_event_list); @@ -467,7 +470,6 @@ static void hub_quiesce(struct usb_hub * /* (nonblocking) khubd and related activity won't re-trigger */ hub->quiescing = 1; hub->activating = 0; - hub->resume_root_hub = 0; /* (blocking) stop khubd and related activity */ usb_kill_urb(hub->urb); @@ -483,7 +485,7 @@ static void hub_activate(struct usb_hub hub->quiescing = 0; hub->activating = 1; - hub->resume_root_hub = 0; + status = usb_submit_urb(hub->urb, GFP_NOIO); if (status < 0) dev_err(hub->intfdev, "activate --> %d\n", status); @@ -893,6 +895,7 @@ descriptor_error: INIT_WORK(&hub->leds, led_work, hub); usb_set_intfdata (intf, hub); + intf->needs_remote_wakeup = 1; if (hdev->speed == USB_SPEED_HIGH) highspeed_hubs++; @@ -1885,6 +1888,8 @@ static int hub_suspend(struct usb_interf } } + dev_dbg(&intf->dev, "%s\n", __FUNCTION__); + /* "global suspend" of the downstream HC-to-USB interface */ if (!hdev->parent) { struct usb_bus *bus = hdev->bus; @@ -1907,10 +1912,12 @@ static int hub_suspend(struct usb_interf static int hub_resume(struct usb_interface *intf) { - struct usb_device *hdev = interface_to_usbdev(intf); struct usb_hub *hub = usb_get_intfdata (intf); + struct usb_device *hdev = hub->hdev; int status; + dev_dbg(&intf->dev, "%s\n", __FUNCTION__); + /* "global resume" of the downstream HC-to-USB interface */ if (!hdev->parent) { struct usb_bus *bus = hdev->bus; @@ -1949,7 +1956,6 @@ void usb_resume_root_hub(struct usb_devi { struct usb_hub *hub = hdev_to_hub(hdev); - hub->resume_root_hub = 1; kick_khubd(hub); } @@ -2586,16 +2592,13 @@ static void hub_events(void) intf = to_usb_interface(hub->intfdev); hub_dev = &intf->dev; - i = hub->resume_root_hub; - - dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x%s\n", + dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x\n", hdev->state, hub->descriptor ? hub->descriptor->bNbrPorts : 0, /* NOTE: expects max 15 ports... */ (u16) hub->change_bits[0], - (u16) hub->event_bits[0], - i ? ", resume root" : ""); + (u16) hub->event_bits[0]); usb_get_intf(intf); spin_unlock_irq(&hub_event_lock); @@ -2616,16 +2619,16 @@ static void hub_events(void) goto loop; } - /* Is this is a root hub wanting to reactivate the downstream - * ports? If so, be sure the interface resumes even if its - * stub "device" node was never suspended. - */ - if (i) - usb_autoresume_device(hdev, 0); + /* Autoresume */ + ret = usb_autopm_get_interface(intf); + if (ret) { + dev_dbg(hub_dev, "Can't autoresume: %d\n", ret); + goto loop; + } - /* If this is an inactive or suspended hub, do nothing */ + /* If this is an inactive hub, do nothing */ if (hub->quiescing) - goto loop; + goto loop_autopm; if (hub->error) { dev_dbg (hub_dev, "resetting for error %d\n", @@ -2635,7 +2638,7 @@ static void hub_events(void) if (ret) { dev_dbg (hub_dev, "error resetting hub: %d\n", ret); - goto loop; + goto loop_autopm; } hub->nerrors = 0; @@ -2763,6 +2766,11 @@ static void hub_events(void) if (!hdev->parent && !hub->busy_bits[0]) usb_enable_root_hub_irq(hdev->bus); +loop_autopm: + /* Allow autosuspend if we're not going to run again */ + intf->pm_usage_cnt = 1; + if (list_empty(&hub->event_list)) + usb_autopm_put_interface(intf); loop: usb_unlock_device(hdev); usb_put_intf(intf); @@ -2804,6 +2812,7 @@ static struct usb_driver hub_driver = { .post_reset = hub_post_reset, .ioctl = hub_ioctl, .id_table = hub_id_table, + .supports_autosuspend = 1, }; int usb_hub_init(void) --- gregkh-2.6.orig/drivers/usb/core/hub.h +++ gregkh-2.6/drivers/usb/core/hub.h @@ -226,7 +226,6 @@ struct usb_hub { unsigned limited_power:1; unsigned quiescing:1; unsigned activating:1; - unsigned resume_root_hub:1; unsigned has_indicators:1; enum hub_led_mode indicator[USB_MAXCHILDREN]; Patches currently in gregkh-2.6 which might be from [EMAIL PROTECTED] are usb/usbcore-add-usb_device_driver-definition.patch usb/usbcore-track-whether-interfaces-are-suspended.patch usb/usbcore-add-configuration_string-to-attribute-group.patch usb/usbcore-rename-usb_suspend_device-to-usb_port_suspend.patch usb/usbcore-move-code-among-source-files.patch usb/usb-pl2303-remove-80-columns-limit-violations-in-pl2303-driver.patch usb/usb-usbtouchscreen-version-0.4.patch usb/usbcore-khubd-and-busy-port-handling.patch usb/usbcore-make-hcd_endpoint_disable-wait-for-queue-to-drain.patch usb/usb-skeleton-don-t-submit-urbs-after-disconnection.patch usb/usbcore-fix-up-device-and-power-state-tests.patch usb/usbcore-make-usb_generic-a-usb_device_driver.patch usb/usbcore-resume-device-resume-recursion.patch usb/usbcore-set-device-and-power-states-properly.patch usb/usbcore-split-suspend-resume-for-device-and-interfaces.patch usb/usbcore-suspending-devices-with-no-driver.patch usb/usbfs-detect-device-unregistration.patch usb/usbfs-private-mutex-for-open-release-and-remove.patch usb/hub-driver-improve-use-of-ifdef.patch usb/usb-properly-unregister-reboot-notifier-in-case-of-failure-in-ehci-hcd.patch usb/wusb-hub-recognizes-wusb-ports.patch usb/uhci-increase-resume-detect-off-delay.patch usb/wusb-handle-wusb-device-ep0-speed-settings.patch usb/wusb-pretty-print-new-devices.patch usb/usb-deal-with-broken-config-descriptors.patch usb/usb-hub-driver-perform-autosuspend.patch usb/usb-storage-fix-for-ufi-lun-detection.patch usb/usb-remove-struct-usb_operations.patch usb/usb-usb-hub-driver-improve-use-of-ifdef-fix.patch usb/usbcore-help-drivers-to-change-device-configs.patch usb/usb-replace-kernel_thread-with-kthread_run-in-libusual.c.patch usb/usbcore-add-autosuspend-autoresume-infrastructure.patch usb/usbcore-add-flag-for-whether-a-host-controller-uses-dma.patch usb/usbcore-non-hub-specific-uses-of-autosuspend.patch usb/usbcore-remove-usb_suspend_root_hub.patch usb/usbcore-store-each-usb_device-s-level-in-the-tree.patch usb/usbcore-trim-down-usb_bus-structure.patch usb/usbmon-don-t-call-mon_dmapeek-if-dma-isn-t-being-used.patch usb/ehci-hcd-fix-root-hub-wakeup-support.patch ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel